-
Notifications
You must be signed in to change notification settings - Fork 112
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
Vine: add wait and as_completed for futures #3876
Vine: add wait and as_completed for futures #3876
Conversation
@BarrySlyDelgado Is there an easy way to add a test for this one? |
I'll create a test that tests these methods. |
Thanks, @BarrySlyDelgado! Is it also possible to either call I'm not sure which option is best, but I think both |
I think i'll have it call |
@BarrySlyDelgado what's the status on this one? |
Hi, is this branch stable or is there still work to be done? |
The branch has been tested and should work. |
Hi @BarrySlyDelgado, I've been testing out the branch and noticed a couple of issues. Invoking future callbacks in import time
import ndcctools.taskvine as vine
def foo() -> int:
time.sleep(1)
return 42
def check(future: vine.VineFuture) -> None:
assert future.result() == 42
m = vine.FuturesExecutor(manager_name='my_manager')
t = m.submit(foo)
t.add_done_callback(check)
print(t.result()) Exceptions don't get set on nor raised by import ndcctools.taskvine as vine
def foo():
raise RuntimeError('oops')
m = vine.FuturesExecutor(manager_name='my_manager')
t = m.submit(foo)
try:
t.result()
except RuntimeError:
print('Correctly raised exception')
else:
raise AssertionError('Did not raise exception') |
Thanks for letting me know, after looking at the source code the infinite recursion is due to the order in which callback functions are executed. Essentially, what is happening is that a call to |
@gpauloski The recursion bug should be fixed. Tasks that raise an exception now raise an exception when |
Thanks, @BarrySlyDelgado. The recursion is fixed for me, but I think this only raises exceptions if loading the output fails. I had to check if the output was an instance of Also, I opened issue #3892 about poor performance. But it's possible the problem is not specific to the |
Proposed Changes
This adds module functions
wait
andas_completed
to the vine futures. in regard to #3835Merge Checklist
The following items must be completed before PRs can be merge.
Check these off to verify you have completed all steps.
make test
Run local tests prior to pushing.make format
Format source code to comply with lint policies. Note that some lint errors can only be resolved manually (e.g., Python)make lint
Run lint on source code prior to pushing.