client.results.block_until_complete

Waits until all the results have been processed

client.results.block_until_complete(result, timeout=60, poll_interval=5)

This method blocks the execution until the result 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
resultstr
Result
Job
The Job identifier as a string, or a preloaded Job or Result object'14856eb1-0ad8-49e7-9da3-887acb80fea5'
timeoutintSeconds amount to wait until timeout. None indicates waiting forever. Defaults to 60.100
poll_intervalintTime interval in seconds between polls. Defaults to 5.10

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.results.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.results.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"
})