From: ye h. <hua...@gm...> - 2009-01-18 23:36:09
|
Hi, I fix the problem by appending a small delay on the new arrival external gridlet, as: super.send(resourceId, 0.0, GridSimTags.GRIDLET_SUBMIT, job); However, I find another confusing "bug", it's about the way of receiving gridlet sent back from resources. Here i am going to explain it using a demo from GridSim's official example file: Example 04: Starting from line 109 of Example 04, submitting and receiving gridlets are finished in one loop as follows: --- code snippet 1 --- for (int i = 0; i < this.list_.size(); i++) { gridlet = (Gridlet) this.list_.get(i); info = "Gridlet_" + gridlet.getGridletID(); super.gridletSubmit(gridlet, resourceID); gridlet = super.gridletReceive(); this.receiveList_.add(gridlet); } In my scenario, in order the decouple the behavior, I split the procedure into two parts as follows: --- code snippet 2 --- // part 1: submit gridlet for (int i = 0; i < this.list_.size(); i++) { gridlet = (Gridlet) this.list_.get(i); info = "Gridlet_" + gridlet.getGridletID(); super.send(resourceID, GridSimTags.SCHEDULE_NOW, GridSimTags.GRIDLET_SUBMIT, gridlet); } // part 2: receive gridlet from gridresource Sim_event ev = new Sim_event(); while (Sim_system.running()) { super.sim_get_next(ev); if (ev.get_tag() == GridSimTags.GRIDLET_RETURN){ gridlet = (Gridlet) ev.get_data(); // stores the received Gridlet into a new GridletList object this.receiveList_.add(gridlet); } } // part 3, print the received gridlet list printGridletList(this.receiveList_); --- Then, during the execution, I got the prompted warning : Resource_0: Warning - Gridlet #2 owned by Example4 is already completed/finished. The more gridlets were submitted, the more warning will be prompted. I have to say, it seems there is no mistake caused by this warning. But to understand the infrastructure better, is there anyone could help me about why it appears and how to avoid it? Thanks again! Regards ye On 18 Jan, 2009, at 8:06 PM, ye huang wrote: > Hi, all: > I am trying to submit some jobs during the LOOP of GridSim class's > while (Sim_system.running()) loop. > Here is my scenario: > > Firstly, I comment method interruptedEventFromOutside() to stop > external interruptions. > In body(), I prepare some jobs by localJobSubmit(), with different > start time. The result of job execution is retrieved during the loop > of "while (Sim_system.running())", > which works fine! > > Additional, I uncomment interruptedEventFromOutside() to accept > addtional jobs during the loop: Sim_system.running(), as soon as new > job arrives, i submit the job to > corresponding local resource. > > Now, my problem is, I notified once external gridlets arrive, part > of jobs submitted from localJobSubmit() won't be submitted to > resource(or return from resource?) > I wanner know, whether it's possible to submit addtional jobs during > the loop of body().while (Sim_system.running())? I mean, there > should be no difference accroding the gridlets > themselves, right? > Could the gridlets submit from localJobSubmit() and > interruptedEventFromOutside() have the same jobId? > Or anything else should be paid with attention? > > Thanks a lot! > Regards > ye > > --- scenario snippet --- > body() { > > this.localJobSubmit(); > > while (Sim_system.running()) { > super.sim_get_next(ev); > > if (ev.get_tag() == GridSimTags.GRIDLET_RETURN){ > this.processJobReturnedFromResource(ev.get_data()); > continue; > } > > // process other event tags > } > > } > > private void localJobSubmit() { > // prepare some jobs > for(Gridlet job : knownGridletList) { > // some process here to get a candidate local resource id > super.send(resourceId, job.getDelay(), GridSimTags.GRIDLET_SUBMIT, > job); > } > } > > public void interruptedEventFromOutside(Gridlet job) { > // some process here to get a candidate local resource id > super.send(resourceId, 0.0, GridSimTags.GRIDLET_SUBMIT, job); > } > > > > > > |