Open stianlagstad opened 1 month ago
Here's a change which will add two more test cases, leading to failures:
nixos/tests/nextflow.nix --- Nix
23 run-nextflow-pipeline = pkgs.writeShellApplication { 23 run-nextflow-pipeline = pkgs.writeShellApplication {
24 name = "run-nextflow-pipeline"; 24 name = "run-nextflow-pipeline";
25 runtimeInputs = [ pkgs.nextflow ]; 25 runtimeInputs = [ pkgs.nextflow ];
26 text = '' 26 text = ''
27 export NXF_OFFLINE=true 27 export NXF_OFFLINE=true
28 for b in false true; do 28 for b in false true; do
29 echo "docker.enabled = $b" > nextflow.config 29 for c in false true; do
.. 30 echo "docker.enabled = $b" > nextflow.config
30 cat nextflow.config 31 echo "trace.enabled = $c" > nextflow.config
.. 32 cat nextflow.config
31 nextflow run -ansi-log false ${hello} 33 nextflow run -ansi-log false ${hello}
.. 34 done
32 done 35 done
33 ''; 36 '';
34 }; 37 };
35 in 38 in
36 { 39 {
@stianlagstad Thank you for the detailed report. I vaguely remember that I had looked into the traced-scenario and that something was problematic but I must have lost attention. Sorry about that. I'll have a look into this.
@stianlagstad Thank you for the detailed report. I vaguely remember that I had looked into the traced-scenario and that something was problematic but I must have lost attention. Sorry about that. I'll have a look into this.
Please don't apologize! Thank you again for the good work in https://github.com/NixOS/nixpkgs/pull/339197 :100:
I'm trying myself to iterate on a modified postPatch
, but so far I have not been successful. I'm considering writing a PR for the nextflow repository instead, so that we can avoid the hardcoded /bin/bash
strings there.
Update: I've created an issue for this on the nextflow side: https://github.com/nextflow-io/nextflow/issues/5420
Ah, yes, me, too :) I have something working already see here but I'm not totally satisfied. I will iterate and then open a PR upstream.
Okay, I updated my nextflow-patch and also created a nixpkgs branch that uses this new version and doesn't need to patch anything anymore. You should be able to run it like so
❯ nix run github:rollf/nixpkgs/nextflow-trace#nextflow -- -version
N E X T F L O W
version 24.09.2-edge build 5927
created 14-10-2024 21:22 UTC (23:22 CEST)
cite doi:10.1038/nbt.3820
http://nextflow.io
(Mind that it's a newer version of nextflow).
Would be great if you could try this out.
I have adapted the NixOS-tests based on your suggestions (see here) and they pass.
If we're both satisfied, I'll open a PR upstream as well as for nixpkgs. Let's see whether we can get that integrated into upstream.
Thank you @rollf !
Do I understand this correctly?
/usr/bin/env
to see where bash is on the host, and also use it within the container to figure out where bash is thereIf I understand that correctly then there are some objections to this (using /usr/bin/env
) in the comments here:
I also pointed to those in my issue in the nextflow repo: https://github.com/nextflow-io/nextflow/issues/5420.
I can confirm however that your fix works for my use case.
Do I understand this correctly?
Yes.
If I understand that correctly then there are some objections to this (using
/usr/bin/env
) in the comments here:...
I also pointed to those in my issue in the nextflow repo: nextflow-io/nextflow#5420.
Yes, I had read those except the issue you raised, so thanks for pointing them out again. I still think what I propose is reasonable because a) it does keep /bin/bash
wherever possible (and certainly within container instances) and b) the patch set is really small.
I can confirm however that your fix works for my use case.
Okay, I'll open a PR upstream. If it does not get accepted, then we'll need to keep the patch within nixpkgs :shrug: .
@stianlagstad I have spent much more time now to improve both on the nextflow as well as on the Nixpkgs side and updated both branches / the upstream PR.
Describe the bug
I'm using
nextflow
, as packaged in https://github.com/NixOS/nixpkgs/pull/339197/, from the current unstable channel. This new packaging of nextflow has a patch to make sure the correct paths to bash is used depending on whether docker is enabled for the nextflow workflow run or not: https://github.com/NixOS/nixpkgs/blob/ccc0c2126893dd20963580b6478d1a10a4512185/pkgs/development/interpreters/nextflow/default.nix#L36-L45. I suspect that this patch does not do the correct thing if tracing is also enabled for the nextflow workflow run. When running with both docker and tracing enabled, I get this error:The problem is in the
.command.run
file, where not all occurrences of paths to bash is handled correctly by the postPath. When I enable tracing in addition to docker, then the command in.command.run
changes from this:to this:
The addition of
nxf_trace
at the end there takes the bash script into the functionnxf_trace_linux
(ornxf_trace_mac
is on mac), where there's a hardcoded path to the nix store-provided bash:This nix store-provided bash path should not be there as I enabled docker, but it remains, and causes the process to fail.
An additional occurrence of the nix store-provided bash path is present in the shebang of the
.command.sh
file, although it makes no difference to the result of the workflow run.Steps To Reproduce
Steps to reproduce the behavior:
Expected behavior
I expected the workflow run to succeed, and that the files
.command.run
and.command.sh
should have no occurrences of paths to the nix store.Screenshots
NA
Additional context
NA
Notify maintainers
@edmundmiller @Etjean @rollf
Metadata