I just noticed that CYLC_TASK_TRY_NUMBER does not update after the number of executions limit has been reached. Reading the docs, it sounds like this number only increments with an automatic retry. This seems like an odd feature to me. I expected that it would increment every time the task was run. If it passed and I ran it, I would expect the try number to increase by one. If it failed and I manually run it, I expected the try number to increment by one.
I guess my question is - is the current implementation the behaviour other people expect, or should it be like how I describe it above?
You’re right, but it’s deliberate because we distinguish between automatic retries and forced triggering. The try number only increments with automatic retries, but the submit number increments every time the task submits a job.
Submit number is also available in task environments but the variable is derived from the job script path and exported inside a boiler-plate job script function, so it’s not exposed in the main job script like the try number.