Skip to content

Commit

Permalink
Make cleanup work with executors without a provider (#2830)
Browse files Browse the repository at this point in the history
Co-authored-by: Thanh Son Phung <[email protected]>
  • Loading branch information
benclifford and tphung3 authored Jul 19, 2023
1 parent b9f2ca3 commit 824b782
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions parsl/dataflow/dflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -1199,15 +1199,16 @@ def cleanup(self) -> None:
if not executor.bad_state_is_set:
if isinstance(executor, BlockProviderExecutor):
logger.info(f"Scaling in executor {executor.label}")
job_ids = executor.provider.resources.keys()
block_ids = executor.scale_in(len(job_ids))
if self.monitoring and block_ids:
new_status = {}
for bid in block_ids:
new_status[bid] = JobStatus(JobState.CANCELLED)
msg = executor.create_monitoring_info(new_status)
logger.debug("Sending message {} to hub from DFK".format(msg))
self.monitoring.send(MessageType.BLOCK_INFO, msg)
if executor.provider:
job_ids = executor.provider.resources.keys()
block_ids = executor.scale_in(len(job_ids))
if self.monitoring and block_ids:
new_status = {}
for bid in block_ids:
new_status[bid] = JobStatus(JobState.CANCELLED)
msg = executor.create_monitoring_info(new_status)
logger.debug("Sending message {} to hub from DFK".format(msg))
self.monitoring.send(MessageType.BLOCK_INFO, msg)
logger.info(f"Shutting down executor {executor.label}")
executor.shutdown()
logger.info(f"Shut down executor {executor.label}")
Expand Down

0 comments on commit 824b782

Please sign in to comment.