ResultHandle

class ResultHandle()

This class represents an Array-like object that’s a handle on a job’s results.

It’s used to access the job’s results, or to query the scheduler to fetch results. Besides the properties and methods of this class, the following standard array methods are also available for accessing the available results: slice, filter, concat, find, findIndex, indexOf, map, reduce, includes, toString, and forEach. One can access the results by index (results[i]), but the class throws an error if the result for that index isn’t yet available.

Instantiated by Job() methods Job.exec() and Job.localExec().

Attributes

length

ResultHandle.length
Type

number

The length of the array of available results.

Methods

entries

entries()

Returns an array of [input, output] pairs, in the order of the slice numbers. Each input is paired with its associated output produced from the slice it was used in. Return value is undefined if the input is not an ES5 primitive.

Return type

Array<any>

fetch

fetch(rangeObject, emitEvents)

Sends a request to the schedule to fetch the results from the job. The results will be then stored in the ResultHandle() object.

Arguments
  • rangeObject (RangeObject()) – Not implemented, leave as undefined - should be a RangeObject() to query results, however.

  • emitEvents (string()) – If set to ‘all’, emits a results for each result as they’re added to the ResultHandle() object.

key

key(n)

Returns the nth input value in the input set.

Arguments
  • n (number()) – index of the desired input value in the input set.

Return type

any

keys

keys()

Returns an array of all input values that have a completed result available.

Return type

Array<any>

lookupValue

lookupValue(key)

Given an input value as a key from a completed slice, returns its associated result.

Arguments
  • key (any()) – Corresponds to a value in the job’s input set.

Return type

any

values

values()

Results an array of all results received from the scheduler.

Return type

Array<any>