Skip to content

Commit e4802d6

Browse files
committed
at this point, scale in code can now observe poll item states and so htex can now make use of that information source...
so I can try to make a better implementation of PR #3232 i think this fixes 3232
1 parent 4d92648 commit e4802d6

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

parsl/executors/high_throughput/executor.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from parsl.serialize import pack_res_spec_apply_message, deserialize
1919
from parsl.serialize.errors import SerializationError, DeserializationError
2020
from parsl.app.errors import RemoteExceptionWrapper
21-
from parsl.jobs.states import JobStatus, JobState
21+
from parsl.jobs.states import JobStatus, JobState, TERMINAL_STATES
2222
from parsl.executors.high_throughput import zmq_pipes
2323
from parsl.executors.high_throughput import interchange
2424
from parsl.executors.errors import (
@@ -730,8 +730,22 @@ class BlockInfo:
730730
tasks: int # sum of tasks in this block
731731
idle: float # shortest idle time of any manager in this block
732732

733+
# block_info will be populated from two sources:
734+
# the Job Status Poller mutable block list, and the list of blocks
735+
# which have connected to the interchange.
736+
737+
def new_block_info():
738+
return BlockInfo(tasks=0, idle=float('inf'))
739+
740+
block_info: Dict[str, BlockInfo] = defaultdict(new_block_info)
741+
742+
for block_id, job_status in self._poller_mutable_status.items():
743+
if job_status.state not in TERMINAL_STATES:
744+
# TODO: is there a nicer way to make block_info come into existence?
745+
# can i write just the expression block_info[block_id] on its own?
746+
block_info[block_id] = new_block_info()
747+
733748
managers = self.connected_managers()
734-
block_info: Dict[str, BlockInfo] = defaultdict(lambda: BlockInfo(tasks=0, idle=float('inf')))
735749
for manager in managers:
736750
if not manager['active']:
737751
continue

0 commit comments

Comments
 (0)