onJobSubmitted event - chicken-egg situation

Hi,
Came across an intriguing situation in v5.2 with the onJobSubmitted event.
When you submit a job via say cmd line with “deadlinecommand.exe” and you have a onJobSubmitted event in place for this particular type of job. The event gets executed BEFORE the submitted job has a chance to return the Deadline JobID. For me this seemed a bit odd. I submit a job, I want to report back the newly created Deadline jobID & job status to an internal DB here, which this DB serves a webpage which updates the status of the deadline jobs. However, it fails because the onJobSubmitted event gets executed before deadlinecommand returns the JobID and my DB hasn’t yet received what the jobID is, so borks out!
For me this seems the wrong way round…? ie: deadlinecommand.exe should return the jobID after successful submission and then consider any onJobSubmitted event notifications to be executed.
Perhaps I’m missing the point of the onJobSubmitted event?!
Mike

Hey Mike,

You can think of calling deadlinecommand.exe to submit a job like calling a function. Here’s some pseudo code:

def SubmitJob():
    job = SubmitJobToDeadline()
    FireOnJobSubmittedEvent(job)
    return job

myJob = SubmitJob()
print( myJob.JobId )

That’s basically how it works with deadlinecommand.exe. Firing the OnJobSubmitted event is part of the job submission process, and therefore is done before “returning”.

Cheers,

  • Ryan

Understood. I get it now. onJobSubmitted event needs to take place ‘during’ the submission process before the jobID is successfully returned, otherwise what’s the point in having an event that only fires after the submission has taken place and yet call it “onJobSubmitted”! I just wanted to make sure my logic was on the same tracks as you. At the end of the day, if I want to know if a job has been successfully submitted to Deadline, then its trivial to check the stdout for “success” and also the “jobID” that is returned. Cool. Thanks for clarifying. :slight_smile: