Skip to content

Commit

Permalink
Enable assert
Browse files Browse the repository at this point in the history
  • Loading branch information
fjetter committed Jan 7, 2021
1 parent 391118f commit f0e4323
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions distributed/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -1538,7 +1538,10 @@ def add_task(
if self.validate:
if who_has:
assert all(self.tasks[dep] in ts.dependencies for dep in who_has)
self.validate_state()
assert all(self.tasks[dep.key] for dep in ts.dependencies)
for dependency in ts.dependencies:
self.validate_task(dependency)
self.validate_task(ts)
except Exception as e:
logger.exception(e)
if LOG_PDB:
Expand Down Expand Up @@ -2498,7 +2501,6 @@ async def ensure_computing(self):
continue
if self.meets_resource_constraints(key):
self.constrained.popleft()
# FIXME: Should this be part of the transition step?
# Ensure task is deserialized prior to execution
try:
ts.runspec = await self._maybe_deserialize_task(ts)
Expand All @@ -2518,7 +2520,6 @@ async def ensure_computing(self):
elif ts.key in self.data:
self.transition(ts, "memory")
elif ts.state in READY:
# FIXME: Should this be part of the transition step?
# Ensure task is deserialized prior to execution
try:
ts.runspec = await self._maybe_deserialize_task(ts)
Expand Down Expand Up @@ -2929,8 +2930,6 @@ def validate_task_flight(self, ts):

def validate_task(self, ts):
assert ts.key in self.tasks
for dependency in ts.dependencies:
dependency in self.tasks
try:
if ts.state == "memory":
self.validate_task_memory(ts)
Expand Down

0 comments on commit f0e4323

Please sign in to comment.