Skip to main content

Create Task Definition

Endpoint: POST /api/metadata/taskdefs

Creates a new task definition.

Request body

ParameterDescriptionTypeRequired/Optional
nameA unique name for the task.stringRequired.
descriptionA brief description of the task.stringOptional.
retryCountThe number of retry attempts if the task fails.integerOptional.
retryDelaySecondsThe time (in seconds) to wait before each retry attempt.integerOptional.
backOffScaleFactorThe value multiplied with retryDelaySeconds to determine the interval for retry.integerOptional.
retryLogicThe policy that determines the retry mechanism for the tasks. Supported values:
  • FIXED–Retries after a fixed interval defined by retryDelaySeconds.
  • LINEAR_BACKOFF–Retries occur with a delay that increases linearly based on retryDelaySeconds x backoffScaleFactor x attemptNumber.
  • EXPONENTIAL_BACKOFF–Retries occur with a delay that increases exponentially based on retryDelaySeconds x (backoffScaleFactor ^ attemptNumber).
stringOptional.
rateLimitPerFrequencyThe maximum number of task executions that can be scheduled in a given duration.integerOptional.
rateLimitFrequencyInSecondsThe frequency window (in seconds) for the rate limit.integerOptional.
concurrentExecLimitThe number of task executions that can be executed concurrently.integerOptional.
timeOutSecondsTime (in seconds) for the task to reach a terminal state before it gets marked as TIMED_OUT. No timeout occurs if the value is set to 0.integerRequired.
responseTimeoutSecondsThe maximum duration in seconds that a worker has to respond to the server with a status update before it gets marked as TIMED_OUT.integerOptional.
pollTimeoutSecondsTime (in seconds), after which the task is marked as TIMED_OUT if not polled by a worker. No timeout occurs if the value is set to 0.integerOptional.
timeoutPolicyThe policy for handling timeout. Supported values:
  • RETRY–Retries the task based on the retry configuration.
  • TIME_OUT_WF–The task is marked as TIMED_OUT and is terminated, which also sets the workflow status as TIMED_OUT.
  • ALERT_ONLY–An alert message is logged when the timeout occurs.
To create a task that never times out, set timeoutSeconds and pollTimeoutSeconds to 0.
stringOptional.
totalTimeoutSecondsThe total duration (in seconds) after which the task will be TIMED_OUT, regardless of the retry configuration. Once this duration is reached, no further retries will be attempted.integerRequired.
enforceSchemaWhether to enforce input/output schema validation for all instances of the task. Set to true to enable validation or false to disable.booleanOptional.
inputSchemaThe schema parameters to be used as input schema for the task definition. Learn more about creating and using schemas.objectRequired if enforceSchema is set to true.
outputSchemaThe schema parameters to be used as output schema for the task definition. Learn more about creating and using schemas.objectRequired if enforceSchema is set to true.
inputTemplateThe default template values to be supplied for every instance of the task definition. Learn more about using input templates.objectOptional.
inputKeysKeys representing the expected input for the task.arrayOptional.
outputKeysKeys representing the expected output from the task.arrayOptional.
tagsA key-value map to add tags to the task definition. Each tag consists of a key associated with a corresponding value.objectOptional.
ownerEmailThe email address of the user creating the task definition.stringRequired.

Examples

Create a new task definition

Create a new task definition

Request

curl -X 'POST' \
'https://<YOUR-CLUSTER>/api/metadata/taskdefs' \
-H 'accept: */*' \
-H 'X-Authorization: <TOKEN>' \
-d '{
"name": "sample-api-test",
"description": "Task created using API",
"retryCount": 3,
"timeoutSeconds": 3600,
"timeoutPolicy": "TIME_OUT_WF",
"retryLogic": "FIXED",
"retryDelaySeconds": 60,
"responseTimeoutSeconds": 600,
"rateLimitPerFrequency": 0,
"rateLimitFrequencyInSeconds": 1,
"ownerEmail": "john.doe@acme.com",
"pollTimeoutSeconds": 3600,
"inputKeys": [
"abc"
],
"outputKeys": [
"xyz"
],
"inputTemplate": {
"someKey": "someValue"
},
"backoffScaleFactor": 1,
"concurrentExecLimit": 0
}'

Response

Returns 200 OK, indicating that the task definition has been created successfully.