content/kapacitor/v1/working/flux/manage/task-runs.md
Use the kapacitor CLI or the Kapacitor HTTP API to manage Kapacitor Flux task runs.
Each Flux task execution is considered a "run."
{{< tabs-wrapper >}} {{% tabs %}} CLI API {{% /tabs %}}
<!----------------------------- BEGIN CLI content ----------------------------->{{% tab-content %}}
Use the kapacitor flux task run list command and its sub commands to manage
Kapacitor Flux task runs.
Use the kapacitor flux task run list command to output Kapacitor Flux task logs.
Provide the following flags:
{{< req type="key" >}}
--task-id: Task ID--run-id: Filter by run ID--before: Return task runs that occurred before this time (RFC3339 timestamp)--after: Return task runs that occurred after this time (RFC3339 timestamp)--limit: Limit the number of returned task runs (default is 100)kapacitor flux task run list --task-id 000x00xX0xXXx00
kapacitor flux task run list \
--task-id 000x00xX0xXXx00 \
--after 2021-01-01T00:00:00Z \
--before 2021-01-31T00:00:00Z
kapacitor flux task run list \
--task-id 000x00xX0xXXx00 \
--limit 10
Use the kapacitor flux task run retry command to retry a Kapacitor Flux task run.
Provide the following flags:
{{< req type="key" >}}
--task-id: Task ID--run-id: Run IDkapacitor flux task run retry \
--task-id 000x00xX0xXXx00 \
--run-id XXX0xx0xX00Xx0X
{{% /tab-content %}}
<!------------------------------ END CLI content ------------------------------> <!----------------------------- BEGIN API content ----------------------------->{{% tab-content %}}
Use the following request method and endpoint to list Kapacitor Flux task runs.
{{< api-endpoint method="get" endpoint="/kapacitor/v1/api/v2/tasks/{taskID}/runs" >}}
Provide the following with your request ({{< req type="key" >}}):
The following examples use the task ID 000x00xX0xXXx00.
curl --GET 'http://localhost:9092/kapacitor/v1/api/v2/tasks/000x00xX0xXXx00/runs' \
--header 'Content-Type: application/json'
curl --GET 'http://localhost:9092/kapacitor/v1/api/v2/tasks/000x00xX0xXXx00/runs' \
--header 'Content-Type: application/json' \
--data-urlencode "limit=10"
curl --GET 'http://localhost:9092/kapacitor/v1/api/v2/tasks/000x00xX0xXXx00/runs' \
--header 'Content-Type: application/json' \
--data-urlencode "after=XXX0xx0xX00Xx0X"
curl --GET 'http://localhost:9092/kapacitor/v1/api/v2/tasks/000x00xX0xXXx00/runs' \
--header 'Content-Type: application/json' \
--data-urlencode 'afterTime=2021-01-01T00:00:00Z' \
--data-urlencode 'beforeTime=2021-01-31T00:00:00Z'
Use the following request method and endpoint to retry a Kapacitor Flux task run.
{{< api-endpoint method="post" endpoint="/kapacitor/v1/api/v2/tasks/{taskID}/runs/{runID}/retry" >}}
Provide the following with your request ({{< req type="key" >}}):
# Retry run ID XXX0xx0xX00Xx0X for task ID 000x00xX0xXXx00
curl --request POST \
'http://localhost:9092/kapacitor/v1/api/v2/tasks/000x00xX0xXXx00/runs/XXX0xx0xX00Xx0X'
{{% /tab-content %}}
<!------------------------------ END API content ------------------------------>{{< /tabs-wrapper >}}
For an easy way to retry all failed task runs, see Retry failed Kapacitor tasks.