From: ye h. <hua...@gm...> - 2009-02-16 13:01:41
|
Hi, Marcos: Thanks for help! I am sorry, the "resubmit" should be erased from the demo, so do the following code: --- --- --- if(resubmit) { LinkedList ll = createGridlet( this.ID_.intValue() ); for(int k = 0; k < ll.size(); k++) { this.list_.addLast(ll.get(k)); } resubmit = false; } --- --- --- they are not the point. You are right, the LOOP while should be finished with the following code to exit properly. --- --- --- if(receiveList_.size() == list_.size()) { break; } --- --- --- However, I mean to ignore the code to check the wired print result. If the above loop-exit code is NOT attached, I understand the while() could exit properly, but why I got the following print: --- --- --- ... ... ... exit gridlet submiting loop Sim_system: No more future events Gathering simulation data. ... ... ... to exit gridsim ========== [OUTPUT:] ========== Gridlet ID STATUS Resource ID Cost 0 SUCCESS 5 27.851458885941653 1 SUCCESS 5 39.787798408488065 2 SUCCESS 5 71.61803713527851 2 SUCCESS 5 71.61803713527851 Resource_0: Warning - Gridlet #2 owned by Example041 is already completed/finished. Therefore, it is not being executed again --- --- --- It seems the gridlet #2 is resubmitted again to the GridResource after its status had been changed to "Success". Also, you can see the Sim_system.running() has caught the duplicate returned Gridlet and prints two lines: 2 SUCCESS 5 71.61803713527851 I mean, even the while() loop can't exit properly(keep monitoring incoming events), why there is a duplicate gridlet submit/return message? Regards ye On 16 Feb, 2009, at 1:23 PM, Marcos Dias de Assuncao wrote: > > Hi Ye, > > Please change this part of the code: > > --------------------------------- > if (ev.get_tag() == GridSimTags.GRIDLET_RETURN){ > gridlet = (Gridlet) ev.get_data(); > super.recordStatistics("[ticking]: Received grildet: " + > gridlet.getGridletID() + " from " + > resourceName + "\"", > gridlet.getProcessingCost()); > > // stores the received Gridlet into a new GridletList > object > this.receiveList_.add(gridlet); > } > --------------------------------- > to: > --------------------------------- > if (ev.get_tag() == GridSimTags.GRIDLET_RETURN){ > gridlet = (Gridlet) ev.get_data(); > super.recordStatistics("[ticking]: Received grildet: " + > gridlet.getGridletID() + " from " + > resourceName + "\"", > gridlet.getProcessingCost()); > > // stores the received Gridlet into a new GridletList > object > this.receiveList_.add(gridlet); > > if(receiveList_.size() == list_.size()) { > break; > } > } > --------------------------------- > > Otherwise your simulation will never end and you will get those > errors. Also, I am sorry, but I could not understand what you want > to do in this part of the code: > > ------------------------------- > boolean resubmit = true; > > // a loop to get one Gridlet at one time and sends it to a grid > // resource entity. Then waits for a reply > for (int i = 0; i < this.list_.size(); i++) > { > gridlet = (Gridlet) this.list_.get(i); > info = "Gridlet_" + gridlet.getGridletID(); > > System.out.println("Sending: " + info + " to " + > resourceName + > " with id = " + resourceID); > > // Sends one Gridlet to a grid resource specified in > "resourceID" > // super.gridletSubmit(gridlet, resourceID); > > // OR another approach to send a gridlet to a grid > resource entity > super.send(resourceID, GridSimTags.SCHEDULE_NOW, > GridSimTags.GRIDLET_SUBMIT, gridlet); > > if(resubmit) { > LinkedList ll = createGridlet( this.ID_.intValue() ); > for(int k = 0; k < ll.size(); k++) { > this.list_.addLast(ll.get(k)); > } > > resubmit = false; > } > > ---------------------- > > resubmit will be true initially, which will make "inkedList ll = > createGridlet( this.ID_.intValue() );" create a new list of gridlets > with the same ids of the gridlets that are already in list_. > > Regards, > > Marcos > > > On 16/02/2009, at 7:40 PM, ye wrote: > >> <Example041.java> > > Marcos Dias de Assuncao > Grid Computing and Distributed Systems (GRIDS) Laboratory > Department of Computer Science and Software Engineering > The University of Melbourne, Australia > Email: ma...@cs... > > ------------- > "It is well enough that people of the nation do not understand our > banking and monetary system, for if they did, I believe there would > be a revolution before tomorrow morning." > > Henry Ford > -- Ye Huang, Department of Informatics University of Fribourg / Pérolles 2 - Bld de Pérolles 90 1700 Fribourg, Switzerland e-mail: ye....@he..., ye....@un... http://diuf.unifr.ch/people/huangy/ Office: +41 26 429 65 95 |