-
Notifications
You must be signed in to change notification settings - Fork 51
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
Issue1331: libsubprocess redesign #1564
Conversation
pushed a commit with local channel fd support, not the cleanest I would have liked the code to be, but not bad. I'll bring up a design issue in issue #1331 for discussion. |
this push completes (I think) all "local" libsubprocess work. Now all stdin, stdout, stderr, and "channel" support is basically the same. All use the |
Nice! I kind of like that result. |
Just pushed a tree with initial implementation of subprocess with a A few notes:
|
just re-pushed with the commits split up a bit |
Pushed a new branch with more tests and a few bug fixes. Also elected to change RUNNING_FAILED to just FAILED, as a catch all for all internal errors that aren't really in a user's control (ENOMEM, EPROTO, etc.). Next step is to replace |
This is the mostly completed subprocess work, with code converted to use the new flux subprocess library globally, and all old usage removed. Some minor highlights:
In some later commits, or perhaps a cleanup in another PR, I'd like to try and cleanup/refactor some code surrounding my conversions from the old libsubprocess to the new one. There are many tiny things (such as using I have not yet removed the old libsubprocess library, b/c some code still uses zio. Should we move zio somewhere else? Or should we convert lingering zio code to buffer reactors? |
1bf646d
to
306d93e
Compare
Made a change where I mainly did this b/c I'm trying to figure out one lonely error in travis.
consistently fails on travis but not on catalyst. For some reason, when the subprocess (here |
@chu11, any other updates pending here, or is this ready to be merged? I think any other minor cleanups or changes could go in as future PRs. Any major changes to API or anything like that should probably go in this PR before the first version is merged (I just couldn't remember where we were on this one) |
Oh, I was intending to fixup some of the bigger items mentioned above. But if you're ok doing it in future PRs, how about I fixup the smaller nits you mention above. Then I'll create tickets for the bigger items you mention and re-push. |
Add support for a new flux subprocess API that merges both local subprocess support (in the old "libsubprocess") and remote subprocess support and remote subprocess server support. Support a new cmd API to encapsulate the commands that callers wish to launch in subprocces. By Albert Chu and Mark Grondona
Add support of the new "exec2" module, which is similar to the old "exec" module but uses the new flux subprocess library. This module will be used for transition and eventually be renamed to "exec".
Add unit tests to test the flux subprocess library's remote execution.
Convert to use cmb.exec2 service via the new flux subprocess library, instead of using the cmb.exec service.
Convert to use cmb.exec2 service via the new flux subprocess library, instead of using the cmb.exec service.
Original tool was developed primarily for testing. For new cmb.exec2 broker, a test specific ps tool was developed.
Replace flux-exec command with a new flux-exec command based on the new subprocess library.
Adjust all instances of "exec2" and replace with "exec" appropriately.
Convert runlevel to launch local subprocesses via the new subprocess library. Remove lingering uses of libsubprocess in main broker as well.
Just pushed a mergeable tree, fixing a few of the nits that @grondo noticed above. They were so minor I just went ahead and squashed all the changes. The five remaining mini-big future fixes are:
|
hmmm, missed the diff target this time around, just a bit though. Maybe hit an unlucky set of racy bits. |
Yeah, uncovered parts of the diff are 99% error handling. The only thing that stuck out to me is that FLUX_SUBPROCESS_FAILED case didn't seem to be covered in |
One thing I noticed when reading through the diff again is that the return code of -1 for Also, there are 4 places in the code where 128 is added to the exit code (with a reference to why in the comments, nice!) when a process is signaled, which makes me wonder if the old Otherwise, this looks good to merge, I'll press the button in the morning. |
Good point. I wanted to remove the +128 b/c that is a "style" choice on returning a status, but you are correct I'm repeating its use. I'll put that on the ponder list. |
Ok, merging. Thanks for this huge effort! |
WOO! Nice work @chu11! 🎉 |
A checkpoint of where I'm at on #1331, didn't want to continue too far ahead without atleast some comment.
only have done the "local" support so far, except the channel fd stuff, mostly wanted to concentrate on the subprocess i/o, state changes, and unit tests
I decided to require the user to specify a stdout/stderr callback all the time. Most of the time users will probably just use the provided
flux_subprocess_output
. If they don't specify anything, there will be no stdout/stderr.I sort of dislike that the stdio callbacks have a
int stream
argument. But I couldn't think of anything better.A couple of commits to allow a flag so all
flux_buffer_t
reads & peeks to be NUL terminated. Just sort of convenient.you'll notice a
test_echo
utility test tool. I got tired of trying to figure out the best way to do some unit tests w/ just tools in/bin
and just caved and wrote something simple.@grondo no changes to your initial
command
work.