def __init__(self, dfk, *args, threshold=20, interval=5): """Initialize the flowcontrol object. We start the timer thread here Args: - dfk (DataFlowKernel) : DFK object to track parsl progress KWargs: - threshold (int) : Tasks after which the callback is triggered - interval (int) : seconds after which timer expires """ self.dfk = dfk self.threshold = threshold self.interval = interval self.cb_args = args self.strategy = Strategy(dfk) self.callback = self.strategy.strategize self._handle = None self._event_count = 0 self._event_buffer = [] self._wake_up_time = time.time() + 1 self._kill_event = threading.Event() self._thread = threading.Thread(target=self._wake_up_timer, args=(self._kill_event, ), name="FlowControl-Thread") self._thread.daemon = True self._thread.start()
def __init__(self, dfk, config, *args, threshold=20, interval=5): ''' Initialize the flowcontrol object We start the timer thread here Args: - dfk (DFK object) : DFK object to track parsl progress - config (Dict) : Config dict structure KWargs: - threshold (int) : Tasks after which the callback is triggered - interval (int) : seconds after which timer expires ''' self.dfk = dfk self.threshold = threshold self.interval = interval self.cb_args = args self.strategy = Strategy(dfk) self.callback = self.strategy.strategize self._handle = None self._event_count = 0 self._event_buffer = [] self._wake_up_time = time.time() + 1 self._thread = threading.Thread(target=self._wake_up_timer) self._thread.daemon = True self._thread.start()
class TaskStatusPoller(object): def __init__(self, dfk: "parsl.dataflow.dflow.DataFlowKernel"): self._poll_items = [] # type: List[PollItem] self._strategy = Strategy(dfk) def poll(self, tasks=None, kind=None): logger.debug("Polling") self._update_state() 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)) 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)
def __init__(self, dfk: "parsl.dataflow.dflow.DataFlowKernel"): self._poll_items = [] # type: List[PollItem] self._strategy = Strategy(dfk) self._error_handler = JobErrorHandler()