@terascope/job-components / execution-context/worker / WorkerExecutionContext
Class: WorkerExecutionContext
Defined in: packages/job-components/src/execution-context/worker.ts:20
WorkerExecutionContext is designed to add more functionality to interface with the Execution Configuration and any Operation.
Extends
Implements
Constructors
new WorkerExecutionContext()
new WorkerExecutionContext(
config
):WorkerExecutionContext
Defined in: packages/job-components/src/execution-context/worker.ts:33
Parameters
Parameter | Type |
---|---|
config | ExecutionContextConfig |
Returns
Overrides
Properties
Accessors
api
Get Signature
get api():
ExecutionContextAPI
Defined in: packages/job-components/src/execution-context/base.ts:130
Returns
Inherited from
apis
Get Signature
get apis():
JobAPIInstances
Defined in: packages/job-components/src/execution-context/worker.ts:171
Returns
jobObserver
Get Signature
get jobObserver():
default
Defined in: packages/job-components/src/execution-context/worker.ts:175
Returns
processingSlice
Get Signature
get processingSlice():
boolean
Defined in: packages/job-components/src/execution-context/worker.ts:271
Returns
boolean
Methods
_resetMethodRegistry()
protected
_resetMethodRegistry():void
Defined in: packages/job-components/src/execution-context/base.ts:182
Returns
void
Inherited from
_runMethod()
protected
_runMethod(method
, ...args
):void
Defined in: packages/job-components/src/execution-context/base.ts:168
Run an method
Parameters
Parameter | Type |
---|---|
method | keyof WorkerOperationLifeCycle |
...args | any [] |
Returns
void
Inherited from
_runMethodAsync()
protected
_runMethodAsync(method
, ...args
):Promise
<any
[]>
Defined in: packages/job-components/src/execution-context/base.ts:150
Run an async method on the operation lifecycle
Parameters
Parameter | Type |
---|---|
method | keyof WorkerOperationLifeCycle |
...args | any [] |
Returns
Promise
<any
[]>
Inherited from
addOperation()
protected
addOperation(op
):void
Defined in: packages/job-components/src/execution-context/base.ts:143
Add an operation to the lifecycle queue
Parameters
Parameter | Type |
---|---|
op | WorkerOperationLifeCycle |
Returns
void
Inherited from
fetcher()
fetcher<
T
>():T
Defined in: packages/job-components/src/execution-context/worker.ts:167
The instance of a "Fetcher"
Type Parameters
Type Parameter | Default type |
---|---|
T extends default <OpConfig > | default <OpConfig > |
Returns
T
flush()
flush():
Promise
<undefined
|RunSliceResult
>
Defined in: packages/job-components/src/execution-context/worker.ts:220
Returns
Promise
<undefined
| RunSliceResult
>
getOperation()
getOperation<
T
>(findBy
):T
Defined in: packages/job-components/src/execution-context/worker.ts:144
Get a operation by name or index. If name is used it will return the first match.
Type Parameters
Type Parameter | Default type |
---|---|
T extends default <OpConfig > | default <OpConfig > |
Parameters
Parameter | Type |
---|---|
findBy | string | number |
Returns
T
getOperations()
getOperations():
WorkerOperationLifeCycle
[]
Defined in: packages/job-components/src/execution-context/base.ts:138
Returns a list of any registered Operation that has been initialized.
Returns
Inherited from
initialize()
initialize():
Promise
<void
>
Defined in: packages/job-components/src/execution-context/worker.ts:127
Called to initialize all of the registered operations
Returns
Promise
<void
>
Implementation of
WorkerOperationLifeCycle
.initialize
Overrides
initializeSlice()
initializeSlice(
slice
):Promise
<void
>
Defined in: packages/job-components/src/execution-context/worker.ts:181
Parameters
Parameter | Type |
---|---|
slice | Slice |
Returns
Promise
<void
>
onFlushEnd()
onFlushEnd():
Promise
<void
>
Defined in: packages/job-components/src/execution-context/worker.ts:282
Called to notify the processors that the slice is finished being flushed (shutdown will likely be called immediately afterwards)
Returns
Promise
<void
>
Implementation of
WorkerOperationLifeCycle
.onFlushEnd
onFlushStart()
onFlushStart():
Promise
<void
>
Defined in: packages/job-components/src/execution-context/worker.ts:276
Called to notify the processors that the next slice being passed through will be an empty slice used to flush any additional in-memory state.
Returns
Promise
<void
>
Implementation of
WorkerOperationLifeCycle
.onFlushStart
onSliceFailed()
onSliceFailed():
Promise
<void
>
Defined in: packages/job-components/src/execution-context/worker.ts:307
Called after the slice has been marked as "Failed"
Returns
Promise
<void
>
Implementation of
WorkerOperationLifeCycle
.onSliceFailed
onSliceFinalizing()
onSliceFinalizing():
Promise
<void
>
Defined in: packages/job-components/src/execution-context/worker.ts:297
Called after a slice is done with the last operation in the execution
Returns
Promise
<void
>
Implementation of
WorkerOperationLifeCycle
.onSliceFinalizing
onSliceFinished()
onSliceFinished():
Promise
<void
>
Defined in: packages/job-components/src/execution-context/worker.ts:302
Called after the slice has been acknowledged by the "Execution Controller"
Returns
Promise
<void
>
Implementation of
WorkerOperationLifeCycle
.onSliceFinished
onSliceInitialized()
onSliceInitialized():
Promise
<void
>
Defined in: packages/job-components/src/execution-context/worker.ts:287
Called after a slice is initializated, but before the slice has been handed to any operation.
Returns
Promise
<void
>
Implementation of
WorkerOperationLifeCycle
.onSliceInitialized
onSliceRetry()
onSliceRetry():
Promise
<void
>
Defined in: packages/job-components/src/execution-context/worker.ts:313
Called after the operation failed to process the slice but before the slice is retried.
NOTE: A retry can be stopped by throw an error inside this function
Returns
Promise
<void
>
Implementation of
WorkerOperationLifeCycle
.onSliceRetry
onSliceStarted()
onSliceStarted():
Promise
<void
>
Defined in: packages/job-components/src/execution-context/worker.ts:292
Called after a the slice is sent to the "Fetcher"
Returns
Promise
<void
>
Implementation of
WorkerOperationLifeCycle
.onSliceStarted
runSlice()
runSlice(
slice
?):Promise
<RunSliceResult
>
Defined in: packages/job-components/src/execution-context/worker.ts:202
Run a slice against the fetcher and then processors.
Parameters
Parameter | Type |
---|---|
slice ? | Slice |
Returns
Promise
<RunSliceResult
>
Todo
this should handle slice retries.
shutdown()
shutdown():
Promise
<void
>
Defined in: packages/job-components/src/execution-context/worker.ts:132
Called to cleanup all of the registered operations
Returns
Promise
<void
>
Implementation of
WorkerOperationLifeCycle
.shutdown
Overrides
createContext()
static
createContext(config
):Promise
<WorkerExecutionContext
>
Defined in: packages/job-components/src/execution-context/worker.ts:51
Parameters
Parameter | Type |
---|---|
config | ExecutionContextConfig |
Returns
Promise
<WorkerExecutionContext
>