1 # Batch EXecutor 3.0 -- Configuration
2 # (c) 2011-2012 Martin Mares <mj@ucw.cz>
9 # This file specifies default values, which can be overridden in BEX.cf
11 # A hash of all known machines and groups
12 # 'name' => { Option => ... } for a machine; options:
13 # Host => 'name' Host name to use in ssh, ping, ...
14 # 'name' => ['a','b','c'] for a group containing specified machines/subgroups
18 # Library directory where BEX modules live
19 our $lib = $ENV{"BEX_LIB"} // "lib";
21 # Home directory in which everything resides
22 our $home = $ENV{"BEX_HOME"} // ".";
24 # Configuration directory
25 our $cf_dir = $home . "/cf";
27 # A file whose contents should be prepended before the job. Should start with the "#!" line.
28 our $job_prolog = $cf_dir . '/prolog';
30 # A file whose contents should be appended to the job
31 our $job_epilog = $cf_dir . '/epilog';
33 # Keep history of successfully completed jobs
34 our $keep_history = 1;
36 # Before we try to connect to a host, ping it to check if it's alive
39 # Whenever we want to run a job on a machine, we must obtain a lock.
40 # Available locking schemes are:
41 # none - no locking takes place (dangerous!)
42 # job - obtain exclusive access to the job, other jobs on the same
43 # host can run in parallel
44 # host - obtain exclusive access to the host, other hosts can run
45 # queue - obtain exclusive access to the whole queue
46 our $locking_scheme = 'host';
48 # Maximum number of simultaneously running jobs in `bex prun'
49 our $max_parallel_jobs = 5;
51 # When a job fails, skip all other jobs on the same host
52 # (however, when locking_scheme is set to `job', another instance of `bex run'
53 # still could run such jobs in parallel)
54 our $skip_on_fail = 0;
56 # How we run ssh (including options)
57 our $ssh_command = "ssh";
59 # Various utility functions
61 sub parse_machine_list(@);
63 sub parse_machine_list(@) {
67 for my $mm (keys %machines) {
68 if (ref($machines{$mm}) eq 'HASH') {
75 if ($m =~ s{^!}{}) { $op = 0; }
76 my $v = $machines{$m};
78 die "Unknown machine or class: $m\n";
79 } elsif (ref($v) eq 'HASH') {
81 } elsif (ref($v) eq 'ARRAY') {
82 for my $mm (parse_machine_list(@$v)) {
87 return sort grep { $set{$_} } keys %set;
92 return $machines{$mach}->{'Host'} // $mach;
95 require $cf_dir . '/config';