Skip to main content

@terascope/job-components / operations/core/slicer-core / default

Class: abstract default<T>

Defined in: packages/job-components/src/operations/core/slicer-core.ts:21

A base class for supporting "Slicers" that run on a "Execution Controller", that supports the execution lifecycle events. This class will likely not be used externally since Teraslice only supports a few type varients.

See [[Core]] for more information

Extends

Extended by

Type Parameters

Type ParameterDefault type
TOpConfig

Implements

Constructors

new default()

new default<T>(context, opConfig, executionConfig): default<T>

Defined in: packages/job-components/src/operations/core/slicer-core.ts:30

Parameters

ParameterType
contextContext
opConfigOpConfig & T
executionConfigExecutionConfig

Returns

default<T>

Overrides

default.constructor

Properties

PropertyModifierTypeInherited fromDefined in
contextreadonlyReadonly<Context>default.contextpackages/job-components/src/operations/core/core.ts:10
eventsreadonlyEventEmitterdefault.eventspackages/job-components/src/operations/core/core.ts:13
executionConfigreadonlyReadonly<ExecutionConfig>default.executionConfigpackages/job-components/src/operations/core/core.ts:11
loggerreadonlyLoggerdefault.loggerpackages/job-components/src/operations/core/core.ts:12
opConfigreadonlyReadonly<OpConfig & T>-packages/job-components/src/operations/core/slicer-core.ts:27
recoveryDataprotectedSlicerRecoveryData[]-packages/job-components/src/operations/core/slicer-core.ts:26
statsprotectedExecutionStats-packages/job-components/src/operations/core/slicer-core.ts:25

Accessors

workersConnected

Get Signature

get protected workersConnected(): number

Defined in: packages/job-components/src/operations/core/slicer-core.ts:176

Returns

number

Methods

canComplete()

protected canComplete(): boolean

Defined in: packages/job-components/src/operations/core/slicer-core.ts:172

Returns

boolean


createAPI()

createAPI<A>(name, ...params): Promise<A>

Defined in: packages/job-components/src/operations/core/slicer-core.ts:67

Create an API and add it to the operation lifecycle

Type Parameters

Type ParameterDefault type
A extends OpAPIOpAPI

Parameters

ParameterType
namestring
...paramsany[]

Returns

Promise<A>


createSlice()

createSlice(input, order, id): void

Defined in: packages/job-components/src/operations/core/slicer-core.ts:95

Create a Slice object from a slice request. In the case of recovery the "Slice" already has the required This will be enqueued and dequeued by the "Execution Controller"

Parameters

ParameterTypeDefault value
inputSliceRequest | Sliceundefined
ordernumberundefined
idnumber0

Returns

void


getAPI()

getAPI<A>(name): A

Defined in: packages/job-components/src/operations/core/slicer-core.ts:74

Get a reference to an existing API

Type Parameters

Type ParameterDefault type
A extends OpAPIOpAPI

Parameters

ParameterType
namestring

Returns

A


getSlice()

getSlice(): null | Slice

Defined in: packages/job-components/src/operations/core/slicer-core.ts:112

A method called by the "Execution Controller" to dequeue a created "Slice"

Returns

null | Slice


getSlices()

getSlices(max): Slice[]

Defined in: packages/job-components/src/operations/core/slicer-core.ts:121

A method called by the "Execution Controller" to dequeue many created slices

Parameters

ParameterType
maxnumber

Returns

Slice[]


handle()

abstract handle(): Promise<boolean>

Defined in: packages/job-components/src/operations/core/slicer-core.ts:83

A generic method called by the Teraslice framework to a give a "Slicer" the ability to handle creating slices.

Returns

Promise<boolean>

a boolean depending on whether the slicer is done


initialize()

initialize(recoveryData): Promise<void>

Defined in: packages/job-components/src/operations/core/slicer-core.ts:55

Called during execution initialization

Parameters

ParameterTypeDescription
recoveryDataSlicerRecoveryData[]is the data to recover from

Returns

Promise<void>

Implementation of

SlicerOperationLifeCycle.initialize

Overrides

default.initialize


isRecoverable()

isRecoverable(): boolean

Defined in: packages/job-components/src/operations/core/slicer-core.ts:146

Used to indicate whether this slicer is recoverable.

Returns

boolean


isRelocatable()

isRelocatable(): boolean

Defined in: packages/job-components/src/operations/core/slicer-core.ts:154

Used to indicate whether this slicer is relocatable. Only relevant for kubernetesV2 backend

Returns

boolean


maxQueueLength()

maxQueueLength(): number

Defined in: packages/job-components/src/operations/core/slicer-core.ts:164

Used to determine the maximum number of slices queued. Defaults to 10000 NOTE: if you want to base of the number of workers use #workersConnected

Returns

number


onExecutionStats()

onExecutionStats(stats): void

Defined in: packages/job-components/src/operations/core/slicer-core.ts:168

A method called by the "Execution Controller" to give a "Slicer" the opportunity to track various slicer satistics

Parameters

ParameterType
statsExecutionStats

Returns

void

Implementation of

SlicerOperationLifeCycle.onExecutionStats


shutdown()

shutdown(): Promise<void>

Defined in: packages/job-components/src/operations/core/slicer-core.ts:60

Called during execution shutdown, when this is cleanup any open connections or destroy any in-memory state.

Returns

Promise<void>

Implementation of

SlicerOperationLifeCycle.shutdown

Overrides

default.shutdown


sliceCount()

sliceCount(): number

Defined in: packages/job-components/src/operations/core/slicer-core.ts:139

The number of enqueued slices

Returns

number


slicers()

abstract slicers(): number

Defined in: packages/job-components/src/operations/core/slicer-core.ts:88

Return the number of registered slicers

Returns

number