-
Notifications
You must be signed in to change notification settings - Fork 3
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
Test Workflows again #210
Test Workflows again #210
Conversation
@liamhuber I was able to fix the workflow tests, the main difference is that my previous tests use the |
@jan-janssen , that is great! We definitely want either syntax to be supported, so this is a positive change 🚀
I mean, we definitely don't need them to all be in separate files -- that was just a (misguided, ultimately) attempt to see which ones were hanging and which not. The different tests are checking for different things though. For instance, an earlier iteration of the executor worked fine when the callable was dynamically defined but broke if one of the arguments being passed was dynamically defined, so I would be much more comfortable keeping each of them. I'll go back to #187, merge in main, and recombine and polish the tests. |
I am not sure if we want to support both syntax, because it hides the fact that a secondary process is running in the background. I would prefer to use only the |
So first a giant disclaimer: I am really still just learning about concurrent stuff, so what I'm saying may be waaaay off the rails dumb here. With that out of the way...are you sure? As far as I understand, there are definitely cases where we exactly want to hide that there is a secondary process running! My understanding of the with this function tucked away in a file def return_42():
from time import sleep
sleep(1)
return 42 I get the following, perfectly sensible and useful output: from concurrent.futures import ProcessPoolExecutor
from scratch import return_42
with ProcessPoolExecutor() as p:
fs = p.submit(return_42)
print(fs.done())
fs.result()
print(fs.done())
>>> False
>>> True But if I try to do anything outside the from concurrent.futures import ProcessPoolExecutor
from scratch import return_42
with ProcessPoolExecutor() as p:
fs = p.submit(return_42)
print(fs.done())
fs.result()
print(fs.done())
>>> True
>>> True I have no complaint about that, it's a perfectly reasonable way for Consider the following MWE that basically mocks up what my nodes are doing: # from pympipool.mpi.executor import PyMPIExecutor as Executor
from pyiron_workflow.executors import CloudpickleProcessPoolExecutor as Executor
class Foo:
def __init__(self):
self.running = False
def run(self):
self.running = True
print("Inside", self.running)
executor = Executor()
future = executor.submit(self.return_42)
future.add_done_callback(self.finished)
# Using `with` gives the undesirable result for both executors
# with Executor() as executor:
# future = executor.submit(self.return_42)
# future.add_done_callback(self.finished)
return future
def return_42(self):
from time import sleep
sleep(1)
return 42
def finished(self, future):
self.running = False
foo = Foo()
print("Before", foo.running)
fs = foo.run()
print("While", foo.running)
fs.result() # Wait for completion
print("After", foo.running) If I use the
If instead I use the
Now, again, that's totally fair! It just isn't what I want. What's really troubling me is that What I'm hoping to get from you:
|
So far I have primarily used the
I had a discussion about the |
Ok, then it sounds like supporting both is the right choice. Indeed, the second issue of callbacks is tightly linked to this since a callback firing is a perfectly reasonable way for a user to gain visibility that their task has completed.
Looks like it wasn't the callbacks exactly, but the shutdown of the queue. This has its own issue and PR now. |
No description provided.