feat(tasks): allow `outputs` from pure `depends-on` tasks
Checks
-
[x] I have checked that this issue has not already been reported.
-
[x] I have confirmed this bug exists on the latest version of pixi, using
pixi --version.
Reproducible example
Commands I ran and their output:
[ribesr@io-login-01 fastqc_vs_falco]$ pixi run get_all_deciles
Error: × Unexpected keys, expected only 'cmd', 'depends-on', 'description', 'args'
╭─[/scratch/users/ribesr/fastqc_vs_falco/pixi.toml:25:1]
24 │ [tasks.get_all_deciles]
25 │ outputs = ["outputs/deciles1.tsv", "outputs/deciles2.tsv", "outputs/deciles3.tsv"]
· ───┬───
· ╰── 'outputs' was not expected here
26 │ depends-on = [
╰────
pixi.toml/pyproject.toml file that reproduces my issue:
[tasks._mkdir_outputs]
cmd = "mkdir -p outputs"
outputs = ["outputs"]
[tasks.get_deciles]
args = ["folder"]
depends-on = [ "_mkdir_outputs" ]
cmd = "python scripts/getdeciles.py -f {{ folder }}"
[tasks.get_all_deciles]
depends-on = [
{ task = "get_deciles", args = ["1"] },
{ task = "get_deciles", args = ["2"] },
{ task = "get_deciles", args = ["3"] },
]
outputs = ["outputs/deciles1.tsv", "outputs/deciles2.tsv", "outputs/deciles3.tsv"]
pixi info output:
[ribesr@io-login-01 fastqc_vs_falco]$ pixi info
System
------------
Pixi version: 0.63.2
TLS backend: rustls
Platform: linux-64
Virtual packages: __unix=0=0
: __linux=5.14.0=0
: __glibc=2.34=0
: __archspec=1=zen4
Cache dir: /home/ribesr/.cache/rattler/cache
Auth storage: /home/ribesr/.rattler/credentials.json
Config locations: No config files found
Global
------------
Bin dir: /home/ribesr/.pixi/bin
Environment dir: /home/ribesr/.pixi/envs
Manifest dir: /home/ribesr/.pixi/manifests/pixi-global.toml
Other files (e.g. script files, source files, etc.):
You can replace cmd = "python scripts/getdeciles.py -f {{ folder }}" in get_deciles by cmd = "echo "Hello world !" > {{ folder }}" to test it more easily.
Issue description
I first thought it was because I didn't have the field inputs but _mkdir_outputs works without it...
Expected behavior
It is supposed to just run, you can put the outputs field in a task but here it tells me that I can only put cmd, depends-on, description, args
Hi @RaphaelRibes , Can I be assigned this issue to work on.
Thanks
Hi @RaphaelRibes , Can I be assigned this issue to work on.
Thanks
Yes, no problem.
Hi @RaphaelRibes , Can I be assigned this issue to work on. Thanks
Yes, no problem.
Thanks @RaphaelRibes
would this work for you @RaphaelRibes ?
[tasks._mkdir_outputs]
cmd = "mkdir -p outputs"
outputs = ["outputs"]
[tasks.get_deciles]
args = ["folder"]
depends-on = [ "_mkdir_outputs" ]
cmd = "python scripts/getdeciles.py -f {{ folder }}"
outputs = ["outputs/deciles{{ folder }}.tsv"]
[tasks.get_all_deciles]
depends-on = [
{ task = "get_deciles", args = ["1"] },
{ task = "get_deciles", args = ["2"] },
{ task = "get_deciles", args = ["3"] },
]
Not sure if templating is impossible within the outputs field, if so this would be an enhancement request.
The core of the error here is that outputs expects to have a cmd field present.
would this work for you @RaphaelRibes ?
[tasks._mkdir_outputs] cmd = "mkdir -p outputs" outputs = ["outputs"]
[tasks.get_deciles] args = ["folder"] depends-on = [ "_mkdir_outputs" ] cmd = "python scripts/getdeciles.py -f {{ folder }}" outputs = ["outputs/deciles{{ folder }}.tsv"]
[tasks.get_all_deciles] depends-on = [ { task = "get_deciles", args = ["1"] }, { task = "get_deciles", args = ["2"] }, { task = "get_deciles", args = ["3"] }, ] Not sure if templating is impossible within the
outputsfield, if so this would be an enhancement request.The core of the error here is that
outputsexpects to have acmdfield present.
Hi @lucascolley , thanks for the above, I asked to be assigned to this issue and I am working on it.
Hi @Joiejoie1, speaking as a Pixi maintainer, please understand that we do not assign issues to new contributors such that they are 'claimed' and others are blocked from working on those issues.
What exactly are you working on? Feel free to brainstorm ideas in the open.
would this work for you @RaphaelRibes ?
[tasks._mkdir_outputs] cmd = "mkdir -p outputs" outputs = ["outputs"] [tasks.get_deciles] args = ["folder"] depends-on = [ "_mkdir_outputs" ] cmd = "python scripts/getdeciles.py -f {{ folder }}" outputs = ["outputs/deciles{{ folder }}.tsv"] [tasks.get_all_deciles] depends-on = [ { task = "get_deciles", args = ["1"] }, { task = "get_deciles", args = ["2"] }, { task = "get_deciles", args = ["3"] }, ]Not sure if templating is impossible within the
outputsfield, if so this would be an enhancement request.The core of the error here is that
outputsexpects to have acmdfield present.
Hello ! Thank you for taking your time checking this. This is the solution I implemented because it's just better logics. However, even if it's garbage code, the exemple in the issue should work.
So my problem is solved but not the one on pixi side.
So my problem is solved but not the one on pixi side.
I edited the title appropriately
@Joiejoie1 Have you been able to make progress on this?
@Joiejoie1 Have you been able to make progress on this?
Hi @baszalmstra , thanks for checking , I have been working on this issue, however, I thought you guys were performing some maintainers work on it . I'll create a PR for it. Thanks
I will reopen this really quickly, I found the issue.
A task with a cmd field cannot have neither inputs or outputs.
Example, this will not work:
[tasks.dedup-both]
depends-on = [
{ task = "dedup", args = ["data/final_simulated_R1.fastq","data/dedup_R1.fastq"] },
{ task = "dedup", args = ["data/final_simulated_R2.fastq","data/dedup_R2.fastq"] }
]
inputs = ["data/final_simulated_R1.fastq", "data/final_simulated_R2.fastq"]
outputs = ["data/dedup_R1.fastq", "data/dedup_R2.fastq"]
Error: × Unexpected keys, expected only 'cmd', 'depends-on', 'description', 'args'
╭─[/home/raphael/Desktop/TMP/fdedup/pixi.toml:33:1]
32 │ ]
33 │ inputs = ["data/final_simulated_R1.fastq", "data/final_simulated_R2.fastq"]
· ───┬──
· ╰── 'inputs' was not expected here
34 │ outputs = ["data/dedup_R1.fastq", "data/dedup_R2.fastq"]
· ───┬───
· ╰── 'outputs' was not expected here
35 │
╰────
Where this will:
[tasks.dedup-both]
cmd = "echo ''"
depends-on = [
{ task = "dedup", args = ["data/final_simulated_R1.fastq","data/dedup_R1.fastq"] },
{ task = "dedup", args = ["data/final_simulated_R2.fastq","data/dedup_R2.fastq"] }
]
inputs = ["data/final_simulated_R1.fastq", "data/final_simulated_R2.fastq"]
outputs = ["data/dedup_R1.fastq", "data/dedup_R2.fastq"]
would this work for you @RaphaelRibes ?
[tasks._mkdir_outputs] cmd = "mkdir -p outputs" outputs = ["outputs"] [tasks.get_deciles] args = ["folder"] depends-on = [ "_mkdir_outputs" ] cmd = "python scripts/getdeciles.py -f {{ folder }}" outputs = ["outputs/deciles{{ folder }}.tsv"] [tasks.get_all_deciles] depends-on = [ { task = "get_deciles", args = ["1"] }, { task = "get_deciles", args = ["2"] }, { task = "get_deciles", args = ["3"] }, ]Not sure if templating is impossible within the
outputsfield, if so this would be an enhancement request.The core of the error here is that
outputsexpects to have acmdfield present.
Yeah that's what I meant up here