From: Marcos D. de A. <mar...@gm...> - 2010-02-19 20:36:39
|
Dear Vishnu Soni, I believe your question has already been answered. Please find below the text of the e-mail that I have sent to you. The code excerpt may help you implement the methods you require to submit a group of Gridlets to a GridResource at once. Regards, Marcos ---------------------------- I am not testing the code below, but it should work more or less as described in this email. In the entity that submits the jobs you implement a method that packs the Gridlets in a list and schedules an event to be received by the GridResource. The method should contain more or less the following: // Creates the list LinkedList<Gridlet> jobList = new LinkedList<Gridlet>(); // and adds the Gridlets to it jobList.add( ... ); // Create the event tag PACK_OF_GRIDLETS somewhere send(super.output, delay, PACK_OF_GRIDLETS, new IO_data(jobList, jobList.size() * size_of_one_job, resourceID, netServiceLevel); Then extend GridResource class and implement the method processOtherEvent(Sim_event ev), which will be more or less as follows: protected void processOtherEvent(Sim_event ev) { if(ev.get_tag() == PACK_OF_GRIDLETS) { // get the list of Gridlets LinkedList<Gridlet> jobList = (LinkedList<Gridlet>)ev.get_data(); // for each gridlet, makes a submission to the resource itself for (Gridlet gl : jobList) { processGridletSubmit(gl, false); } } else { super.processOtherEvent(ev); } } And the processGridletSubmit() should look like: private void processGridletSubmit(Gridlet gl, boolean ack) { try { // checks whether this Gridlet has finished or not if (gl.isFinished()) { String name = GridSim.getEntityName( gl.getUserID() ); System.out.println(super.get_name() + ": Warning - Gridlet #" + gl.getGridletID() + " owned by " + name + " is already completed/finished."); System.out.println("Therefore, it is not being executed again"); System.out.println(); // NOTE: If a Gridlet has finished, then it won't be processed. // So, if ack is required, this method sends back a result. // If ack is not required, this method don't send back a result. // Hence, this might cause GridSim to be hanged since waiting // for this Gridlet back. if (ack) { int[] array = new int[2]; array[0] = gl.getGridletID(); array[1] = GridSimTags.FALSE; // unique tag = operation tag int tag = GridSimTags.GRIDLET_SUBMIT_ACK; super.send(super.output, GridSimTags.SCHEDULE_NOW, tag, new IO_data(array, SIZE, gl.getUserID()) ); } super.send(super.output, 0, GridSimTags.GRIDLET_RETURN, new IO_data(gl,gl.getGridletOutputSize(),gl.getUserID()) ); return; } // process this Gridlet to this GridResource gl.setResourceParameter(super.get_id(), resource_.getCostPerSec()); policy_.gridletSubmit(gl, ack); } catch (ClassCastException c) { System.out.println(super.get_name() + ".processGridletSubmit(): " + "ClassCastException error."); System.out.println( c.getMessage() ); } catch (Exception e) { System.out.println(super.get_name() + ".processGridletSubmit(): " + "Exception error."); System.out.println( e.getMessage() ); } } Well, the code above may not work exactly like I described here, but you can have an idea on how to do it. Regards, Marcos ---------------------------- On 19 February 2010 20:35, vishnu soni <vis...@gm...> wrote: > hi , > i want to groups the gridlets and store all groups into one > storage , after grouping all the gridlets , i want to submit all > groups to specified resource.plz tell me the method and give me if > possible. > > V K SONI > KIIT, BHUBNESWAR > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Gridsim-users mailing list > Gri...@li... > https://lists.sourceforge.net/lists/listinfo/gridsim-users > -- Marcos DIAS DE ASSUNCAO - Postdoctoral researcher INRIA RESO - LIP Bureau 337, Ecole Normale Superieure 46, allee d'Italie - 69364 - Lyon Cedex 07 - France Phone: +33 4 72 72 82 28 |