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

vars-based parallel tasks #1694

Closed
dakom opened this issue Jun 17, 2024 · 2 comments
Closed

vars-based parallel tasks #1694

dakom opened this issue Jun 17, 2024 · 2 comments

Comments

@dakom
Copy link

dakom commented Jun 17, 2024

if I understand correctly, the only way to have a task run different commands in parallel, and cleanly exit when the task is killed, is by using the deps feature

however, I have a variable with a list of entries:

vars:
  FOO:
    apple
    banana
    orange

I can loop over these (and I do that for other requirements), but that runs each task serially. Afaict the map feature doesn't help - since the whole point is I want it to automatically work as new entries are added - i.e. manually adding FOO.1, FOO.2 doesn't quite solve it

What I currently have to do - manually - is something like this, which of course doesn't scale as more items are added to FOO, and also breaks if any typos are introduced:

deps: [
  "internal-apple",
  "internal-banana",
  "internal-foo",
]

Would it be possible to have some sort of expansion of variables? e.g. something like:

deps: [
  "internal-{{expand .FOO}}",
  "keep-adding-more-deps-why-not"
]
@task-bot task-bot added the state: needs triage Waiting to be triaged by a maintainer. label Jun 17, 2024
@pd93
Copy link
Member

pd93 commented Jun 27, 2024

How about something like this?

version: 3

vars:
  FOO:
    - apple
    - banana
    - orange

tasks:
  default:
    deps:
      - for:
          var: FOO
        task: internal-{{.ITEM}}

  internal-apple:
    cmds:
      - echo "apple"

  internal-banana:
    cmds:
      - echo "banana"

  internal-orange:
    cmds:
      - echo "orange"

@pd93 pd93 added state: awaiting response Waiting for issue author to respond. and removed state: needs triage Waiting to be triaged by a maintainer. labels Jun 27, 2024
@pd93
Copy link
Member

pd93 commented Oct 29, 2024

No reply, closing

@pd93 pd93 closed this as completed Oct 29, 2024
@pd93 pd93 added type: question Further information is requested. and removed state: awaiting response Waiting for issue author to respond. labels Oct 29, 2024
@pd93 pd93 removed the type: question Further information is requested. label Dec 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants