selector.ta_execution

This modules includes functions to execute the target algorithm.

Functions

cpu_bind_children(chosen_core, p, ...)

Ensures target algorithm and child processes only use the chosen core.

dummy_task(conf, instance_path, cache)

enqueue_output(out, queue)

Enqueue output.

get_running_processes(ta_process_name)

Get list of running processes.

kill_process_tree(pid)

Propagates through the process tree and terminates/kills children.

tae_from_aclib(conf, instance, cache, ta_exc)

tae_from_cmd_wrapper_quality(conf, ...)

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.

tae_from_cmd_wrapper_rt(conf, instance_path, ...)

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.

termination_check(process_pid, ...)

Check if process was terminated.

time_measurment(p, start, cpu_time_p)

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:
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:
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.

selector.ta_execution.time_measurment(p, start, cpu_time_p)[source]

Measures target algorithm runtime: 1. process tree or 2. process or 3. wall

Parameters:
  • p (object) – Target algorithm process.

  • start (float) – Start time in seconds.

  • cpu_time_p (float) – Last runtime measurement.