The Manager job history page (Cloud Manager > Jobs > History Jobs) of Gurobi Instant Cloud is limited to the latest 2000 jobs within the last three months. The filter that shows jobs according to a specified time range is applied to the 2000 most recent jobs. Hence, it is currently not possible to see or filter for jobs that were not among the latest 2000 jobs in the Cloud Manager UI.
However, it is possible to filter for jobs using the Gurobi Instant Cloud REST API. There is an endpoint named /history/jobs/ that can be used to return the list of jobs from the history, see https://cloud.gurobi.com/swagger.html#/Jobs/get_history_jobs.
There are several query parameters to filter the returned list. For example, you can specify the machineId and a date range with from and to parameters.
The Python script below is an example of how to retrieve the job information for jobs with a date range from 2024-01-08 to 2024-01-10.
import json
import requests
response = requests.get(
"https://cloud.gurobi.com/api/v2/history/jobs",
params={"start": 0, "length": 2000, "from": "2024-01-08", "to": "2024-01-10"},
headers={
"Content-Type": "application/json",
"Accept": "application/json",
"X-GUROBI-ACCESS-ID":<CLOUDACCESSID>
,
"X-GUROBI-SECRET-KEY":<CLOUDKEY>,
},
)
job_list = json.loads(response.content)
with open("joblist.json", "w") as f:
json.dump(job_list, f)
The length of the list of jobs is restricted by the length parameter. The maximum value for the length parameter is 2000 jobs. If there are more jobs matching the filter, you can query all the jobs as follows. In addition to /history/jobs/ endpoint has the query parameter start. You can start with "start": 0, "length": 2000 as in the code snippet above. If the length of the retrieved results is 2000, you can then continue querying the next 2000 results by having "start": 2000, "length": 2000. The start parameter value should be incremented by the length parameter value until the length of the retrieved results is less than 2000.
Note that the job history is only kept for the last three months (see the REST API documentation).
Comments
0 comments
Article is closed for comments.