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

fix cycles in when traversing graph #520

Merged
merged 1 commit into from
Dec 6, 2024

Conversation

shubhbapna
Copy link
Collaborator

fixes #519

due to cycles graph traversal would cause maximum recursive depth reached error

@shubhbapna shubhbapna requested a review from dhellmann December 5, 2024 21:16
Copy link
Member

@dhellmann dhellmann left a comment

Choose a reason for hiding this comment

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

How hard would it be to construct a small dataset to have a unit test for this?

if match_dep_types and edge.req_type not in match_dep_types:
continue
visited.add(edge.destination_node.key)
Copy link
Member

Choose a reason for hiding this comment

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

We should add the start nodes, too, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

they will get added when they are being process in the loop

Copy link
Member

Choose a reason for hiding this comment

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

I don't think the start nodes from self.nodes[ROOT].children on line 243 will be added unless they also appear as a destination node of something else, right?

One way to address it would be to add start_node to the visited set as the first thing this function does. That way every node that is traversed is added. I think if you make that change, you don't need line 291, because the set will be updated during the recursion on line 293.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh I think the confusion is the name of the variable start_nodes. It should be start_edges because children is an array of edges. I have added a test case that adds a duplicate toplevel entry (start node) and the test passes

Copy link
Member

Choose a reason for hiding this comment

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

Ah, OK.

@shubhbapna shubhbapna requested a review from dhellmann December 6, 2024 15:01
@mergify mergify bot added the ci label Dec 6, 2024
due to cycles graph traversal would cause maximum recursive depth reached error

Signed-off-by: Shubh Bapna <[email protected]>
if match_dep_types and edge.req_type not in match_dep_types:
continue
visited.add(edge.destination_node.key)
Copy link
Member

Choose a reason for hiding this comment

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

Ah, OK.

@mergify mergify bot merged commit a58d2de into python-wheel-build:main Dec 6, 2024
74 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

maximum recursion depth error when writing installation dependencies after bootstrapping
2 participants