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

Adding typing info for HTEX #2847

Merged
merged 2 commits into from
Jul 31, 2023
Merged

Adding typing info for HTEX #2847

merged 2 commits into from
Jul 31, 2023

Conversation

yadudoc
Copy link
Member

@yadudoc yadudoc commented Jul 31, 2023

Description

This PR only adds some typing info for these methods/properties on the HighThroughputExecutor:

  • HTEX.outstanding
  • HTEX.connected_workers
  • HTEX.connected_managers

Type of change

Choose which options apply, and delete the ones which do not apply.

  • Code maintentance/cleanup

@yadudoc yadudoc requested a review from benclifford July 31, 2023 16:20
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.

One minor suggestion, but not a blocker.

Comment on lines 526 to 531
def outstanding(self):
def outstanding(self) -> int:
"""Returns the count of tasks outstanding across the interchange
and managers"""
outstanding_c = self.command_client.run("OUTSTANDING_C")
return outstanding_c
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggestion: "while here," and having just added the typing, there's no longer a need for the interim variable:

- outstanding_c = self.command_client.run("OUTSTANDING_C")
- return outstanding_c
+ return self.command_client.run("OUTSTANDING_C")

Same mild suggestion in the other hunks.

"""Returns a list of dicts one for each connected managers.
The dict contains info on manager(str:manager_id), block_id,
worker_count, tasks(int), idle_durations(float), active(bool)
"""
Copy link
Collaborator

Choose a reason for hiding this comment

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

This structure is frustratingly close to ManagerRecord in parsl/executors/high_throughput/manager_record, but not quite - ManagerRecords are transformed here:

resp = {'manager': manager_id.decode('utf-8'),

This docstring could be made into a very similar looking TypedDict, though, I think, which could give stronger checking of accesses to the dictionary

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, this is annoyingly bad. There are two fields that are different: tasks, which is now an int and idle_duration which is computed from ManagerRecord.idle_since. I can update the docstring and try update the ManagerRecord in a separate PR.

Copy link
Collaborator

Choose a reason for hiding this comment

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

probably needs to be a different type, not ManagerRecord

the current ManagerRecord is only used inside the interchange, I think - so it could be renamed and/or moved into interchange.py

@benclifford benclifford merged commit 4b8b0b8 into master Jul 31, 2023
4 checks passed
@benclifford benclifford deleted the typing_update_for_htex branch July 31, 2023 17:16
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.

3 participants