Skip to content

Conversation

@yadudoc
Copy link
Member

@yadudoc yadudoc commented Mar 7, 2025

Description

The MPITaskScheduler uses Python's PriorityQueue to prioritize tasks based on the number of nodes requested.
When items with identical priorities are are submitted to the PriorityQueue, they attempt to sort based on the task dict which fails with TypeError unhashable type: dict. This PR adds a new PrioritizedTask dataclass that sets the task element to field(compare=False).

I'm splitting changes in #3783 to keep the PR concise. This is split 1 of 3.

Changed Behaviour

Fixes the bug described above.

Type of change

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

  • Bug fix

… the task: dict element.

* Added new test to confirm that tasks with identical priorities do not raise TypeErrors.


@pytest.mark.local
def test_hashable_backlog_queue():
Copy link
Collaborator

Choose a reason for hiding this comment

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

if this is a regression test, I would expect it to fail, but it doesn't with master 07a4efb on my laptop

Copy link
Collaborator

Choose a reason for hiding this comment

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

my bad, it does fail on master! (I didn't copy it across branches properly)

Copy link
Member Author

Choose a reason for hiding this comment

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

I was surprised. It definitely fails for me! Happy we got this sorted :)

@benclifford benclifford added this pull request to the merge queue Mar 10, 2025
Merged via the queue into master with commit 4d40f6f Mar 10, 2025
9 checks passed
@benclifford benclifford deleted the fix_mpi_priorityqueue branch March 10, 2025 21:09
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