mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-11 23:00:51 +08:00
19 lines
587 B
Python
19 lines
587 B
Python
import concurrent.futures
|
|
|
|
from pebble import ProcessPool
|
|
|
|
from ..component_model.executor_types import Executor
|
|
|
|
|
|
class ProcessPoolExecutor(ProcessPool, Executor):
|
|
def shutdown(self, wait=True, *, cancel_futures=False):
|
|
if cancel_futures:
|
|
raise NotImplementedError("cannot cancel futures in this implementation")
|
|
if wait:
|
|
self.close()
|
|
else:
|
|
self.stop()
|
|
return
|
|
|
|
def submit(self, fn, /, *args, **kwargs) -> concurrent.futures.Future:
|
|
return self.schedule(fn, args=list(args), kwargs=kwargs, timeout=None) |