The execution constraints class is used to define the constraints on the execution of a black box. The execution constraints requires an enforcer. The current supported enforcer is RunSolver.
- class optilog.blackbox.ExecutionConstraints(enforcer, h_wall_time=None, h_cpu_time=None, h_virtual_memory=None, h_real_memory=None, s_wall_time=None, s_cpu_time=None, s_virtual_memory=None, s_real_memory=None)
Describes the execution constraints of a process
int]) – Hard Wall time limit in seconds
int]) – Soft Wall time limit in seconds
int]) – Hard CPU time limit in seconds
int]) – Soft CPU time limit in seconds
str]) – Hard virtual memory limit in seconds
str]) – Soft virtual memory limit in seconds
str]) – Hard real memory limit (rss+swap) in seconds
str]) – Soft real memory limit (rss+swap) in seconds
Enforcer) – Enforcer object that ensures the execution constraints are respected.
- class optilog.blackbox.RunSolver(path=None, delay=None, watcher_path=None, timestamp=False)
RunSolver class that implements the Enforcer interface and ensures the execution constraints are satisfied.
Note that RunSolver is a separate program not included with OptiLog. You can download it from http://www.cril.univ-artois.fr/~roussel/runsolver/
RunSolver actively monitors the full tree of processes spawned by the command and kills them if the constraints are not respected. In order to do so, the process will wake up routinely and check the constraints.
This may cause a slight overhead in cache misses and context switches. A way to reduce this overhead is to reseve an extra core for the runsolver process.
You can only set the soft constraints on RunSolver because the hard constraints are enforced after
delayseconds are passed.
Path]) – Path to the runsolver executable. If None, the path will be searched in the PATH environment variable.
int]) – Delay in seconds between checking the constraints. If None, the default value of runsolver will be used.
None]) – Path to the watcher file. If None, a temporary file will be created.
bool) – If True, the data will have the wall time and cpu time attached to it, also stdout and stderr will be merged into stdout.
Example with RunSolver and no extra parameters:
1RunningScenario( 2 tasks=tasks, 3 solvers=solvers_dict, 4 submit_file=f"submitter.sh", 5 constraints=ExecutionConstraints( 6 s_wall_time=1000, 7 s_real_memory="100M", 8 enforcer=RunSolver() 9 ))
- class optilog.blackbox.DockerEnforcer
DockerEnforcer class that implements the Enforcer interface and ensures the execution constraints are satisfied. This class uses Docker to enforce the execution constraints.