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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
use crateRuntime;
use ;
pub use Profile;
use debug;
use RuntimeBuilder;
use fs;
/// Represents and contains a runtime object defined by a profile.
///
/// This object can create a `Runtime` object from a file which defines that object using an
/// agreed-upon specification, known as a "profile". A profile contains `jobs`, `processes` and,
/// optionally, `log_monitors`. Items in `jobs` use a simple, domain-specific script language
/// called "arpx-job" in order to construct runtime objects using the defined `processes` and
/// `log_monitors`.
///
/// For example:
///
/// ```text
/// jobs:
/// - job1: |
/// p1 ? p2 : p3; @m1 @m2
/// p4
/// p5
///
/// processes:
/// - p1:
/// command: |
/// echo foo
/// exit 1
/// - p2:
/// command: echo bar
/// - p3:
/// command: echo baz
/// - p4:
/// command: echo qux
/// - p5:
/// command: echo quux
/// - p6:
/// command: echo garply
///
/// log_monitors:
/// - m1:
/// ontrigger: p6
/// test: 'grep "baz" <<< "$ARPX_BUFFER"'
/// - m2:
/// buffer_size: 1
/// test: 'echo $ARPX_BUFFER >> ~/test.log'
///
/// // `job1` output:
/// //
/// // [p1] "p1" (1) spawned
/// // [p1] foo
/// // [p1] "p1" (1) failed
/// // [p1] "p3" (2) spawned
/// // [p1] baz
/// // [p1] "p3" (2) succeeded
/// // [p1] "p6" (3) spawned
/// // [p1] garply
/// // [p1] "p6" (3) succeeded
/// // [p4] "p4" (4) spawned
/// // [p4] qux
/// // [p4] "p4" (4) succeeded
/// // [p5] "p5" (5) spawned
/// // [p5] quux
/// // [p5] "p5" (5) succeeded
/// ```