Skip to content

Commit

Permalink
Merge pull request #235 from compute-tooling/fix-timeout
Browse files Browse the repository at this point in the history
Fix timeout arg to distributed.Future
  • Loading branch information
hdoupe authored Nov 7, 2019
2 parents d504bea + 05ae892 commit 6b0d686
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion distributed/api/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def dask_endpoint(owner, app_name, action):
"job_id": job_id,
"comp_url": os.environ.get("COMP_URL"),
"comp_api_token": os.environ.get("COMP_API_TOKEN"),
"time_out": get_time_out(owner, app_name),
"timeout": get_time_out(owner, app_name),
}
)

Expand Down
5 changes: 2 additions & 3 deletions distributed/cs-dask-sim/cs_dask_sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def done_callback(future, job_id, comp_url, comp_api_token, start_time):
print("errors", resp.json())


def dask_sim(meta_param_dict, adjustment, job_id, comp_url, comp_api_token, time_out):
def dask_sim(meta_param_dict, adjustment, job_id, comp_url, comp_api_token, timeout):
"""
Wraps the functions.run_model function with a dask future and adds a
callback for pushing the results back to the webapp. The callback is
Expand All @@ -89,12 +89,11 @@ def dask_sim(meta_param_dict, adjustment, job_id, comp_url, comp_api_token, time
)
with worker_client() as c:
print("c", c)
# TODO: add and handle timeout
fut = c.submit(functions.run_model, meta_param_dict, adjustment)
fut.add_done_callback(partialled_cb)
try:
print("waiting on future", fut)
_ = fut.result(time_out=time_out)
_ = fut.result(timeout=timeout)
except Exception:
# Exceptions are picked up by the callback. We just
# log them here.
Expand Down

0 comments on commit 6b0d686

Please sign in to comment.