Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make HTEX scale-down be aware of unstarted blocks #3353

Merged
merged 3 commits into from
Apr 12, 2024

Conversation

benclifford
Copy link
Collaborator

@benclifford benclifford commented Apr 11, 2024

Description

Prior to this PR, the scale_in code for the HighThroughputExecutor will not scale in any block that has not had at least one manager register with the interchange, because it retrieves the list of blocks from the interchange. This is documented in issue #3232

This PR makes the htex scale in code also pay attention to blocks in the status_facade list - which includes blocks that have been submitted, and blocks which have been reported by the provider mechanism.

Changed Behaviour

Scaling in will now scale in more blocks.

Fixes

Fixes #3232

Type of change

  • Bug fix

…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
@benclifford benclifford marked this pull request as draft April 11, 2024 19:56
@benclifford
Copy link
Collaborator Author

there's one todo here aimed at @khk-globus - what's the nicest way to make a defaultdict entry come into existence without specifying any changes to the default?

@benclifford benclifford marked this pull request as ready for review April 12, 2024 12:06
Comment on lines +720 to +727
def new_block_info():
return BlockInfo(tasks=0, idle=float('inf'))

block_info: Dict[str, BlockInfo] = defaultdict(new_block_info)

for block_id, job_status in self._status.items():
if job_status.state not in TERMINAL_STATES:
block_info[block_id] = new_block_info()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per the PR comment to me, I think this looks fine. The only suggestion I might make is to take advantage of the dataclass's default handling via:

@dataclass
class BlockInfo:
    tasks: int = 0
    idle: float = float('inf')

And then there's no need for the new_block_info function. Just:

block_info = defaultdict(BlockInfo)

Beyond that, per our side-band conversation, I don't think now's the time to tackle the code smell you've discovered. This whole method could be cleaner yes, but suggest "not now."

Copy link
Collaborator

@khk-globus khk-globus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh; I hate that 15000ms (test `try_assert) is where we're at currently. But it is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants