Skip to content

Create a task

Tasks are normally created automatically when a Function or Workflow runs. Use new_task() for direct task creation. The kind combines an executable kind and an action, such as python+job. See the runtime documentation for runtime-specific configuration.

new_task

Create a new task entity in the backend.

Parameters:

Name Type Description Default
project str

Project name.

required
kind str

Entity kind.

required
uuid str

Entity identifier.

None
name str

Entity name.

None
labels list[str]

Entity labels.

None
function str

Function reference associated with the task.

None
workflow str

Workflow reference associated with the task.

None
**kwargs dict

Additional entity specification parameters.

{}

Returns:

Type Description
Task

Created task entity.

Examples:

Create a task for a function:

import digitalhub as dh

task = dh.new_task(
    project="my-project",
    kind="python+job",
    function="python://my-project/my-function:latest",
)