diff --git a/taskflow/engines/worker_based/executor.py b/taskflow/engines/worker_based/executor.py index c8d696dee..4b3a070ed 100644 --- a/taskflow/engines/worker_based/executor.py +++ b/taskflow/engines/worker_based/executor.py @@ -100,6 +100,11 @@ class WorkerTaskExecutor(executor.TaskExecutorBase): @staticmethod def _handle_expired_request(request): + """Handle expired request. + + When request has expired it is removed from the requests cache and + the `Timeout` exception is set as a request result. + """ LOG.debug("Request '%r' has expired.", request) request.set_result(misc.Failure.from_exception( exc.Timeout("Request '%r' has expired" % request))) diff --git a/taskflow/engines/worker_based/protocol.py b/taskflow/engines/worker_based/protocol.py index b778bae3f..abe00d21a 100644 --- a/taskflow/engines/worker_based/protocol.py +++ b/taskflow/engines/worker_based/protocol.py @@ -82,15 +82,14 @@ class Request(object): @property def expired(self): - """Check if request is expired. + """Check if request has expired. When new request is created its state is set to the PENDING, creation time is stored and timeout is given via constructor arguments. Request is considered to be expired when it is in the PENDING state for more then the given timeout (it is not considered to be expired - in any other state). After request is expired - the `Timeout` - exception is raised and task is removed from the requests map. + in any other state). """ if self._state == PENDING: return self._watch.expired()