How can I wait for an external started job with DRMAA?

125 Views Asked by At

I want to wait for a job to finish which has been submitted externally.

My first idea was to get the jobID by calling qstat and then executing session.wait(jobID, Session.TIMEOUT_WAIT_FOREVER);. But this doesn't work. Are there any other ideas except calling qstat until the job isn't listed anymore?

1

There are 1 best solutions below

1
On

Can you explain exactly what doesn't work about session.wait(jobId, Session.TIMEOUT_WAIT_FOREVER)? That would also be my inclination and allows you to retrieve the job's return code.

There's something here that might be relevant; it suggests using synchronize instead of wait:

session.synchronize(Collections.singletonList(jobId),
                       Session.TIMEOUT_WAIT_FOREVER, false); 
int status = session.getJobProgramStatus(jobId);

Otherwise, I'd you could add something to the job to record / signal its completion?