From: Marcos D. de A. <mar...@gm...> - 2010-02-15 14:23:12
|
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 -Sha Fatin wrote: > Hi, > > Regarding Vishnu question and Marcos answer, I'm interesting to know > more on those technique. > > As , Marcos said, we need to extent the GridResource class, meaning we > need to extend some > feature in gridletSubmit? Can you briefly give some idea on how to > adjust this event environment? > > Thank you. > > > > > On Mon, Feb 15, 2010 at 6:05 AM, Marcos Dias de Assuncao > <ass...@ac... <mailto:ass...@ac...>> wrote: > > Dear Vishnu Kant Soni, > > In order to send Gridlets to resources, you can utilise the > gridletSubmit() methods implemented in GridSim class. However, they > dispatch one job per method call. If you want to dispatch a set of > gridlets, you should call that method several times, one per job in > the set. Alternatively, you can implement the feature to send a list > of jobs to a Grid resource (i.e. schedule a new simulation event type > for it). But in that case you need to extend the GridResource class to > ensure that it can handle an event whose data contains a list of jobs. > > Regards, > > Marcos > > > On 10 February 2010 13:15, vishnu soni <vis...@gm... > <mailto:vis...@gm...>> wrote: > > hi, > > how i set the different baud_rate for different resources.and > > how i grouped the jobs according to job MI.means i m comparing > the job > > MI to resource MIPS and assign the jobs in a groups ,but how i send > > the goups jobs to the resource.plz explain me sir and give me some > > code for that. > > thanks, > > > > vishnu kant soni > > kiit, bhubneswar,india > > > > > ------------------------------------------------------------------------------ > > SOLARIS 10 is the OS for Data Centers - provides features such > as DTrace, > > Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW > > http://p.sf.net/sfu/solaris-dev2dev > > _______________________________________________ > > Gridsim-users mailing list > > Gri...@li... > <mailto:Gri...@li...> > > https://lists.sourceforge.net/lists/listinfo/gridsim-users > > > > ------------------------------------------------------------------------------ > SOLARIS 10 is the OS for Data Centers - provides features such as > DTrace, > Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW > http://p.sf.net/sfu/solaris-dev2dev > _______________________________________________ > Gridsim-users mailing list > Gri...@li... > <mailto:Gri...@li...> > https://lists.sourceforge.net/lists/listinfo/gridsim-users > > |