# Start and stop tasks

> Start a task, stop it, and apply edits to a running task.

Start a task to read from or write to hardware. Stop it to release the device. Synnax keeps the configuration, so you can start the task again later.

Before you start, you need:

* A task. Each task page shows how to create one, for example the [NI analog read task](https://docs.synnaxlabs.com/reference/hardware/ni/analog-read-task).
* A running Driver. Its status in the [devices toolbar](https://docs.synnaxlabs.com/reference/hardware/devices#statuses) is “Driver is running”.

## Start a task

[Enterprise](https://docs.synnaxlabs.com/reference/get-started/editions "Needs Synnax Enterprise")

**Console**

1. In the tasks toolbar, double-click the task to open it in a tab.
2. At the bottom right of the tab, click (**Start**).

The Console checks the configuration and creates the channels that the task needs. The status at the bottom of the tab changes to “Started task”. If it shows a warning or an error, see [Troubleshoot hardware](https://docs.synnaxlabs.com/reference/hardware/troubleshooting).

To start a task that already ran, you can also click next to the task in the tasks toolbar. This button does not create channels, so use the task tab after you add channels.

[](https://synnax.nyc3.cdn.digitaloceanspaces.com/docs/device-drivers/task/task-basic-dark.mp4#t=0.001)

**Python**

```python
from synnax import ni

# Wrap the task in the class for its type to get start, stop, and run.
task = ni.AnalogReadTask(internal=client.tasks.retrieve(name="Tank sensors"))

# Start the task and keep it running after the script exits.
task.start()

# Or run the task only while the block runs.
with task.run():
    with client.open_streamer(["tank_pressure"]) as streamer:
        frame = streamer.read()
```

`start()` waits up to 5 seconds for the Driver to answer, then raises `TimeoutError`. It does not raise when the Driver reports an error, so check the task status in the Console. `run()` starts the task and stops it when the block ends, even after an exception.

A task that you configure in code with no Driver goes to the embedded Driver of the Core.

**TypeScript**

```typescript
const task = await client.tasks.retrieve({ name: "Tank sensors" });

// Start the task and keep it running.
await task.start();

// Or run the task only while the function runs.
await task.run(async () => {
  const streamer = await client.openStreamer(["tank_pressure"]);
  await streamer.read();
  streamer.close();
});
```

`start()` sends the command and does not wait for the Driver to answer. `run()` starts the task, waits for the function, and then stops the task.

## Stop a task

[Enterprise](https://docs.synnaxlabs.com/reference/get-started/editions "Needs Synnax Enterprise")

**Console**

1. In the tasks toolbar, find the task.
2. Click next to the task.

The status changes to “Stopped task”. You can also click (**Stop**) in the task tab, or select several tasks, right-click, and select **Stop**.

**Python**

```python
task.stop()
```

`stop()` waits up to 5 seconds for the Driver to answer, then raises `TimeoutError`.

**TypeScript**

```typescript
await task.stop();
```

## Apply edits to a running task

The task tab saves your edits, but a running task keeps its old configuration. To apply the edits, click **Redeploy** in the task tab. The **Redeploy** item in the tasks toolbar menu does not create new channels. Changing data saving from the tasks toolbar restarts the task by itself.
