[GE users] Java DRMAA Job listeners?

templedf dan.templeton at sun.com
Mon Nov 9 22:11:49 GMT 2009


Yes, it will block in a loop... until a job exits.  Then it will wake up 
and deal with the job.

while (true) {
    JobInfo ji = session.wait(Session.JOB_IDS_SESSION_ANY, 
Session.TIMEOUT_WAIT_FOREVER);
    System.out.println(ji.getJobId() + " just exited");
    sendEvent(ji);
}

If you do that in a separate thread, you only need one thread to deal 
with all your jobs.

Daniel

fansn wrote:
> Hi Daniel,
>
> I think this call session.wait(Session.JOB_IDS_SESSION_ANY,
> Session.TIMEOUT_WAIT_FOREVER)
> will be blocked in the loop. Array jobs might be a good solution. 
>
> Yours sincerely,
>
> Sinong 
>
> -----Original Message-----
> From: Dan.Templeton at Sun.COM [mailto:Dan.Templeton at Sun.COM] 
> Sent: 09 November 2009 05:47
> To: users at gridengine.sunsource.net
> Subject: Re: [GE users] Java DRMAA Job listeners?
>
> It would be helpful to know more about the problem you're trying to 
> solve.  There shouldn't be any need to maintain a thread per job.  At 
> the very worst, you can set up a single additional thread that does a 
> session.wait(Session.JOB_IDS_SESSION_ANY, Session.TIMEOUT_WAIT_FOREVER) 
> in a loop and sends an event when a job finishes.
>
> Daniel
>
> umanga wrote:
>   
>> Thanks Sinong,
>>
>> I was worried about the limit of threads.I suppose using a thread-pool 
>> will solve the issue.
>>
>> regards
>> umanga
>> fansn wrote:
>>   
>>     
>>> Hi Umanga,
>>>
>>> I use a separate thread to monitor the job, as this call is blocked if
>>>       
> you
>   
>>> use TIMEOUT_WAIT_FOREVER. I prefer using perl DRMAA as it's easy to
>>>       
> maintain
>   
>>> and uses less resource. 
>>>
>>> Yours sincerely,
>>>
>>>
>>> Sinong
>>>
>>> -----Original Message-----
>>> From: umanga [mailto:aumanga at biggjapan.com] 
>>> Sent: 05 November 2009 07:33
>>> To: users at gridengine.sunsource.net
>>> Subject: [GE users] Java DRMAA Job listeners?
>>>
>>> Greetings all,
>>>
>>> I am submitting several jobs using Java DRMAA and wait till all of that 
>>> jobs finish using :
>>>
>>>
>>>       
> session.synchronize(Collections.singletonList(Session.JOB_IDS_SESSION_ALL),
>   
>>> Session.TIMEOUT_WAIT_FOREVER,true);
>>>
>>> Is there a way (like listeners ) which I can detect Job events like 
>>> finished() terminated() ..etc ?
>>>
>>> Or can I submit each Job in a separate Thread and wait till that job to 
>>> finish and use "JobInfo" to collect information about job execution ?
>>> If so , what about the limit for number of Thread?
>>>
>>> Thanks in advance,
>>> umanga
>>>
>>> ------------------------------------------------------
>>>
>>>       
> http://gridengine.sunsource.net/ds/viewMessage.do?dsForumId=38&dsMessageId=2
>   
>>> 25139
>>>
>>> To unsubscribe from this discussion, e-mail:
>>> [users-unsubscribe at gridengine.sunsource.net].
>>>  
>>>
>>> __________ Information from ESET NOD32 Antivirus, version of virus
>>>       
> signature
>   
>>> database 4574 (20091104) __________
>>>
>>> The message was checked by ESET NOD32 Antivirus.
>>>
>>> http://www.eset.com
>>>  
>>>  
>>>
>>> __________ Information from ESET NOD32 Antivirus, version of virus
>>>       
> signature
>   
>>> database 4583 (20091108) __________
>>>
>>> The message was checked by ESET NOD32 Antivirus.
>>>
>>> http://www.eset.com
>>>
>>> ------------------------------------------------------
>>>
>>>       
> http://gridengine.sunsource.net/ds/viewMessage.do?dsForumId=38&dsMessageId=2
> 25625
>   
>>> To unsubscribe from this discussion, e-mail:
>>>       
> [users-unsubscribe at gridengine.sunsource.net].
>   
>>>     
>>>       
>> ------------------------------------------------------
>>
>>     
> http://gridengine.sunsource.net/ds/viewMessage.do?dsForumId=38&dsMessageId=2
> 25755
>   
>> To unsubscribe from this discussion, e-mail:
>>     
> [users-unsubscribe at gridengine.sunsource.net].
>   
>
> ------------------------------------------------------
> http://gridengine.sunsource.net/ds/viewMessage.do?dsForumId=38&dsMessageId=2
> 25767
>
> To unsubscribe from this discussion, e-mail:
> [users-unsubscribe at gridengine.sunsource.net].
>
> ------------------------------------------------------
> http://gridengine.sunsource.net/ds/viewMessage.do?dsForumId=38&dsMessageId=225791
>
> To unsubscribe from this discussion, e-mail: [users-unsubscribe at gridengine.sunsource.net].
>

------------------------------------------------------
http://gridengine.sunsource.net/ds/viewMessage.do?dsForumId=38&dsMessageId=225893

To unsubscribe from this discussion, e-mail: [users-unsubscribe at gridengine.sunsource.net].



More information about the gridengine-users mailing list