Package: controlpool
controlpoolMultiprocessing controllable poolPoolPool(func,processes,*[,worker_params,marks,raise_if_fail,controller])Class that create pool of workers for parrllel calculations.funcCallable obect, that call on every task. Signaturefunc(worker_param, arg)if worker_params is set orfunc(arg). Hereargis argument of Calculation frommapargs,worker_paramis parameter of worker fromworker_params.processesNumber of processes for parralel calculation. Actiual number of worker is minumum ofprocesses, length ofworker_params(if set) and length ofmarks(if set).Type: intworker_paramsIterables that represent list of workers parameters. Parameter of worker pass tofunc. Ifworker_paramsis not set othing is pass tofunc.marksSame asworker_params, but not pass tofunc. May be accesed bymarkattribute ofWorkerInfo. Ifmarksis not set None assigned as mark for each worker.raise_if_failIfTrueraise exception if all workers raise exeption. If *Falsenothing happen in this case (pool wait for new worker).Type: boolDefault: TruecontrollerCallable object that run in separate process and may controll pool workflow.controllercall with single argument ofControllerTerminalinstance. If not set, it will be no controller process.mapPool.map(args)Start parallel applies  onfunconargs.If one of worker faild (raise exception),Pooltry to reasigne this task to another worker.Return list of results in ame order, as inargs.argsIterable.closePool.close()Free pool resource. It should be called after all calculations done. AlternativelyPoolmay be used as context manager.ControllerTerminalClass for comunicate with poll. Instance of this class pass tocontrollerfunction. There is no reason to create instace manually.get_infoControllerTerminal.get_info()Return information aboutPool. SeeInfo.add_workerControllerTerminal.add_worker([mark,worker_param])Add worker toPool.Return (error, error_explanation). If error is True (or dequivalent), error_explanation contain text explanation of eror.markSet mark of worker.Default: Noneworker_paramSet parameter of worker.Default: Nonechange_worker_stateControllerTerminal.change_worker_state(worker_id,state[,now])Change state of existing worker inPool.Return (error, error_explanation). If error is True (or dequivalent), error_explanation contain text explanation of eror.worker_idOrder number (starting with 0) in list of workers in pool.stateNew state of worker (seeWorkerState).nowIndicate that state changed immediately (True) or after worker has completed current task.Default: FalseType BoolInfoClass represent information aboutPool. Contain several attributes:workers_infoList ofWorkerInfo. Each element represents info about each worker. Order number in list represent worker ID.workers_infoNumber of complete tasks.delayed_tasksNumber of task pending to reasign to another worker (seemap).WorkerInfoClass represent information about worker. Contain several attributes:markMark of the worker.statestate of worker (seeWorkerState).taskCurrent taskexceptionException that raise worker.Noneif there is no exception.worker_paramParameter of worker. Present only if there wasworker_paramsinPool.WorkerStateClass-enumerator represent worker state. There is several state:RUNWorker do calculationPAUSEDWorker paused by pool (not by controller). Not available formcontroller.STOPPEDWorker stopped bycontroller.EXCEPTIONWorker raise exeption. Not available formcontroller.KILLEDWorker completely killed.