Interface: TaskSpecificOptions
executor.TaskSpecificOptions
Table of contents
Properties
Properties
maxParallelTasks
• Optional
maxParallelTasks: number
Number of maximum parallel running task on one TaskExecutor instance. Default is 5
Defined in
taskTimeout
• Optional
taskTimeout: number
Timeout for execute one task in ms. Default is 300_000 (5 minutes).
Defined in
maxTaskRetries
• Optional
maxTaskRetries: number
The maximum number of retries when the job failed on the provider
Defined in
taskStartupTimeout
• Optional
taskStartupTimeout: number
Timeout for waiting for signing an agreement with an available provider from the moment the task initiated. This parameter is expressed in ms. If it is not possible to sign an agreement within the specified time, the task will stop with an error and will be queued to be retried if the maxTaskRetries
parameter > 0
Defined in
taskRetryOnTimeout
• Optional
taskRetryOnTimeout: boolean
Set to false by default. If enabled, timeouts will be retried in case of timeout errors.
Defined in
setup
• Optional
setup: LifecycleFunction
A setup function that will be run when an exe-unit is ready. This is the perfect place to run setup function that need to be run only once per exe-unit, for example uploading files that will be used by all tasks in the exe-unit.
Example
const uploadFile = async (exe) => exe.uploadFile("./file1.txt", "/file1.txt");
const executor = await TaskExecutor.create({
demand: {
workload: {
imageTag: "golem/alpine:latest",
},
},
task: {
setup: uploadFile,
}
});
Defined in
teardown
• Optional
teardown: LifecycleFunction
A teardown function that will be run before the exe unit is destroyed. This is the perfect place to run teardown function that need to be run only once per exe-unit at the end of the entire work, for example cleaning of the working environment.
Example
const removeFile = async (exe) => exe.run("rm ./file.txt");
const executor = await TaskExecutor.create({
demand: {
workload: {
imageTag: "golem/alpine:latest",
},
},
task: {
teardown: removeFile,
}
});
Defined in
Was this helpful?