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

Add Async Feature #2740

Closed
ProfessorManhattan opened this issue Feb 5, 2023 · 3 comments
Closed

Add Async Feature #2740

ProfessorManhattan opened this issue Feb 5, 2023 · 3 comments
Labels
enhancement New feature or request won't fix This will not be worked on

Comments

@ProfessorManhattan
Copy link

Hey, I asked about this before but I'd like to be able to run scripts asynchronously. I think this could be accomplished in a backwards-compatible way. We could introduce the async-#_ attribute. It could run all the files that have async-14_ in the filename at the same time. I don't mind hiring a Go developer to add this but I was hoping to get into the main branch for the trustworthiness factor. Any thoughts?

@ProfessorManhattan ProfessorManhattan added the enhancement New feature or request label Feb 5, 2023
@halostatue
Copy link
Collaborator

I’m not entirely sure that async scripts would be a good idea as a core feature.

However, it is possible to get parallelization in a bash script itself:

#! /usr/bin/env bash

run() {
  sleep "$1"
  echo "$2"
}

run 3 1 &
run 2 2 &
run 1 3 &

wait

@twpayne
Copy link
Owner

twpayne commented Feb 5, 2023

I am also opposed to async scripts in core chezmoi. Asynchronous programming is particularly hard, especially when there is shared global state involved. In the case of chezmoi, the shared global state is the entirety of local machine and some remote servers.

It is not a question of implementation effort. I cannot see a situation under which a PR implementing asynchronous scripts would be accepted. @halostatue gives a practical solution for controlled asynchronicity.

@twpayne twpayne closed this as not planned Won't fix, can't repro, duplicate, stale Feb 5, 2023
@twpayne twpayne added the won't fix This will not be worked on label Feb 5, 2023
@twpayne
Copy link
Owner

twpayne commented Feb 8, 2023

Note that chezmoi already reads the source directory concurrently (#1851), and downloading externals concurrently is on the roadmap for v3 (#2673, #2670).

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request won't fix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants