Skip to content

Commit

Permalink
Add greenlet implementation copied from devlib
Browse files Browse the repository at this point in the history
  • Loading branch information
unkcpz committed Jan 31, 2025
1 parent 689c86a commit 04c09e4
Show file tree
Hide file tree
Showing 2 changed files with 462 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/plumpy/processes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1314,10 +1314,15 @@ def execute(self) -> dict[str, Any] | None:
:return: None if not terminated, otherwise `self.outputs`
"""
from .reentry import _get_runner

if self.has_terminated():
return self.result()

return asyncio.run(self.step_until_terminated())
runner = _get_runner()
with runner as runner:
return runner.run(self.step_until_terminated())
# return asyncio.run(self.step_until_terminated())

@ensure_not_closed
async def step(self) -> None:
Expand Down
Loading

0 comments on commit 04c09e4

Please sign in to comment.