# Kill task

A Kill ends the run, here and now. Every other path of the run ends too, whatever it is doing: other branches, a loop that is under way. Nothing behind the Kill runs.

A run also ends by itself when all its paths have reached End. A Kill is for ending it earlier, and for saying how it ended.

## Fields

| Field | What it does |
|---|---|
| **End job with** | the status the run is given: **Cancelled**, **Completed (20 second delay)**, or **Polling** |

| Status | The run is shown as | Use it |
|---|---|---|
| **Cancelled** | cancelled | to stop a job at an error, on its failure line. The run does not count as completed. |
| **Completed** | completed, **without errors**: errors that were noted before are cleared. The run takes some seconds to end, while the other paths are stopped. | to end a job early when there is nothing to do, or after a failure the job has dealt with itself |
| **Polling** | not at all: "Ran as a polling job and has left the active job list until its next run finds items." | for a job that looks for work every minute. The runs that find nothing leave no trace, so that the list of runs shows the ones that did something. |

## Uses

**Stop at an error.** The red line of a task → an [Email](Task-Email.md) that reports it → Kill, **Cancelled**. Other branches of the job stop as well, which a path that simply ends does not do.

**A job that polls.** A job runs every minute, and most of the time there is nothing:

| Task | |
|---|---|
| **Find** | with **Fail if no files are found** unticked |
| **Jump** | `{items_count}` **Equals** `0` |
| **Kill** on the true line | **Polling** |
| the real work on the false line | |

The Dashboard and the list of runs then show the runs that had files, not 1,440 empty ones a day.

**"Handled, all fine."** A job tries a main server and, on failure, a second one. When the second worked, the run would still end "completed with errors" because of the first. A Kill with **Completed** at the end of the second way clears that.

## What it hands on

Nothing follows a Kill.

## Things to know

- **A Kill is not a failure.** It does not take the red line of anything and does not lead to the task named Default Failure.
- **Inside a called job.** A Kill in a job that a [Link](Task-Link.md) called inside a run ends the whole run, the caller too.
- **To end one path only**, do not use a Kill: let the path's last task have no line out, or lead it to End.
