Class: ExecutorClient

ExecutorClient(parameters)

new ExecutorClient(parameters)

Client for creating, monitoring, and receiving output executor jobs. This client is used by the Executor Workers and some of the API calls are not meant to be used by "end users".

Parameters:
Name Type Description
parameters object
Properties
Name Type Description
logger object
Source:

Methods

createJob(jobInfo, callbackopt) → {external:Promise}

Creates a new job.

Parameters:
Name Type Attributes Description
jobInfo object

initial information about the job must contain the hash.

Properties
Name Type Description
hash object

a unique id for the job (e.g. the hash of the artifact containing the executor_config.json).

callback function <optional>

if provided no promise will be returned.

Source:
Returns:

On success the promise will be resolved with JobInfo result.
On error the promise will be rejected with Error error.

Type
external:Promise

getInfo(hash, callbackopt) → {external:Promise}

Retrieves the current state of the job in form of a JobInfo

Parameters:
Name Type Attributes Description
hash string

unique id for the job (e.g. the hash of the artifact containing the executor_config.json).

callback function <optional>

if provided no promise will be returned.

Source:
Returns:

On success the promise will be resolved with JobInfo jobInfo.
On error the promise will be rejected with Error error.

Type
external:Promise

getNewExecutorConfig(cmd, argsopt, outputIntervalopt, outputSegmentSizeopt) → {object}

Creates a new configuration object for the job execution.

To make the worker post output either the outputInterval and/or outputSegmentSize must be specified.
- If both are negative (or falsy) no output will be given.
- When both are specified a timeout will be set at start (and after each posted output). If the number of lines exceeds outputSegmentSize during that timeout, the output will be posted and a new timeout will be triggered.
N.B. even though a short outputInterval is set, the worker won't post new output until the responses from previous posts have returned. Before the job returns with a "completed" status code, all queued outputs will be posted (and the responses will be ensured to have returned).

Parameters:
Name Type Attributes Default Description
cmd string

command to execute.

args Array.<string> <optional>

command arguments.

outputInterval number <optional>
-1

max time [ms] between (non-empty) output posts from worker.

outputSegmentSize number <optional>
-1

number of lines before new output is posted from worker. (N.B. posted segments can still contain more number of lines).

Source:
Returns:
Type
object

getOutput(hash, startopt, endopt, callbackopt) → {external:Promise}

Retrieves the output associated with jobHash, to limit the output pass start and/or end. The outputs are identified by 0, 1, 2, ...

Parameters:
Name Type Attributes Description
hash string

hash of job related to output.

start number <optional>

number/id of the output segment to start from (inclusive).

end number <optional>

number/id of segment to end at (exclusive).

callback function <optional>

if provided no promise will be returned.

Source:
Returns:

On success the promise will be resolved with OutputInfo result.
On error the promise will be rejected with Error error.

Type
external:Promise