class TaskStatusPoller(object): def __init__(self, dfk: "parsl.dataflow.dflow.DataFlowKernel"): self._poll_items = [] # type: List[PollItem] self._strategy = Strategy(dfk) self._error_handler = JobErrorHandler() def poll(self, tasks=None, kind=None): self._update_state() self._error_handler.run(self._poll_items) self._strategy.strategize(self._poll_items, tasks) def _update_state(self): now = time.time() for item in self._poll_items: item.poll(now) def add_executors(self, executors: Sequence[ParslExecutor]): for executor in executors: if executor.status_polling_interval > 0: logger.debug("Adding executor {}".format(executor.label)) self._poll_items.append(PollItem(executor)) self._strategy.add_executors(executors)
def __init__(self, dfk: "parsl.dataflow.dflow.DataFlowKernel"): self._poll_items = [] # type: List[PollItem] self._strategy = Strategy(dfk) self._error_handler = JobErrorHandler()