epygram.untied.parallel — Contains a framework to execute tasks in parallel

Contains a framework for parallel jobs.

Actors

class epygram.untied.parallel.Boss(name='26d08445-0881-44bc-b561-af7a04f7563e', scheduler=<epygram.untied.parallel.MaxThreadsScheduler object at 0x7f06734e1f50>, verbose=False)[source]

Bases: object

Template for bosses. A Boss is an object supposed to order a job to a series of workers.

Huh... keep calm guys, the validity of this definition is only assumed in this very context !

Optionally can be attributed to the Boss a name and a verbose*ity (to report publically, in log, the workers reports). Also, a *scheduler can be assigned, to rule the ordering of jobs to workers.

end()

Ends the listening process once instructions are treated. MUST BE CALLED (or wait_till_finished) for each Boss to avoid zombies processes.

get_report(block=True)[source]

Get report of the work executed. If block, block the calling tree until a report is received.

make_them_work(terminate=False, stop_listening=False)[source]

Order the workers to work. If terminate, no other instructions could be appended later. If stop_listening, alive workers go on their jobs, but they are not listened to anymore; this is a bit tricky but might be used ?

set_instructions(common_instructions={}, individual_instructions={})

Set instructions to be distributed to workers.

  • common_instructions are a series of arguments shared by each worker, to be passed to the Worker factory.
  • individual_instructions are a series of arguments proper to each worker, hence all individual instructions must have the same length
stop_them_working()[source]

Stop the workers.

wait_till_finished()

Block the calling tree until all instructions have been executed.

class epygram.untied.parallel.Worker(*args, **kwargs)[source]

Bases: footprints.FootprintBase

Template for workers. A Worker is an object supposed to do a job, according to instructions. The instructions has to be added to footprint attributes in actual classes.

Huh... keep calm guys, the validity of this definition is only assumed in this very context ! Don’t lynch me...

Footprint:

dict(
    attr = dict(), 
    bind = [], 
    info = 'Not documented', 
    only = dict(), 
    priority = dict(
        level = footprints.priorities.PriorityLevel('DEFAULT'),
    ),
)
stop_working()[source]

Make the worker stop working.

work()[source]

Send the Worker to his job.

you_are_expected()[source]

Block the Boss until the worker has finished his job. THIS METHOD SHOULD NEVER BE CALLED BY THE OBJECT HIMSELF ! (WOULD CAUSE A DEADLOCK if called from inside the worker’s subprocess)

Table Of Contents

Previous topic

epygram.untied.usevortex — Contains proxies to reach resources using Vortex

Next topic

Tips

This Page