Skip to content

Commit

Permalink
Code review
Browse files Browse the repository at this point in the history
  • Loading branch information
crusaderky committed Jul 5, 2023
1 parent e5a2666 commit d51b536
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions distributed/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -2267,11 +2267,12 @@ async def execute(self, key: str, *, stimulus_id: str) -> StateMachineEvent:
self.active_keys.add(key)
# Propagate span (see distributed.spans). This is useful when spawning
# more tasks using worker_client() and for logging.
if "span" in ts.annotations:
span_ctx = dask.annotate(span=ts.annotations["span"])
span_ctx.__enter__()
else:
span_ctx = None
span_ctx = (
dask.annotate(span=ts.annotations["span"])
if "span" in ts.annotations
else contextlib.nullcontext()
)
span_ctx.__enter__()

try:
ts.start_time = time()
Expand Down Expand Up @@ -2321,8 +2322,7 @@ async def execute(self, key: str, *, stimulus_id: str) -> StateMachineEvent:
)
finally:
self.active_keys.discard(key)
if span_ctx:
span_ctx.__exit__(None, None, None)
span_ctx.__exit__(None, None, None)

self.threads[key] = result["thread"]

Expand Down

0 comments on commit d51b536

Please sign in to comment.