Parallel iterator built using the fork() system call¶
-
class
sage.parallel.use_fork.WorkerData(input, starttime=None, failure='')¶ Bases:
objectSimple class which stores data about a running
p_iter_forkworker.This just stores three attributes:
input: the input value used by this workerstarttime: the walltime when this worker startedfailure: an optional message indicating the kind of failure
EXAMPLES:
sage: from sage.parallel.use_fork import WorkerData sage: W = WorkerData(42); W <sage.parallel.use_fork.WorkerData object at ...> sage: W.starttime # random 1499330252.463206
-
class
sage.parallel.use_fork.p_iter_fork(ncpus, timeout=0, verbose=False, reset_interfaces=True)¶ Bases:
objectA parallel iterator implemented using
fork().INPUT:
ncpus– the maximal number of simultaneous- subprocesses to spawn
timeout– (float, default: 0) wall time in seconds until- a subprocess is automatically killed
verbose– (default: False) whether to print- anything about what the iterator does (e.g., killing subprocesses)
reset_interfaces– (default: True) whether to reset- all pexpect interfaces
EXAMPLES:
sage: X = sage.parallel.use_fork.p_iter_fork(2,3, False); X <sage.parallel.use_fork.p_iter_fork object at ...> sage: X.ncpus 2 sage: X.timeout 3.0 sage: X.verbose False