Job Retries#

When a job fails, Autosubmit can automatically resubmit it up to a configurable number of times, optionally with a delay between attempts. This page covers job-level retries; for SSH-connection and remote-command retries, see SSH connection and command retries below.

Note

The RETRIALS setting will be renamed to RETRIES in a future release (see #2088). RETRIALS will continue to work during the transition.

Configuration#

Two settings control job retries. Both go under CONFIG in autosubmit_<EXPID>.yml:

Parameter

Description

RETRIALS

Maximum number of retries after the first failure. Default: 0 (no retries). May be overridden per job under JOBS.<section>.RETRIALS or per wrapper under WRAPPERS.<section>.RETRIALS.

DELAY_RETRY_TIME

Delay in seconds between retries. Accepts three formats — plain, +N, and *N — described below. Default: -1 (no delay; retry immediately).

Delay formats#

DELAY_RETRY_TIME accepts three syntaxes. The prefix (+ or *, or none) tells Autosubmit which formula to use for computing the delay before each retry.

Format

Formula

Behavior

N

constant N

Wait N seconds before every retry.

+N

N × fail_count

Linear growth. Wait N, 2N, 3N, … seconds.

*N

N × 10^(fail_count - 1)

Exponential growth. Wait N, 10N, 100N, … seconds.

The *N format is a form of exponential backoff, a common retry pattern in distributed systems and workflow managers. See also Kestra’s overview and OpenWorkflow’s retries docs.

Worked example with N = 11:

Retry #

11

+11

*11

1

11 s

11 s

11 s

2

11 s

22 s

110 s

3

11 s

33 s

1 100 s

4

11 s

44 s

11 000 s

Use the plain or +N format when failures are expected to be short and transient (e.g. brief HPC hiccups). Use *N when a longer back-off is safer, for example when the platform may be under maintenance.

Example#

CONFIG:
    RETRIALS: 3
    DELAY_RETRY_TIME: +30    # wait 30, 60, 90 seconds between retries

A per-job override on the retry count:

JOBS:
    POST:
        FILE: templates/post.sh
        RETRIALS: 5

Wrapper retries#

Wrappers accept their own RETRIALS setting, which overrides the one on the inner jobs. See Retrials for details.

Vertical wrappers retry inner jobs inside the wrapper submission rather than by resubmitting the wrapper. Once a vertical wrapper’s inner job has exhausted its inner retries and the wrapper finishes, Autosubmit will not retry that inner job again externally.

Template variables#

Retry-related values are exposed as template variables that scripts can reference:

Variable

Value

%FAIL_COUNT%

Current retry number (0 on first attempt, incremented on each failure).

%RETRIALS%

Configured maximum retry count for the job.

Retry log files#

Each retry writes its own log files in LOG_<EXPID>/, suffixed with the attempt number:

<job_name>.<timestamp>.out                  # first attempt
<job_name>.<timestamp>.err
<job_name>.<timestamp>.out_attempt_1        # first retry
<job_name>.<timestamp>.err_attempt_1
<job_name>.<timestamp>.out_attempt_2        # second retry
...

Statistics from autosubmit stats include per-job retry counts (retrialCount, completedCount, failedCount).

SSH connection and command retries#

The retries described above are for job execution. Autosubmit also retries at two lower levels when talking to the remote platform: SSH connections and remote command execution.

For remote platforms, there are at least two parts where retries happen (if you use wrappers you may have others), when Autosubmit connects to the remote platform, and when Autosubmit executes a command.

When Autosubmit connects to a remote platform, it will use the host value of the platform configuration. This value can contain a single host name, or a list of host names using commas (,) as separators.

Right now Autosubmit has a hard-coded number of retries for connecting to remote platforms. It will try to connect to the platform, without interval, retrying connecting twice (2). It will write to logs in INFO and WARNING levels information about the retries, like whether it is retrying to connect, and what is the current retry number.

When multiple hosts are given as a comma-separated list, the first connection attempt uses the first host in the list. If it fails, the single retry picks at random from the remaining hosts, excluding the one that just failed.

For executing commands on remote platforms, Autosubmit uses another hard-coded value of 3 retries, without interval between each retry. Autosubmit will submit the command to be executed via SSH. If the command fails on the remote platform, Autosubmit will not retry the command.

As an example, if you try to run an executable such as Rscript, but this executable does not exist on the remote platform, Autosubmit will log the error, and mark the job as FAILED. If the job has RETRIALS configured (see Job Retries), Autosubmit may then retry it according to that policy — though a missing executable will fail identically on every retry.

However, if you have a networking issue between Autosubmit and your remote platform, then Autosubmit will log in INFO and WARNING and will retry executing the command up to hard-coded 3 retries.

Autosubmit treats network problems with a remote platform as recoverable events. If the session drops, if the SSH transport breaks, or if a connection or a timeout fails, Autosubmit rebuilds the connection and tries the command again. This includes the case where the remote host closes the socket and Paramiko raises an EOFError, which used to abort the run.

To avoid idle disconnections, Autosubmit can send keepalive packets to the remote platform. You configure this per platform with PLATFORMS.<name>.SSH_KEEPALIVE, in seconds, and the default is 30. Setting it to 0 disables keepalives. The value is how often a keepalive packet is sent while the connection is idle. It is not a connection timeout.

If a platform keeps dropping the connection after every reconnection, Autosubmit stops the run instead of retrying the recovery forever. You control how many consecutive transport failures are tolerated with PLATFORMS.<name>.MAX_TRANSPORT_RETRIALS, and the default is 3. Setting it to 0 disables the limit. This protects the run when a platform stays unreachable after several attempts.

Note

The number of attempts Autosubmit makes before giving up is fixed in the code: 2 for connecting and 3 for executing a command. Issue #986 tracks making those counts configurable.

For ecaccess platforms specifically, the -retry flag count on the ecaccess binary is user-configurable via PLATFORMS.<name>.ECACCESS_RETRIES (default 100).