-
-
Notifications
You must be signed in to change notification settings - Fork 304
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
Use nix-eval-jobs
and delete hydra-eval-jobs
#1421
base: master
Are you sure you want to change the base?
Conversation
"--flake", $flakeRef, | ||
"--gc-roots-dir", getGCRootsDir, | ||
"--max-jobs", 1); | ||
@cmd = ("nix-eval-jobs", "--flake", $flakeRef . '#hydraJobs'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uses hydraJobs
here and the original hydra-eval-jobs
has hydraJobs
and checks
:
hydra/src/hydra-eval-jobs/hydra-eval-jobs.cc
Lines 148 to 152 in f974891
auto aHydraJobs = vOutputs->attrs()->get(state.symbols.create("hydraJobs")); | |
if (!aHydraJobs) | |
aHydraJobs = vOutputs->attrs()->get(state.symbols.create("checks")); | |
if (!aHydraJobs) | |
throw Error("flake '%s' does not provide any Hydra jobs or checks", flakeRef); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah found more commits that are relevant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Lix commits don't address this issue, they only have support for hydraJobs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be important to keep the checks
supports
I left a comment on nix-community/nix-eval-jobs#330, I think that is causing the failure. CC @Mic92. |
nix-community/nix-eval-jobs#336 this I thought would help but is not sufficient hmm |
ah |
A relevant thing to consider here is whether we want an official NixOS project to be dependant on a Nix Community project. As of now (afaik), the NixOS GitHub namespace is mostly self-contained. I see these solutions:
I personally prefer the latter two options over the first one since it would get rid of code duplication and remove a component from Hydra that only a few people are proficient in and that gets a lot less maintenance than nix-eval-jobs. Maybe that's a question for the new SC? |
Happy to move the project to the NixOS org if I can keep maintaining it there. We would loose aarch64-linux builds because those runners are currently sponsored by namespace in nix-community. I can attach my buildbot-nix installation to this org to compensate. |
That's more a technical question for the Hydra/Nix team, unless we feel to overwhelmed what to do and need to escalate. |
498b283
to
d0cfbed
Compare
OK it builds now (CI should say so in a moment). |
Keeping draft just until nix-community/nix-eval-jobs#337 is merged. |
d0cfbed
to
8a49ecb
Compare
OK undrafting because we're back on @dasJ I am fine resolving the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The perl bits look generally ok to me but not my expertise. Maybe put somewhere a bit clearer that the constituents are not supported anymore. That's not used on hydra.nixos.org, right?
foreach my $drvPath (@{$job->{constituents}}) { | ||
my $constituent = $drvPathToId{$drvPath}; | ||
if (defined $constituent) { | ||
$db->resultset('AggregateConstituents')->update_or_create({aggregate => $x->{id}, constituent => $constituent->{id}}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Ericson2314 are we depending on this in hydra.nixos.org?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this feature actually about?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the commit message we are not.
But good monitoring this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find the statement that we weren't using consituents surprising, nixpkgs uses it in both code and documentation:
doc/preface.chapter.md:[this table](https://hydra.nixos.org/job/nixpkgs/trunk/unstable#tabs-constituents)
lib/customisation.nix: constituents = map hydraJob (flatten drv.constituents);
nixos/doc/manual/release-notes/rl-2305.section.md:- Deprecated `xlibsWrapper` transitional package has been removed in favour of direct use of its constituents: `xorg.libX11`, `freetype` and others.
nixos/release-combined.nix: constituents = pkgs.lib.concatLists [
nixos/release-small.nix: constituents = lib.flatten [
pkgs/build-support/release/default.nix: { name, constituents, meta ? { } }:
pkgs/build-support/release/default.nix: { inherit constituents meta;
pkgs/build-support/release/default.nix: echo $constituents > $out/nix-support/hydra-aggregate-constituents
pkgs/build-support/release/default.nix: for i in $constituents; do
pkgs/build-support/release/default.nix: - constituents: a list of derivations on which the channel success depends.
pkgs/build-support/release/default.nix: constituents = [ foo bar baz ];
pkgs/build-support/release/default.nix: { name, src, constituents ? [], meta ? {}, isNixOS ? true, ... }@args:
pkgs/build-support/release/default.nix: echo $constituents > "$out/nix-support/hydra-aggregate-constituents"
pkgs/build-support/release/default.nix: for i in $constituents; do
pkgs/build-support/rust/build-rust-crate/test/default.nix: constituents = builtins.attrValues tests;
pkgs/top-level/release-haskell.nix: # to `releaseTools.aggregate` as constituents.
pkgs/top-level/release-haskell.nix: constituents =
pkgs/top-level/release-haskell.nix: constituents = accumulateDerivations
pkgs/top-level/release-haskell.nix: constituents = accumulateDerivations [
pkgs/top-level/release-haskell.nix: constituents = accumulateDerivations [
pkgs/top-level/release.nix: constituents = [
pkgs/top-level/release.nix: constituents =
pkgs/top-level/release-python.nix: constituents = [
README.md:* [Tests for unstable/master](https://hydra.nixos.org/job/nixos/trunk-combined/tested#tabs-constituents)
README.md:* [Tests for the NixOS 24.05 release](https://hydra.nixos.org/job/nixos/release-24.05/tested#tabs-constituents)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds like a blocking issue to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nix-community/nix-eval-jobs@a4441fe This is the commit we'd need to revert of nix-eval-jobs
, I guess. Hmm...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, so there are multiple types of constituent jobs. I am now less sure that we are still using this type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As stated before, I do find this move to be a good idea. Here are some things I noticed while reading the code
@@ -8,14 +8,20 @@ | |||
inputs.nix.inputs.nixpkgs.follows = "nixpkgs"; | |||
inputs.nix.inputs.libgit2.follows = "libgit2"; | |||
|
|||
inputs.nix-eval-jobs.url = "github:nix-community/nix-eval-jobs"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we somehow get that rev into the footer in src/root/layout.tt
? I'm thinking something like Hydra 1.0 (using nix-eval-jobs abcdef and nix-2.18)
"--flake", $flakeRef, | ||
"--gc-roots-dir", getGCRootsDir, | ||
"--max-jobs", 1); | ||
@cmd = ("nix-eval-jobs", "--flake", $flakeRef . '#hydraJobs'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be important to keep the checks
supports
push @cmd, "--no-allow-import-from-derivation" if $config->{allow_import_from_derivation} // "true" ne "true"; | ||
push @cmd, ("--gc-roots-dir", getGCRootsDir); | ||
push @cmd, ("--max-jobs", 1); | ||
push @cmd, "--meta"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wills there two parameters change anything relevant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$ git log -G --max-memory-size
commit 4b107e6ff36bd89958fba36e0fe0340903e7cd13
Author: Pierre Bourdon <[email protected]>
Date: Mon Jul 22 23:16:29 2024 +0200
hydra-eval-jobset: pass --workers and --max-memory-size to n-e-j
Lost in the h-e-j -> n-e-j migration, causing evaluation to always be
single threaded and limited to 4GiB RAM. Follow the config settings like
h-e-j used to do (via C++ code).
commit 6f1d68bda483b2ed3b1c1f0a696e8fe300108853
Author: Eelco Dolstra <[email protected]>
Date: Wed Feb 19 20:36:52 2020 +0100
Revert "hydra-eval-jobs -> nix eval-hydra-jobs"
This reverts commit 345512a6d0743eaac9d451833ecc1a71d12809c9.
commit 345512a6d0743eaac9d451833ecc1a71d12809c9
Author: Eelco Dolstra <[email protected]>
Date: Sat Feb 15 00:03:58 2020 +0100
hydra-eval-jobs -> nix eval-hydra-jobs
It's purpose seems to be to change a setting that hydra-eval-jobs
was changing programmatically before.
print STDERR "$stderr"; | ||
if (defined $err) { | ||
print STDERR "$err"; | ||
undef $err; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about the API, but is it a good idea to undef this? Maybe set it to an emtpy string instead? Feels like that would die horribly if the process decides to do stdout, then stderr, then stdout again. Not sure why it would, but better safe than sorry
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think every loop it will define them if they need to exists. Perl is weird! Why can't they just return a tuple!
@@ -709,36 +744,20 @@ sub checkJobsetWrapped { | |||
return; | |||
} | |||
|
|||
die "Jobset contains a job with an empty name. Make sure the jobset evaluates to an attrset of jobs.\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a relevant check? Kind of surprising to see it gone
foreach my $drvPath (@{$job->{constituents}}) { | ||
my $constituent = $drvPathToId{$drvPath}; | ||
if (defined $constituent) { | ||
$db->resultset('AggregateConstituents')->update_or_create({aggregate => $x->{id}, constituent => $constituent->{id}}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find the statement that we weren't using consituents surprising, nixpkgs uses it in both code and documentation:
doc/preface.chapter.md:[this table](https://hydra.nixos.org/job/nixpkgs/trunk/unstable#tabs-constituents)
lib/customisation.nix: constituents = map hydraJob (flatten drv.constituents);
nixos/doc/manual/release-notes/rl-2305.section.md:- Deprecated `xlibsWrapper` transitional package has been removed in favour of direct use of its constituents: `xorg.libX11`, `freetype` and others.
nixos/release-combined.nix: constituents = pkgs.lib.concatLists [
nixos/release-small.nix: constituents = lib.flatten [
pkgs/build-support/release/default.nix: { name, constituents, meta ? { } }:
pkgs/build-support/release/default.nix: { inherit constituents meta;
pkgs/build-support/release/default.nix: echo $constituents > $out/nix-support/hydra-aggregate-constituents
pkgs/build-support/release/default.nix: for i in $constituents; do
pkgs/build-support/release/default.nix: - constituents: a list of derivations on which the channel success depends.
pkgs/build-support/release/default.nix: constituents = [ foo bar baz ];
pkgs/build-support/release/default.nix: { name, src, constituents ? [], meta ? {}, isNixOS ? true, ... }@args:
pkgs/build-support/release/default.nix: echo $constituents > "$out/nix-support/hydra-aggregate-constituents"
pkgs/build-support/release/default.nix: for i in $constituents; do
pkgs/build-support/rust/build-rust-crate/test/default.nix: constituents = builtins.attrValues tests;
pkgs/top-level/release-haskell.nix: # to `releaseTools.aggregate` as constituents.
pkgs/top-level/release-haskell.nix: constituents =
pkgs/top-level/release-haskell.nix: constituents = accumulateDerivations
pkgs/top-level/release-haskell.nix: constituents = accumulateDerivations [
pkgs/top-level/release-haskell.nix: constituents = accumulateDerivations [
pkgs/top-level/release.nix: constituents = [
pkgs/top-level/release.nix: constituents =
pkgs/top-level/release-python.nix: constituents = [
README.md:* [Tests for unstable/master](https://hydra.nixos.org/job/nixos/trunk-combined/tested#tabs-constituents)
README.md:* [Tests for the NixOS 24.05 release](https://hydra.nixos.org/job/nixos/release-24.05/tested#tabs-constituents)
@@ -8,14 +8,20 @@ | |||
inputs.nix.inputs.nixpkgs.follows = "nixpkgs"; | |||
inputs.nix.inputs.libgit2.follows = "libgit2"; | |||
|
|||
inputs.nix-eval-jobs.url = "github:nix-community/nix-eval-jobs"; | |||
inputs.nix-eval-jobs.inputs.nixpkgs.follows = "nixpkgs"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something I forgot in the last review: I think we should also force the nix version of hydra into the package, otherwise we might depend on 2 nix versions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's actually a good one and could be a problem if hydra or nix-eval-jobs doesn't keep up with nix releases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can maintain release branches for different nix versions again if this is needed.
Thanks for this good review, both of you. In light of these things. I am going to try to flip the order: re-draft this, and get Mesonification done first. |
Original commit message: > There are some known regressions regarding local testing setups - since > everything was kinda half written with the expectation that build dir = > source dir (which should not be true anymore). But everything builds and > the test suite runs fine, after several hours spent debugging random > crashes in libpqxx with MALLOC_PERTURB_... I have not experienced regressions with local testing. (cherry picked from commit 4b886d9)
(cherry picked from commit 684cc50)
(cherry picked from commit 6d4ccff)
(cherry picked from commit ed7c587)
8a49ecb
to
a3e3fe9
Compare
nix-eval-jobs streams output, unlike hydra-eval-jobs. Now that we've migrated, we can use this to: 1. Use less RAM by avoiding buffering a whole eval's worth of metadata into a Perl string and an array of JSON objects. 2. Make evals latency a bit lower by allowing the queue runner to start ingesting builds faster. (cherry picked from commit b0e9b4b)
Lost in the h-e-j -> n-e-j migration, causing evaluation to always be single threaded and limited to 4GiB RAM. Follow the config settings like h-e-j used to do (via C++ code). (cherry picked from commit 4b107e6)
The feature cannot easily be ported to nix-eval-jobs since it requires deep integration into the evaluator, and h.n.o doesn't use it. Later more of this will be ripped out. (cherry picked from commit 370a4bf)
a3e3fe9
to
d2227af
Compare
nix-eval-jobs
was forked fromhydra-eval-jobs
originally, for others to use. That's great! But maintaining two copies is no good. But we use that.Original author is @delroth, for Lix's Hydra, thank you!
Draft because some tests fail. I am not sure why. Maybe there are fixes on the Lix branch that can be cherry-picked to fix? Not sure!