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 # Home directory in which everything resides
19 our $bex_home = $ENV{"BEX_HOME"} // ".";
21 # Configuration directory
22 our $bex_cf_dir = $bex_home . "/BEX";
24 # A file whose contents should be prepended before the job. Should start with the "#!" line.
25 our $job_prolog = $bex_cf_dir . '/prolog';
27 # A file whose contents should be appended to the job
28 our $job_epilog = $bex_cf_dir . '/epilog';
30 # Keep history of successfully completed jobs
31 our $keep_history = 1;
33 # Before we try to connect to a host, ping it to check if it's alive
36 # Whenever we want to run a job on a machine, we must obtain a lock.
37 # Available locking schemes are:
38 # none - no locking takes place (dangerous!)
39 # job - obtain exclusive access to the job, other jobs on the same
40 # host can run in parallel
41 # host - obtain exclusive access to the host, other hosts can run
42 # queue - obtain exclusive access to the whole queue
43 our $locking_scheme = 'host';
45 # Maximum number of simultaneously running jobs in `bprun'
46 our $max_parallel_jobs = 5;
48 # When a job fails, skip all other jobs on the same host
49 # (however, when locking_scheme is set to `job', another instance of `brun'
50 # still could run such jobs in parallel)
51 our $skip_on_fail = 0;
53 # How we run ssh (including options)
54 our $ssh_command = "ssh";
56 # Various utility functions
58 sub parse_machine_list(@);
60 sub parse_machine_list(@) {
64 for my $mm (keys %machines) {
65 if (ref($machines{$mm}) eq 'HASH') {
72 if ($m =~ s{^!}{}) { $op = 0; }
73 my $v = $machines{$m};
75 die "Unknown machine or class: $m\n";
76 } elsif (ref($v) eq 'HASH') {
78 } elsif (ref($v) eq 'ARRAY') {
79 for my $mm (parse_machine_list(@$v)) {
84 return sort grep { $set{$_} } keys %set;
89 return $machines{$mach}->{'Host'} // $mach;
92 require $bex_cf_dir . '/config';