Parallel iterator built using the fork() system call

class sage.parallel.use_fork.WorkerData(input, starttime=None, failure='')

Bases: object

Simple class which stores data about a running p_iter_fork worker.

This just stores three attributes:

  • input: the input value used by this worker
  • starttime: the walltime when this worker started
  • failure: an optional message indicating the kind of failure


sage: from sage.parallel.use_fork import WorkerData
sage: W = WorkerData(42); W
<sage.parallel.use_fork.WorkerData object at ...>
sage: W.starttime  # random
class sage.parallel.use_fork.p_iter_fork(ncpus, timeout=0, verbose=False, reset_interfaces=True)

Bases: object

A parallel iterator implemented using fork().


  • 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


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
sage: X.timeout
sage: X.verbose