When scheduling a job as per the API example found here, a job object is returned that also contains a sessionID.
Is it possible to store this sessionID in order to later retrieve the status of the scheduled job? i.e. scheduled/running/finished.
To clarify, this is my problem:
- Given: a server object and a (valid) sessionID
- Goal: Create a Job object that I can use to retrieve the Job.Status property
How do I achieve this?
As a side question, but not my main focus, how do I get a list of all scheduled jobs (including finished ones) such as the overview you get when navigating to the ‘jobs page’ in the portal?
Using the Server.getCurrentJobs() method seems to only retrieve unfinished jobs.
For your first question, there is a Job.Status method/property for the job object. Does that not work ?
For your use case, can you check if the given sessionID exists in the return list of server.getCurrentJobs() ? If that sessionID is not in that list, then it would mean that job is either completed (successfully or otherwise).