|
NAMETest2::Harness::Runner::Resource::SharedJobSlots - limit the job count (-j) per machine SYNOPSISThis synopsis is not about using this in code, but rather how to use it on the command line. In order to use SharedJobSlots you must ether create the ".sharedjobslots.yml" file, or provide the "--shared-jobs-config PATH" argument on the command line. The "PATH" must be a path to a yaml file with configuration specifications for job sharing. CONFIG FILEConfig files for shared slots must be yaml file, they must also be parsable by YAML::Tiny, which implements a subset of yaml. Here is an example config file: ---
DEFAULT:
state_file: /tmp/yath-slot-state
max_slots: 8
max_slots_per_job: 2
max_slots_per_run: 6
myhostname:
state_file: /tmp/myhostname-slot-state
max_slots: 16
max_slots_per_job: 4
max_slots_per_run: 12
TOP LEVEL KEYS (HOSTNAMES)All top level keys are hostnames. When the config is read the settings for the current hostname will be used. If the hostname is not defined then the "DEFAULT" host will be read. If there is no "DEFAULT" host defined an exception will be thrown. CONFIG OPTIONSEach option must be specified under a hostname, none of these are valid on their own.
ALGORITHMS These are algorithms that are used to decide which test runs get which slots.
Example custom algorithm: sub custom_sort {
my ($state_object, $state_data, $a, $b) = @_;
return 1 if a_should_come_first($a, $b);
return -1 if b_should_come_first($a, $b);
return 0 if both_have_same_priority($a, $b);
# *shrug*
return 0;
}
Ultimately this is used in a sort() call, usual rules apply, return should be 1, 0, or -1. $a and $b are the 2 items being compared. $state_object is an instance of "Test2::Harness::Runner::Resource::SharedJobSlots::State". $state_data is a hashref like you get from "$state_object->state()" which is useful if you want to know how many slots each runner is using for a 'fair' style algorth. Take a look at the "request_sort_XXX" methods on "Test2::Harness::Runner::Resource::SharedJobSlots::State" which implement the 3 original sorting methods. SOURCEThe source code repository for Test2-Harness can be found at http://github.com/Test-More/Test2-Harness/. MAINTAINERSAUTHORSCOPYRIGHTCopyright 2022 Chad Granum <exodist7@gmail.com>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://dev.perl.org/licenses/
|