1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//! # Run identifier generation.
//!
//! [`RunId`] is a human-readable task name for taskvisor, formatted as `{runner}-{slot}-{seq}`.
//! The sequence is process-global and monotonically increasing (starts at 1).
//!
//! See [`Runner::build_run_id`](crate::Runner::build_run_id) for the default id builder.
use ;
/// Global monotonically increasing sequence for run identifiers.
///
/// Local to the current agent process.
static RUN_SEQ: AtomicU64 = new;
/// Returns next numeric sequence value.
/// Result of [`make_run_id`]: a human-readable run id and the raw sequence number.
/// Build a human-readable run id used as task name for taskvisor.
///
/// Format: `{runner}-{slot}-{seq}`.
/// - `runner` - Runner::name()
/// - `slot` - TaskSpec.slot
/// - `seq` - per-process decimal sequence
///
/// Returns both the formatted name and the raw sequence number,
/// so callers that need the seq (e.g. for cgroup naming) don't
/// have to parse it back out of the string.