@terascope/job-components / execution-context/worker / WorkerExecutionContext
Class: WorkerExecutionContext
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
Parameters
Parameter | Type |
---|---|
config | ExecutionContextConfig |
Returns
Overrides
Source
packages/job-components/src/execution-context/worker.ts:33
Properties
_loader
protected
readonly
_loader:OperationLoader
Inherited from
Source
packages/job-components/src/execution-context/base.ts:30
_methodRegistry
protected
_methodRegistry:Map
<keyofWorkerOperationLifeCycle
,Set
<number
>>
Inherited from
Source
packages/job-components/src/execution-context/base.ts:32
_operations
protected
readonly
_operations:Set
<WorkerOperationLifeCycle
>
Inherited from
Source
packages/job-components/src/execution-context/base.ts:31
assetIds
readonly
assetIds:string
[] =[]
Inherited from
Source
packages/job-components/src/execution-context/base.ts:20
config
readonly
config:ExecutionConfig
Inherited from
Source
packages/job-components/src/execution-context/base.ts:17
context
readonly
context:Context
Inherited from
Source
packages/job-components/src/execution-context/base.ts:18
events
readonly
events:EventEmitter
<DefaultEventMap
>
The terafoundation EventEmitter
Inherited from
Source
packages/job-components/src/execution-context/base.ts:26
exId
readonly
exId:string
Inherited from
Source
packages/job-components/src/execution-context/base.ts:22
jobId
readonly
jobId:string
Inherited from
Source
packages/job-components/src/execution-context/base.ts:23
logger
readonly
logger:Logger
Inherited from
Source
packages/job-components/src/execution-context/base.ts:28
processors
Source
packages/job-components/src/execution-context/worker.ts:24
sliceState
sliceState:
undefined
|WorkerSliceState
the active (or last) run slice
Source
packages/job-components/src/execution-context/worker.ts:27
status
status:
WorkerStatus
='initializing'
Source
packages/job-components/src/execution-context/worker.ts:28
Accessors
api
get
api():ExecutionContextAPI
Returns
Source
packages/job-components/src/execution-context/base.ts:130
apis
get
apis():JobAPIInstances
Returns
Source
packages/job-components/src/execution-context/worker.ts:171
jobObserver
get
jobObserver():default
Returns
Source
packages/job-components/src/execution-context/worker.ts:175
processingSlice
get
processingSlice():boolean
Returns
boolean
Source
packages/job-components/src/execution-context/worker.ts:271
Methods
_resetMethodRegistry()
protected
_resetMethodRegistry():void
Returns
void
Inherited from
Source
packages/job-components/src/execution-context/base.ts:182
_runMethod()
protected
_runMethod(method
, ...args
):void
Run an method
Parameters
Parameter | Type |
---|---|
method | keyof WorkerOperationLifeCycle |
...args | any [] |
Returns
void
Inherited from
Source
packages/job-components/src/execution-context/base.ts:168
_runMethodAsync()
protected
_runMethodAsync(method
, ...args
):Promise
<any
[]>
Run an async method on the operation lifecycle
Parameters
Parameter | Type |
---|---|
method | keyof WorkerOperationLifeCycle |
...args | any [] |
Returns
Promise
<any
[]>
Inherited from
Source
packages/job-components/src/execution-context/base.ts:150
addOperation()
protected
addOperation(op
):void
Add an operation to the lifecycle queue
Parameters
Parameter | Type |
---|---|
op | WorkerOperationLifeCycle |
Returns
void
Inherited from
Source
packages/job-components/src/execution-context/base.ts:143
fetcher()
fetcher<
T
>():T
The instance of a "Fetcher"
Type parameters
Type parameter | Value |
---|---|
T extends default <OpConfig > | default <OpConfig > |
Returns
T
Source
packages/job-components/src/execution-context/worker.ts:167
flush()
flush():
Promise
<undefined
|RunSliceResult
>
Returns
Promise
<undefined
| RunSliceResult
>
Source
packages/job-components/src/execution-context/worker.ts:220
getOperation()
getOperation<
T
>(findBy
):T
Get a operation by name or index. If name is used it will return the first match.
Type parameters
Type parameter | Value |
---|---|
T extends default <OpConfig > | default <OpConfig > |
Parameters
Parameter | Type |
---|---|
findBy | string | number |
Returns
T
Source
packages/job-components/src/execution-context/worker.ts:144
getOperations()
getOperations():
WorkerOperationLifeCycle
[]
Returns a list of any registered Operation that has been initialized.
Returns
Inherited from
Source
packages/job-components/src/execution-context/base.ts:138
initialize()
initialize():
Promise
<void
>
Called during execution initialization, when this is called perform any async setup.
Returns
Promise
<void
>
Implementation of
WorkerOperationLifeCycle
.initialize
Overrides
Source
packages/job-components/src/execution-context/worker.ts:127
initializeSlice()
initializeSlice(
slice
):Promise
<void
>
Parameters
Parameter | Type |
---|---|
slice | Slice |
Returns
Promise
<void
>
Source
packages/job-components/src/execution-context/worker.ts:181
onFlushEnd()
onFlushEnd():
Promise
<void
>
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
Source
packages/job-components/src/execution-context/worker.ts:282
onFlushStart()
onFlushStart():
Promise
<void
>
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
Source
packages/job-components/src/execution-context/worker.ts:276
onSliceFailed()
onSliceFailed():
Promise
<void
>
Called after the slice has been marked as "Failed"
Returns
Promise
<void
>
Implementation of
WorkerOperationLifeCycle
.onSliceFailed
Source
packages/job-components/src/execution-context/worker.ts:307
onSliceFinalizing()
onSliceFinalizing():
Promise
<void
>
Called after a slice is done with the last operation in the execution
Returns
Promise
<void
>
Implementation of
WorkerOperationLifeCycle
.onSliceFinalizing
Source
packages/job-components/src/execution-context/worker.ts:297
onSliceFinished()
onSliceFinished():
Promise
<void
>
Called after the slice has been acknowledged by the "Execution Controller"
Returns
Promise
<void
>
Implementation of
WorkerOperationLifeCycle
.onSliceFinished
Source
packages/job-components/src/execution-context/worker.ts:302
onSliceInitialized()
onSliceInitialized():
Promise
<void
>
Called after a slice is initializated, but before the slice has been handed to any operation.
Returns
Promise
<void
>
Implementation of
WorkerOperationLifeCycle
.onSliceInitialized
Source
packages/job-components/src/execution-context/worker.ts:287
onSliceRetry()
onSliceRetry():
Promise
<void
>
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
Source
packages/job-components/src/execution-context/worker.ts:313
onSliceStarted()
onSliceStarted():
Promise
<void
>
Called after a the slice is sent to the "Fetcher"
Returns
Promise
<void
>
Implementation of
WorkerOperationLifeCycle
.onSliceStarted
Source
packages/job-components/src/execution-context/worker.ts:292
runSlice()
runSlice(
slice
?):Promise
<RunSliceResult
>
Run a slice against the fetcher and then processors.
Parameters
Parameter | Type |
---|---|
slice ? | Slice |
Returns
Promise
<RunSliceResult
>
Todo
this should handle slice retries.
Source
packages/job-components/src/execution-context/worker.ts:202
shutdown()
shutdown():
Promise
<void
>
Called during execution shutdown, when this is cleanup any open connections or destroy any in-memory state.
Returns
Promise
<void
>
Implementation of
WorkerOperationLifeCycle
.shutdown
Overrides
Source
packages/job-components/src/execution-context/worker.ts:132
createContext()
static
createContext(config
):Promise
<WorkerExecutionContext
>
Parameters
Parameter | Type |
---|---|
config | ExecutionContextConfig |
Returns
Promise
<WorkerExecutionContext
>