User Tools


Client - Get Awaiting Jobs

Back to JEA API docs


When the exploration process of a project is running, JEA will generate a set of candidate solutions during each iteration (“generation”). The client program is responsible for evaluating the solutions, usually by applying the parameter values to simulation cases and running the simulations, and submitting the results back to JEA. This process involves two operations: getting the cases (“jobs”) that are awaiting evaluation, and submitting the results once simulations are done.

The Get Awaiting Jobs operation retrieves the pending cases from JEA. A valid JWT token must be included in the header, or the transaction will be rejected with an HTTP 401 Unauthorized error code.

Synopsis

Simulation Jobs

An example of the simulation jobs object is shown below. It has an eventType field with the value Request. The projectName field is used to identify the project of which the simulation cases belong. This is useful for multiple on-going optimisation projects. The name field is for identify this particular submission (batch) within the project. It is important to keep the same project ID and the batch name in the corresponding Submit Results object.

The jobSet entry is a map between the case IDs and the variable-value maps.

{
  "eventType": "Request",
  "name": "Gen-11",
  "projectName": "circle",
  "jobSet": {
    "C-26_27": {
      "x": 2.6,
      "y": 2.7
    },
    "C-3_5": {
      "x": 0.3,
      "y": 0.5
    },
    "C-16_17": {
      "x": 1.6,
      "y": 1.7
    },
    "C-31_0": {
      "x": 3.1,
      "y": 0
    }
  }
}

Example using curl://

To send the Project Data command using curl:

curl -H "Authorization:Bearer eyJraWQiOiIxNT...9gjFXUrpQ"  http://jea.ensims.com/jea_web/api/jobs/circle

On successful operation, a Simulation Jobs object is returned. If the existing JWT is invalid, an HTTP 401 Unauthorized code will be returned.

Example using Python Requests

Make sure Requests is correctly installed in your Python environment, and run the following the lines:

import requests

jwt = 'eyJraWQiOiIxNTAy...yBqDDTkfjmsQons9gjFXUrpQ'
headers = {'Authorization': 'Bearer ' + jwt}
body = {}

# Get the awaiting cases of the 'circle' project 
r = requests.get('http://jea.ensims.com/jea_web/api/jobs/circle', headers=headers, json=body)
  
r.json()


Site Tools