Skip to content

Instantly share code, notes, and snippets.

@mianos
Created October 15, 2020 07:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mianos/b89e70d23b812930daf115d2b76cf71b to your computer and use it in GitHub Desktop.
Save mianos/b89e70d23b812930daf115d2b76cf71b to your computer and use it in GitHub Desktop.
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