Skip to content
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

Using wurlitzer to capture and log stdout/stderr from libdrmaa #69

Open
jakirkham opened this issue Jun 30, 2018 · 3 comments
Open

Using wurlitzer to capture and log stdout/stderr from libdrmaa #69

jakirkham opened this issue Jun 30, 2018 · 3 comments

Comments

@jakirkham
Copy link
Contributor

Some DRMAA implementations print information to stdout/stderr. While this information can be useful, having it print to stderr or stdout can be disruptive (e.g. launching jobs with DRMAA in an IPython terminal session) as it will get mingled with other information. It would be ideal to capture this stdout/stderr and instead redirect to somewhere like a Python log, which users can redirect as they see fit.

The main trick is capturing the C-level stdout/stderr pipes and redirecting them to something else that can used with logging. Note that working with sys.stdout/sys.stdout in Python will not address this. For a good explanation of why, please read this blog post by Eli Bendersky. Fortunately a lot of work has already been done on this and there now exists a package, wurlitzer, that handles this redirection logic for us. So it would be good if we could use this to redirect stdout/stderr from libdrmaa to a logger (possibly using StringIO as an intermediary).

@desilinguist
Copy link
Contributor

Seems like a great idea to me.

@jakirkham
Copy link
Contributor Author

Alright I’ll write up a PR.

@jakirkham
Copy link
Contributor Author

Working on it in PR ( #70 ).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants