# Chalk CLI Reference: Tasks
source: https://docs.chalk.ai/cli#tasks

Run, monitor, and manage asynchronous tasks. Tasks are long-running operations that execute in the background.

## `chalk task run`
source: https://docs.chalk.ai/cli?command=task_run

```bash
chalk task run [target] [flags]
```

Use the `task run` command to execute Python scripts or modules in your deployment.

'target' can be a file path (file.py), module name (my_module), or include a specific function (file.py::func, module::func) or class method (file.py::Class::method, module::Class::method).

**Flags**

- `-m, --module <module>` (bool, default `false`)
  Interpret the target as a Python module path instead of a file path.
- `--branch <branch>` (string)
  Target a specific Chalk branch
- `--resource-group <resource-group>` (string, default `default`)
  Resource group to run the task in.
- `--enable-profiling <enable-profiling>` (bool, default `false`)
  Enable `ddprof` profiling for task execution.
- `--max-retries <max-retries>` (int, default `0`)
  Number of retry attempts after the initial run (default: 0).
- `--arg <arg>` (string[], default `[]`)
  Arguments to pass to the script (repeatable). Use `key=value` for kwargs or plain values for positional args. All values are passed as strings, so function parameters must use `str` type hints.
- `--args-file <args-file>` (string)
  Path to a [JSON Lines](https://jsonlines.org/) file where each line contains kwargs for one script task. Values preserve JSON types (for example, `int` and `bool`).
- `--skip-apply <skip-apply>` (bool, default `false`)
  Skip the automatic `chalk apply` step when running with `--branch`.
- `--skip-validation <skip-validation>` (bool, default `false`)
  Skip Python target validation before execution.

**Example**

```
$ chalk task run my_script.py
$ chalk task run my_script.py::my_function
$ chalk task run my_module::MyClass::my_method
$ chalk task run my_script.py --branch feature-branch --watch
```

## `chalk task cancel`
source: https://docs.chalk.ai/cli?command=task_cancel

```bash
chalk task cancel [task-id]
```

Cancel a script task by its task ID.

**Example**

```
$ chalk task cancel abc123
```

## `chalk task get`
source: https://docs.chalk.ai/cli?command=task_get

```bash
chalk task get [task-id]
```

Retrieve information about a script task by its task ID.

**Example**

```
$ chalk task get st-abc123-def456
```

## `chalk task rerun`
source: https://docs.chalk.ai/cli?command=task_rerun

```bash
chalk task rerun [task-id]
```

Rerun a script task by its task ID. Creates a new task with the same configuration as the original.

**Example**

```
$ chalk task rerun st-abc123-def456
```
