SitePool#

class fedcausal.fedges.SitePool(sites, n_jobs=None)[source]#

Runs a list of sites, either in this process or spread over worker processes.

Each worker owns its sites for the whole run, so their score caches survive between rounds; only DAGs and scores cross between processes. Use it as a context manager so the workers are shut down.

Parameters:
siteslist of Site
n_jobsint or None

Worker processes. None or 1 runs the sites in this process, and -1 uses one worker per site up to the number of CPUs.

learn()[source]#

Make every site rebuild its model; return the models in site order.

merge(global_dag)[source]#

Make every site merge global_dag in; return the models in site order.

models()[source]#

Return every site’s current model, in site order.

close()[source]#

Shut the workers down, ending any that do not stop within a few seconds.