-
Notifications
You must be signed in to change notification settings - Fork 137
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
Extend pueue wait
to wait for specific Done result states.
#434
Comments
Sorry for any inconveniences this behavior has caused 😅 I like the option to exit with The thing is, that this seems to be used in non user-facing scripts quite a bit, where an endlessly waiting process might cause some problems. |
Which is what the Anyway, I'm open to exiting with a non-zero status being the default on dependency failure, we can always see if others think there should be a 'wait foreever' option. For my usecase, I could just use a while loop; in untested psuedo-bash: while !pueue wait ...; do
echo 'Please check for failures and restart task(s) as necessary'
sleep 5
done
# do the thing that needed waiting |
I just noticed, that my previous answer was a bit unclear and a lot of what I actually wanted to say got lost in translation. I rephrased it to hopefully better reflect my thought process^^. I'll also go into detail below. The purpose of I had two main concerns:
Intuitively, I would say that the I'm generally in favor of a I got one more question: |
I actually was envisioning that an additional switch was added that lets you select what result states to wait for; if not given then the current behaviour (any result state is okay) would be the default. E.g. And yes, you are correct, the loop will fail right now, but in a scenario where Dependencies don't always work, not when I am waiting for a whole group, where I am not sure up front how many tasks will be added. I'm not mostly using groups, but when I do dependencies don't work. |
I just realised that I could have a dedicated dependent dummy tasks group, say Still, that's a bit tedious and feels like a hack. |
Ah, except, that doesn't work either, because dependent tasks are moved to |
Ok. So the plan would be to
I like that. It's straight forward and backward compatible. I'm not sure yet, if we should add a new parameter ( Waiting for Failure?I thought about adding the same thing for |
Yes, I can't see a good use case to wait for a specific error result either. And that then leaves just the one result option, at which point it does make sense to just add |
I implemented and tested the behavior in the linked PR :) I'll be gone for a few days, but I'm planning to release a new version next week Monday/Tuesday. |
A detailed description of the feature you would like to see added.
When waiting for tasks with
pueue wait
, the command exits when the tasks reach the Done state (by default). However, Done tasks have a result state, one of:pueue wait
exits with 0 for any of these states.There should be an option to either continue waiting on a task and / or exit with a non-zero exit code, when the waited-upon task(s) reach
Done
but their result state is not Success (default) or a configurable set of result states.Explain your usecase of the requested feature
I wanted to run a command once all tasks were done, a command that opens a (text-based) console that lets you monitor its state, and so it wasn't really as suited for running under pueue.
However, some of the tasks failed, the command ran anyway, and I had to clean up the fallout as it moved things around that were not ready to be moved.
Had
pueue wait
exited with an error code or simply waited until I manually had restarted the failed tasks, it would have been a lot better here. A non-zero exit would have exited my setup (I usedpueue wait ... && next-command
), for example.Alternatives
I could have used
pueue add --after [taskids] [dependent command]
but that can't wait for a whole group to complete and requires that[dependent command]
is suitable to be controlled by pueue.I also could have set the daemon
pause_group_on_failure
configuration option, but that'd have paused the group, which I don't really want; the other commands in the group can complete successfully even if one of the tasks fails, and pausing delays things considerably as I now have to wait on the paused tasks when I am recovering the failed tasks, too.Right now, the only option I see is to create a dummy task that depends on the specific task ids, and have pueue wait for that command to complete. Pueue will not start a dependent task unless all dependencies have reached a
Done(Succes)
state. This works as long as you don't add more tasks to the group (there is no way to edit a task to add more dependencies).Additional context
I'd pefer to have
pueue wait
wait when tasks are done but were not successful, but I can definitely also see the case for exiting with a non-zero state. Perhaps both should be an option?The text was updated successfully, but these errors were encountered: