Is there a way to limit the number of instances of...
# development
c
Is there a way to limit the number of instances of a rule or process that are running? The terraform provider cache might not be stable if there are multiple runs of
terraform init
running concurrently, and I'd like to try limiting the number of rules that run that command.
b
I’m guessing you mean more precisely than https://www.pantsbuild.org/stable/reference/global-options#process_execution_local_parallelism, where a rule specifically opts in to some sort of “concurrency group” for specific process invocations? If so, worst case (if pants doesn’t natively support it), rule code is arbitrary Python so one could likely manually implement something with file locks or similar. For instance, plop some carefully named file-lock files into a named cache (where the name might be a hash of the workspace path, or the terraform files or whatever makes sense?). I guess this might require thinking about timeouts and so on, though.