> For the complete documentation index, see [llms.txt](https://docs.redefine.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.redefine.dev/configuration/parallel-test-execution/remote-workers/delayed-workers-and-reruns.md).

# Delayed Workers and Reruns

The startup time of CI machines may experience delays due to the unavailability of machines or infrastructure issues. The worker that has been delayed will have a considerably shorter effective [Broken mention](broken://pages/ukeQo52y77NM3cuhDJos) compared to other workers. Consequently, there is a risk of important tests being missed.

Repeating the execution of a single worker can yield similar results.

### Worker Identifier

To address the issue of delays and potential missed tests due to CI machine unavailability or infrastructure issues, you can utilize the `worker_id` optional parameter.

To implement this solution, use the following command:

{% tabs %}
{% tab title="Pytest" %}

```bash
redefine install --pytest --worker --worker-id=$WORKER_ID
```

{% endtab %}

{% tab title="Cypress" %}

```bash
redefine install --cypress --worker --worker-id=$WORKER_ID
```

{% endtab %}

{% tab title="Mocha" %}

```bash
redefine install --mocha --worker --worker-id=$WORKER_ID
```

{% endtab %}
{% endtabs %}

Ensure that the `WORKER_ID` environment variable contains the worker identifier specific to your CI system.

#### Handling worker rerun

it's important to note that if you have repeated executions of a single worker without re-running the orchestrator, the effective time limit for each subsequent execution may be reduced to zero. To prevent this, you can include the rerun attempt as part of the `worker_id`.&#x20;

Here's an example:

{% tabs %}
{% tab title="Pytest" %}

```bash
redefine install --pytest --worker --worker-id="${WORKER_ID}_${ATTEMPT}"
```

{% endtab %}

{% tab title="Cypress" %}

```bash
redefine install --cypress --worker --worker-id="${WORKER_ID}_${ATTEMPT}"
```

{% endtab %}

{% tab title="Mocha" %}

```bash
redefine install --mocha --worker --worker-id="${WORKER_ID}_${ATTEMPT}"
```

{% endtab %}
{% endtabs %}

In this case, make sure to set the `ATTEMPT` environment variable to the rerun attempt counter. This approach guarantees that each attempt is assigned a unique identifier, avoiding a zero effective time limit for repeated executions.

By implementing these strategies, you can mitigate delays, manage worker execution, and minimize the risk of missing important tests in your CI workflow.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.redefine.dev/configuration/parallel-test-execution/remote-workers/delayed-workers-and-reruns.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
