1

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?

schnarchnase
  • 13
  • 1
  • 8

1 Answers1

0

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?

ᴇʟᴇvᴀтᴇ
  • 12,285
  • 4
  • 43
  • 66
  • 1
    When I call `session.wait(jobId, Session.TIMEOUT_WAIT_FOREVER)` I get the following: `org.ggf.drmaa.InvalidJobException: The job specified by the 'jobid' does not exist.` I also tried `synchronize`, but it doesn't really wait until the job has finished. – schnarchnase Oct 23 '14 at 13:34