Skip to main content

Interface: CompiledWorkerOptions

worker.CompiledWorkerOptions

WorkerOptions where the attributes the Worker requires are required and time units are converted from ms formatted strings to numbers.

Hierarchy#

  • Omit<WorkerOptionsWithDefaults, "serverOptions">

    CompiledWorkerOptions

Properties#

activities#

Optional activities: ActivityInterface

Mapping of activity name to implementation.

Inherited from#

Omit.activities


dataConverter#

dataConverter: DataConverter

TODO: document, figure out how to propagate this to the workflow isolate

Inherited from#

Omit.dataConverter


dependencies#

Optional dependencies: InjectedDependencies<any>

Inherited from#

Omit.dependencies


interceptors#

Optional interceptors: WorkerInterceptors

A mapping of interceptor type to a list of factories or module paths

Inherited from#

Omit.interceptors


isolateExecutionTimeout#

isolateExecutionTimeout: string | number

Time to wait for result when calling a Workflow isolate function.

format ms formatted string or number of milliseconds

default 5s

Inherited from#

Omit.isolateExecutionTimeout


isolateExecutionTimeoutMs#

isolateExecutionTimeoutMs: number


isolatePoolSize#

isolatePoolSize: number

Controls the number of v8 isolates the Worker should create.

New Workflows are created on this pool in a round-robin fashion.

default 8

Inherited from#

Omit.isolatePoolSize


maxCachedWorkflows#

maxCachedWorkflows: number

The number of Workflow isolates to keep in cached in memory

Cached Workflows continue execution from their last stopping point. If the Worker is asked to run an uncached Workflow, it will need to replay the entire Workflow history. Use as a dial for trading memory for CPU time.

You should be able to fit about 500 Workflows per GB of memory dependening on your Workflow bundle size. For the SDK test Workflows, we managed to fit 750 Workflows per GB.

This number is impacted by the the Worker's maxIsolateMemoryMB option.

default max(os.totalmem() / 1GiB - 1, 1) * 200

Inherited from#

Omit.maxCachedWorkflows


maxConcurrentActivityTaskExecutions#

maxConcurrentActivityTaskExecutions: number

Maximum number of Activity tasks to execute concurrently. Adjust this to improve Worker resource consumption.

default 100

Inherited from#

Omit.maxConcurrentActivityTaskExecutions


maxConcurrentActivityTaskPolls#

maxConcurrentActivityTaskPolls: number

Maximum number of concurrent poll Activity task requests to perform at a time. Higher values will result in higher throughput and load on the Worker. If your Worker is overloaded, tasks might start timing out in which case, reduce this value.

default 5

Inherited from#

Omit.maxConcurrentActivityTaskPolls


maxConcurrentWorkflowTaskExecutions#

maxConcurrentWorkflowTaskExecutions: number

Maximum number of Workflow tasks to execute concurrently. Adjust this to improve Worker resource consumption.

default 100

Inherited from#

Omit.maxConcurrentWorkflowTaskExecutions


maxConcurrentWorkflowTaskPolls#

maxConcurrentWorkflowTaskPolls: number

Maximum number of concurrent poll Workflow task requests to perform at a time. Higher values will result in higher throughput and load on the Worker. If your Worker is overloaded, tasks might start timing out in which case, reduce this value.

default 5

Inherited from#

Omit.maxConcurrentWorkflowTaskPolls


maxIsolateMemoryMB#

maxIsolateMemoryMB: number

Memory limit in MB for the Workflow v8 isolate.

If this limit is exceeded the isolate will be disposed and the worker will crash.

default max(os.totalmem() - 1GiB, 1GiB)

Inherited from#

Omit.maxIsolateMemoryMB


nodeModulesPaths#

Optional nodeModulesPaths: string[]

Path for webpack to look up modules in for bundling the Workflow code. Automatically discovered if workflowsPath is provided.

Inherited from#

Omit.nodeModulesPaths


nonStickyToStickyPollRatio#

nonStickyToStickyPollRatio: number

maxConcurrentWorkflowTaskPolls * this number = the number of max pollers that will be allowed for the nonsticky queue when sticky tasks are enabled. If both defaults are used, the sticky queue will allow 4 max pollers while the nonsticky queue will allow one. The minimum for either poller is 1, so if max_concurrent_wft_polls is 1 and sticky queues are enabled, there will be 2 concurrent polls.

default 0.2

Inherited from#

Omit.nonStickyToStickyPollRatio


shutdownGraceTime#

shutdownGraceTime: string | number

Time to wait for pending tasks to drain after shutdown was requested.

format ms formatted string or number of milliseconds

Inherited from#

Omit.shutdownGraceTime


shutdownGraceTimeMs#

shutdownGraceTimeMs: number


shutdownSignals#

shutdownSignals: Signals[]

Automatically shut down worker on any of these signals.

default

['SIGINT', 'SIGTERM', 'SIGQUIT']

Inherited from#

Omit.shutdownSignals


stickyQueueScheduleToStartTimeout#

stickyQueueScheduleToStartTimeout: string

How long a workflow task is allowed to sit on the sticky queue before it is timed out and moved to the non-sticky queue where it may be picked up by any worker.

format ms formatted string

default 10s

Inherited from#

Omit.stickyQueueScheduleToStartTimeout


stickyQueueScheduleToStartTimeoutMs#

stickyQueueScheduleToStartTimeoutMs: number


taskQueue#

taskQueue: string

The task queue the worker will pull from

Inherited from#

Omit.taskQueue


workflowsPath#

Optional workflowsPath: string

Path to look up workflows in, any function exported in this path will be registered as a Workflow in this Worker.

Inherited from#

Omit.workflowsPath