selector.ta_execution
This modules includes functions to execute the target algorithm.
Functions
|
Ensures target algorithm and child processes only use the chosen core. |
|
|
|
Enqueue output. |
|
Get list of running processes. |
|
Propagates through the process tree and terminates/kills children. |
|
|
|
Execute the target algorithm with a given conf/instance pair by calling a user-provided Wrapper that creates a command line argument that can be executed. |
|
Execute the target algorithm with a given conf/instance pair by calling a user-provided Wrapper that creates a command line argument that can be executed. |
|
Check if process was terminated. |
|
Measures target algorithm runtime: 1. |
- selector.ta_execution.cpu_bind_children(chosen_core, p, set_affinity, logging)[source]
Ensures target algorithm and child processes only use the chosen core.
- Parameters:
chosen_core (int) – Core the process and children ought to stay on.
p (object) – Target algorithm process.
set_affinity (list) – List that tracks CPU affinity of child processes.
logging (object) – Initialized logging object.
- selector.ta_execution.enqueue_output(out, queue)[source]
Enqueue output.
- Parameters:
out (str) – Target algorithm output.
queue (multiprocessing.Queue) – Queue to get data.
- selector.ta_execution.get_running_processes(ta_process_name)[source]
Get list of running processes.
- Parameters:
ta_process_name (str) – Name of process to find all processes with.
- selector.ta_execution.kill_process_tree(pid)[source]
Propagates through the process tree and terminates/kills children.
- Parameters:
pid (int) – Process ID of the target algorithm.
- selector.ta_execution.tae_from_cmd_wrapper_quality(conf, instance_path, cache, ta_command_creator, scenario)[source]
Execute the target algorithm with a given conf/instance pair by calling a user-provided Wrapper that creates a command line argument that can be executed.
Warning
If your target algorithms spawn child processes, you might set scenario.cpu_binding = True.
- Parameters:
conf (selector.pool.Configuration) – Configuration.
instance (str) – instance name.
cache (selector.tournament_dispatcher.MiniTournamentDispatcher) – Cache for all tournament data.
ta_command_creator (wrapper) – Wrapper that creates a command line.
scenario (selector.scenario.Scenario) – AC scenario.
- Returns:
conf : object, Configuration.
instance_path : str, Path to the instance.
terminated : bool, Whether the process was terminated.
- Return type:
tuple
- selector.ta_execution.tae_from_cmd_wrapper_rt(conf, instance_path, cache, ta_command_creator, scenario)[source]
Execute the target algorithm with a given conf/instance pair by calling a user-provided Wrapper that creates a command line argument that can be executed.
Warning
If your target algorithms spawn child processes, you might set scenario.cpu_binding = True.
- Parameters:
conf (selector.pool.Configuration) – Configuration.
instance (str) – instance name.
cache (selector.tournament_dispatcher.MiniTournamentDispatcher) – Cache for all tournament data.
ta_command_creator (wrapper) – Wrapper that creates a command line.
scenario (selector.scenario.Scenario) – AC scenario.
- Returns:
conf : object, Configuration.
instance_path : str, Path to the instance.
terminated : bool, Whether the process was terminated.
- Return type:
tuple
- selector.ta_execution.termination_check(process_pid, process_status, ta_process_name, python_pid, conf_id, instance)[source]
Check if process was terminated.
- Parameters:
process_pid (int) – PID of the process to check.
process_status (str) – Status of the process.
ta_process_name (str) – Name of the ta process as noted in system.
python_pid (int) – PID of the ray actor.
conf_id (uuid.UUID) – ID of the configuration.
instance (str) – Problem instance name.