Comments (10)
Confirmed that a wait does stop this going wrong (it just means I don't get to see the output whenever the race hits).
from pueue.
Thanks for reaching out!
I thought pueue follow would wait until a task started and follow its output until it completed. Instead, I'd guess that what's happening is that we're racing on the daemon: the task hasn't quite started yet and pueue follow fails, and then the pueue status jq invocation fails because the task status isn't Done (I could make it more robust but jq's syntax is so horrific and ill-documented that I can't face it). Stranger yet, sometimes it works fine, but pueue status then complains that it can't find the logfile which pueue follow was just happily following for days.
I think you're right about follow
failing because the task hasn't started yet.
The daemon is running asynchronously, as it needs to manage tasks and check if there're any free slots. Tasks are enqueued every ~200ms, which is why this sometimes works and sometimes fails.
However, there's an easy fix for this. Pueue has never been designed to be scrictable, it just received a few convenience commands and helpers which allow it to be (somewhat) scriptable.
One of those helpers is the pueue wait
command, which waits for either all tasks, a group, or a set of tasks to finish.
In your case, you could replace the pueue follow
with pueue wait
and you should be good to go.
from pueue.
Yeah, that'll fix it I hope (testing initiated, may be a day or so before I know one way or the other). The ideal would be a bit different though.
I'm also trying to display the output of the command as I go (since it's handbrake: it takes hours and does display useful progress output). Something like pueue wait --follow or (more generally) pueue wait --until STATE (which waits until the task switches state to STATE) or just pueue wait --until-changed (which returns whenever the task changes state at all) would be ideal: I could follow that with a pueue follow in the certainty that it would actually work. pueue wait --until-follow-will-work-dammit is what I'm after, but that sounds a bit... specific.
(I'm surprised how useful it is in scripts actually -- mostly for squashing serial things running in high-parallelism queues down into parallel things in low-parallelism queues :) )
from pueue.
I think pueue wait --state $STATE
seems like the best solution for this.
That's basically the same thing the integration test suite does.
from pueue.
Oh if the test suite is already doing something just like this, so much the better! Proof it's useful :)
from pueue.
Hey @nickalcock
I implemented the feature in the linked pull request.
Could you check out, if this works for you :)?
git clone [email protected]:Nukesor/pueue
cd pueue
git switch wait-for-status
cargo install --path ./pueue
from pueue.
Finally got around to testing this, a bit late since it hit the master branch long ago. Seems to work, and lets me replace a lot of not-really-working kludgery with something much simpler ("pueue wait --status running").
It is a little odd that the status in the pueue output reads 'Running' but that you have to wait for 'running': waiting for 'Running' fails...
from pueue.
I'm confused. What do you mean with 'waiting for Running fails' in your last sentence?
When I'm running this I get this output:
[nuke:~] 130! pueue wait --status running 1
18:21:44 - Task 1 changed from Stashed to Queued
18:21:52 - Task 1 changed from Queued to Running
from pueue.
Oh yes, that works fine -- what's odd is that you can't say pueue wait --status Running
, even though the status is given with a capitalized first letter in the status output. (Probably both should be accepted?)
from pueue.
Ahh.
Fixed :). Pueue will allow capitalized stati with the next release.
from pueue.
Related Issues (20)
- [BUG] Minor: missing newline after status output HOT 5
- Scheduling parameters HOT 2
- [BUG] errors with non-UTF-8 task logs HOT 3
- [Bug] pueued being flagged as Trojan:Win32/Bearfoos.B!ml by Windows Defender HOT 7
- Include sha256 and/or md5 hashes for binary releases HOT 2
- Multi-user Question HOT 5
- send ctrl c to task HOT 1
- error loading completion HOT 2
- [Feature] Add priority to tasks HOT 19
- Enable to remove all groups HOT 6
- [Feature] Add `pueue group --json` flag HOT 2
- Extend `pueue wait` to wait for specific Done result states. HOT 9
- Make pueue be able to create pty by request HOT 3
- Improve `pueue follow` behaviour with a task that does not yet have logs HOT 2
- `pueue status` --query should support filtering tasks by ID HOT 7
- Terminal escape sequences with `follow` HOT 2
- [Bug] pueue 3.1.2 fails to build with rust 1.70 HOT 2
- How to exit `follow` without shutting down the daemon HOT 6
- Release .deb HOT 4
- Support Editing Priority HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pueue.