EdgeClient.jobs.block_until_complete

Waits until all the results have been processed for a single Job

EdgeClient.jobs.block_until_complete(job_identifier, poll_interval=0.01, timeout=30)

This method blocks the execution until the result of a job is marked as finished or it reaches the timeout seconds (if it is different than None). It refreshes the result information for each poll_interval seconds.

Parameters

ParameterTypeDescriptionExample
job_identifierstr
Job
The Job identifier as a string, or a preloaded Job object'14856eb1-0ad8-49e7-9da3-887acb80fea5'
poll_intervalintTime interval in seconds between polls. Defaults to 0.01.10
timeoutintSeconds amount to wait until timeout. None indicates waiting forever. Defaults to 30.100

Returns

A Result object with the job results

📘

Result structure is different for each job and model

In each job, you define the input keys (i.e. my-input), and in the resulting structure, you need to use the same key to query the specific result. Also, each model can define its own output keys, which allow you to search specifically for the model's result.

{
  "job_identifier": "string",
  "account_identifier": "string",  
  "submitted_by_key": "string",
  "completed": "integer",  
  "failed": "integer",  
  "total": "integer", 
  "finished": "boolean",    
  "explained": "boolean",
  "results": {
    <<<<input-item-key>>>>: {
      "status": "string",
      "engine": "string",
      "start_time": "date-time",
      "update-time": "date-time",
      "end-time": "date-time",
      "elapsed_time": "integer",
      "voting": {
        "up": "integer",
        "down": "integer"
      },
      <<<<data-output-item-key>>>>: <<model-output-value>>
    }
  },
  "team": {
    "identifier": "string"
  },  
  "average_model_latency": "number",
  "total_model_latency": "number"
}

Examples

>>>result = client.jobs.block_until_complete('14856eb1-0ad8-49e7-9da3-887acb80fea5')
>>>result.finished
True
>>>result.results['0001']['results.json']
ApiObject({
  "confidence": "3.2059302",
  "result": "six"
})

Result object also has handy methods to access the results

>>>result = client.jobs.block_until_complete('14856eb1-0ad8-49e7-9da3-887acb80fea5')
>>>result.get_source_outputs('0001')['results.json']
ApiObject({
  "confidence": "3.2059302",
  "result": "six"
})
>>>result.get_first_outputs()['results.json']
ApiObject({
  "confidence": "3.2059302",
  "result": "six"
})