-
Notifications
You must be signed in to change notification settings - Fork 166
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
Detached run and runs manager #682
Conversation
Actually, it happens with |
This is very exciting! I am going to test drive it a bit today :) Awesome! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is amazing! Without actually testing it (Im on Windows) this all looks pretty good to me. I did leave some comments but they are mostly related to the use of unwrap
/expect
and documentation.
I am trying to find the tricks that we used in Apparently we prefaced with I also think we are sending the |
- start documentation - intoduce SystemInfo for more efficient sysinfo usage
true => Ok(()), | ||
false => miette::bail!("Failed to kill process with pid '{}'.", pid.as_u32()), | ||
// First try to terminate the process with a SIGTERM signal | ||
Some(process) => match process.kill_with(sysinfo::Signal::Term) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just tried with your latest branch and it still doesn't kill jupyterlab for me. Maybe we need to send it to the child PID or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am done with the rest and will focus on kill now.
I tried quick with TERM and indeed it does not work (neither the examples/daemon/
by the way). But I wasn't expecting this to work.
I will try retrieving the child processes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I got it to work. It's simply about iterating over all the children and killing them as well.
It requires iterating over all the processes of the system, but it's working for both daemon
and jupyterlab
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can try with the latest commit of this branch.
I am done for the moment. Feel free to review. The killing logic works well after a few tests. I don't know how much this is bulletproof, but if it works for you, I suggest we proceed and wait for user's feedbacks if there are some edge cases. |
Hey @hadim I <3 this feature – back then I also implemented something like this in micromamba and I still think it's something of an easter egg! I think we're not 100% sure about the CLI design (e.g. should it be called I can already see this playing really well with a future "sandboxing" feature for a "docker-lite" (for example on Linux we can use namespaces for some process isolation, which would be very cool). I was always planning to test something like Lastly I'd like to send you some pixi / prefix swag! Very awesome PRs lately! 🚀 |
I went ahead without pinging anyone here, and I agree this API could be revisited.
Indeed, it's because daemonize is Unix-only. daemonize-me seems to support Windows, but I don't think this is enough and I, personally, think it's common for this kind of feature to be shipped for Unix-only machines and nothing prevents someone from implementing the Windows support in the future. That being said, I understand if you guys prefer to ship something feature-complete.
It looks nice - I guess it's a tradeoff between reinventing the wheel but making it also standalone, independent and 100%-pixi-fit versus reusing existing platform-dependent tools and services.
ahah thanks 🤗 All good here - I understand it's quite a large PR that also comes with a maintenance burden. I am happy to go wherever you want with that PR. Either hold, close, rethink the CLI entirely, etc. |
(the fail is due to |
Hey @hadim, I think this looks from a code perspective really good, the feature itself, the size of it and the possible maintenance this will take scares me a little to be honest. The fact that there is no solution in the close future to be run in Windows also doesn't feel that well to me. As we're putting our-selfs out there as a We've got some people that want to test it more thoroughly and show some more use cases. I would also like this to be tested in CI. I hope this explains why we are a little slow on working on this branch. |
No problem at all. It was fun coding and I understand your concerns. You are welcome to take over that PR. It's too bad that feature does not support Windows. I haven't really tried, but after looking a bit into it, I don't actually know how much feasible it is. |
Closing here as it's not really active anymore. Feel free to re-open as needed! |
This PR is an attempt to replace #386.
I worked on it without pinging first, and it's also quite a large PR, so if you don't have time to review currently, it's all good and no rush, please.
I extended the first implementation from #386 to add a full "runs manager" with the below features:
./pixi/runs/
. The structure is very flat but happy to make it more nested../pixi/runs/
.Important 1 : so far, I haven't been able to "stream" the logs and so those are only written to the stdout/stderr files whenever the run terminates (which is not super, super nice xD). I tried to dive into deno task and also pixi commit's history (looking at you
execute_with_pipes
) but without much success.Important 2: while this PR is large, it does not touch anything outside this particular and well scoped feature. That should make the reviewing and maintenance easier.
See below the current API.
Note: I added an example to facilitate the dev process. You can use
--manifest-path examples/daemon/pixi.toml
clear-all
) will remove the pid, logs and out/err files from the runs dir. It only works for terminated runs.