Using the C# API for AIMMS, how can I retrieve a job using a sessionID?

  • 4 January 2022
  • 3 replies
  • 35 views

Userlevel 1
Badge

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.

 

EDIT:

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.


3 replies

Userlevel 5
Badge +5

@LowBjorn I’m not sure if the PRO API can interact with a job that was not created through the PRO API.

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).

Userlevel 1
Badge

@mohansx Maybe my question is unclear. I will edit my original post.

Userlevel 5
Badge +5

For your first question, there is a Job.Status method/property for the job object. Does that not work ?

Reply


Didn't find what you were looking for? Try searching on our documentation pages:

AIMMS Developer & PRO | AIMMS How-To | AIMMS SC Navigator