Skip to content
This repository has been archived by the owner on May 29, 2022. It is now read-only.

Non-blocking calls #7

Open
muammar opened this issue Jan 21, 2020 · 2 comments
Open

Non-blocking calls #7

muammar opened this issue Jan 21, 2020 · 2 comments

Comments

@muammar
Copy link

muammar commented Jan 21, 2020

Although Popen is being used to execute commands:

process = Popen([name] + line.split(), stdin=PIPE, stdout=PIPE, stderr=PIPE)

.communicate() is a blocking process:

stdout, stderr = process.communicate(input)

Is it possible to change this so that capturing subprocess.PIPE does not block?

muammar added a commit to muammar/slurm-magic that referenced this issue Jan 26, 2020
@muammar
Copy link
Author

muammar commented Jan 26, 2020

muammar@afaa221 represents a small hack for this. A better way would be something like what's described here:

https://stackoverflow.com/questions/375427/non-blocking-read-on-a-subprocess-pipe-in-python

I will keep working on that.

@rcthomas
Copy link
Member

Hi @muammar, thanks for your interest. I've been wondering if anyone uses this package, because it's barely more functionality than the IPython kernel provides by default. You can background processes with the built in %%script magic. As you can see in the code you've already looked at it's really not doing anything "magic" here, just passing Slurm commands through to the command line.

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

No branches or pull requests

2 participants