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

fail-graph not showing true root of the conflict #865

Closed
brentVilla opened this issue Mar 19, 2020 · 3 comments · Fixed by #1087
Closed

fail-graph not showing true root of the conflict #865

brentVilla opened this issue Mar 19, 2020 · 3 comments · Fixed by #1087
Labels

Comments

@brentVilla
Copy link

We found cases where the graph generated to show conflicts doesn't show the root cause of the conflict. Suppose we have three products, foo, bar, and baz. bar depends on foo and baz depends on both foo and bar. In other words, we have package.py with the following:

% cat foo/1.0/package.py
name = 'foo'
version = '1.0'

% cat foo/2.0/package.py
name = 'foo'
version = '2.0'

% cat bar/1.0/package.py
name = 'bar'
version = '1.0'
requires = ['foo-1.0']

% cat bar/2.0/package.py
name = 'bar'
version = '2.0'
requires = ['foo-2.0']

% cat baz/1.0/package.py
name = 'baz'
version = '1.0'
requires = ['foo-1.0', 'bar-1.0']

% cat baz/2.0/package.py
name = 'baz'
version = '2.0'
requires = ['foo-2.0', 'bar-2.0']

The following generates a conflict as expected because baz-1.0 requires foo-1.0 and bar-1.0 which conflicts with the foo-2.0 and bar-2.0 in the request:
rez-env foo-2.0 bar-2.0 baz-1.0 --fail-graph

However, the fail graph won't show baz at all although it's the one in conflict.
resolve-dot-JeEyIg

Now, if I drop the intermediate bar-2.0 request, I will get a more helpful failure graph that shows baz as being part of the conflict.
rez-env foo-2.0 baz-1.0 --fail-graph
resolve-dot-h9lgdr

This is a trivial case for this issue. But in more complex resolves, it can be quite difficult and time consuming to modify the request to get at the root cause of the conflict.

@nerdvegas
Copy link
Contributor

Thanks very much for the repro. There has been a graph bug lurking for a long time, and this simple repro should help a lot in tracking it down.

@davidlatwe
Copy link
Contributor

davidlatwe commented May 25, 2021

Just saw this issue and thought this might worth mentioning.

Changing request order from

rez-env foo-2.0 bar-2.0 baz-1.0 --fail-graph

into

rez-env baz-1.0 foo-2.0 bar-2.0 --fail-graph

will also get more helpful graph.

So I guess moving the request of the package which have wider overlap on the full request list at front could have better chance to show full fail graph.

Maybe we could do this sorting before resolve ? Or when --fail-graph presented ? For like, a simple guess for better fail graph.

def requests_coverage(req):
    count = 0
    pkg = get_latest_package(req.name, range_=req.range)
    if pkg:
        required = [r.name for r in pkg.get_variant().get_requires()]
        count = sum(r.name in required for r in package_requests)
    return count

request_list = RequirementList(
    sorted(package_requests, key=requests_coverage, reverse=True)
)

@nerdvegas
Copy link
Contributor

nerdvegas commented May 25, 2021 via email

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 a pull request may close this issue.

4 participants