-
Notifications
You must be signed in to change notification settings - Fork 27
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
Add stdout and stderr callback support (Work in progress) #74
Conversation
Lack of error on correct output could be something with bash -c actually. I'm not convinced about threads though, and to have them at the simple executor at that. |
@fizyk - should I work more on that or cancel PR? |
oh no, the general idea is great, just trying to wrap my head around it. First things first, we really hadn't thought about piping stderr's before. How about using poll objects? Similar to what we do in OutputExecutor? If I understand this correctly, by using polling we'd get the most recent data when we'd ask, but by using threads, we'd pass all ouptut to callbacks, right? |
Poll objects sounds good, I should check it before :-) |
OK, I looked at that more and I don't see how to use that without main loop. You used select.poll for waiting so in that moment you control the program flow. I could use the same method to make logs available for the executor user and he could retrieve them whenever he want, but this can cause buffer problems when output is bigger. Nice solution would be to fetch output regularly, but to do that thread, main loop, process or whatever else is needed. Please let me know if you see other way so solve this and what should I do with this code. |
@spinus thanks for analysis. Haven't actually thought of that. My first concern with current solution is OutputExecutor, threads might interfere with poll. Won't output will be either read by callback or by wait method? I see two possible solutions:
What's the actual use case you're pursuing? |
Use case is: setting callbacks can be done as properties as well, all other implementation stays the same. OutputExecutor can be tricky, sure. If we decide to implement that stuff I'll make sure OutputExecutor is working as expected. |
Okay, we used to check log files when we needed, but this approach is good as well. Question, will you need access to log files from start or from certain point? Let's add them as separate properties to be able to set at first, though thinking about that the whole process could be packaged into it's own class - kind of ProcessFactory - providing output either by poll, by thread callbacks (later gevent, coroutines for py35 (?), default factory will be packaging the basis as it is now, and it's subclasses will provide additional functionalities. But let's first get the thread callbacks working. |
1881a73
to
d040e1e
Compare
What do you think guys?
(there is still some issue with stderr but I'm not sure why, I'll look more at this)