nix-community / nix-review-tools

WIP tooling
22 stars 10 forks source link

Usage help #3

Closed bhipple closed 4 years ago

bhipple commented 4 years ago

I'm giving this a try for the first time to try to solve the following issue: as part of implementing https://github.com/NixOS/nixpkgs/issues/79975, I tested a good portion of the Rust ecosystem, but regrettably there are a couple broken packages I missed (fixed in https://github.com/NixOS/nixpkgs/pull/80153).

I would like to go through and scan Hydra logs for all failing Rust packages that recently started failing so that I can prioritize upgrading them (e.g., https://github.com/NixOS/nixpkgs/pull/80197). It doesn't look like Hydra provides a particularly rich API, and I really like this tool's idea of just downloading all the build logs and munging them to produce a report, but I'm having the following issue:

λ brh nix-review-tools →  ./eval-report 1570625
Traceback (most recent call last):
        10: from -e:1:in `<main>'
         9: from -e:1:in `load'
         8: from /home/bhipple/src/nix-review-tools/eval-report:16:in `<top (required)>'
         7: from /home/bhipple/src/nix-review-tools/eval-report:16:in `map'
         6: from /home/bhipple/src/nix-review-tools/eval-report:16:in `block in <top (required)>'
         5: from /home/bhipple/src/nix-review-tools/lib/hydra/eval.rb:20:in `get'
         4: from /home/bhipple/src/nix-review-tools/lib/hydra/eval.rb:20:in `map'
         3: from /home/bhipple/src/nix-review-tools/lib/hydra/eval.rb:37:in `block in get'
         2: from /home/bhipple/src/nix-review-tools/lib/hydra/eval.rb:37:in `tap'
         1: from /home/bhipple/src/nix-review-tools/lib/hydra/eval.rb:39:in `block (2 levels) in get'
/home/bhipple/src/nix-review-tools/lib/hydra/build.rb:17:in `get': undefined method `next_element' for nil:NilClass (NoMethodError)

(After downloading a ton of build logs).

Two questions:

  1. Is this tool the right tool for the job I'm trying to solve or is there something better, and
  2. If it is the right tool, have you seen this error before? Am I doing something wrong?
jonringer commented 4 years ago

the most proper thing would probably be to bake this into hydra directly, but that would need some consensus with some of the more prominent Nix leaders

samueldr commented 4 years ago
 $ nix-shell
[...]

[nix-shell:~/.../nixos/review-tool]$ ./eval-report 1570625
Downloading https://hydra.nixos.org/eval/1570625?full=1...
[...]

From your non-shell-looking invocation I think that's the main issue.

Uh, the shebang is /usr/bin/env nix-shell with the appropriate stuff around... I guess the following comment is relevant here.

No, entering a nix-shell is not required.

samueldr commented 4 years ago

I just hit a similar error with a partial download. If that doesn't work still, evict that cached file, that will redownload.

jonringer commented 4 years ago

yea, i had to clear my cache as well :(

samueldr commented 4 years ago

~8 months ago I seemingly started working on... a deeper hydra... thing? I'm not sure what, but there's the feature/deeper-hydra branch.

I'm testing that it works, and will be merging in master.

This is relevant since I'm adding a couple more quality-of-life prints to help in these cases. Mainly, this will print which file it is parsing to evict only the problematic files.

bhipple commented 4 years ago

Sweeping forward your improvements to master sounds like a good idea regardless, but for what it's worth I ran git clean -ffdx on that branch and eventually (after a very long time downloading and parsing) ran into the same error. Which cache file(s) and dir(s) are you cleaning to get it to succeed?

Thanks for the help BTW.

samueldr commented 4 years ago

The cache is all in $PWD, it would be build_* and eval_*. Those are simply the HTML files downloaded at the moment. ./eval-report 1570625 finished successfully for me, so I figure something is not right with the HTML document.

samueldr commented 4 years ago

Just merged #4 on master.

If you pull, re-run this, it say Parsing build_XXX, that's the file that's "corrupted". At that point you can rm only that one, or inspect it to see what's up.

What's possible, but unlikely, is that it's looking for an element that's not in the HTML source. Though most likely is a half-finished download.

samueldr commented 4 years ago

Closing, as I think it's all resolved, especially with #5 solved. Don't hesitate to re-open and/or comment if I'm wrong.

bhipple commented 4 years ago

Works for me now with all the latest-and-greatest features from master. Thanks!