Created
October 15, 2020 07:52
-
-
Save mianos/b89e70d23b812930daf115d2b76cf71b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Any, Callable | |
import concurrent.futures | |
from prefect.engine.executors.base import Executor | |
class CFExecutor(Executor): | |
def __init__(self): | |
print("Robexecutor") | |
self.pool = concurrent.futures.ThreadPoolExecutor(3) | |
super().__init__() | |
def submit( | |
self, fn: Callable, *args: Any, extra_context: dict = None, **kwargs: Any | |
) -> Any: | |
return self.pool.submit(fn, *args, **kwargs) | |
def wait(self, futures: Any) -> Any: | |
rval = concurrent.futures.wait(futures.values()) | |
print(rval) | |
return rval |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment