Azure / Azure/Batch

How can I run a task on job termination once per job?

Open
#5 2 comments 0 reactions 0 assignees View on GitHub
feature request question
Dominant language
No language data
Stars
27
Forks
29
PR merge metrics
No merged PRs in 30d

Description

What I'd like to do is something like:
```
try {
// run all regular tasks
} finally {
// run a final termination task, once per job, not per node
// the termination task shall run whether the job completed normally or was terminated early
}
```
In my case, the final termination task would query the Batch API and fetch the exit status of each regular task and determine the overall "success" of the job, and then write this into a database.

It seems that this is not directly possible currently. The options are:

1. Abuse the current job release tasks. Since these run per-node, the script that's executed would have to be engineered such that it is OK to run it multiple times.

2. Define the termination task as a regular task which depends on all other tasks. This would only work partly though. If the job is terminated early, then this final task would never run, which defeats the whole point.

Is there anything I'm not considering here? It seems like a fairly basic missing feature.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.