def build_adapter_clients(mtype, storage_name="test_qcfractal_compute_server"): # Basic boot and loop information if mtype == "pool": from multiprocessing import Pool, set_start_method from .cli.qcfractal_manager import _initialize_signals_process_pool adapter_client = Pool(processes=2, initializer=_initialize_signals_process_pool) elif mtype == "dask": dd = pytest.importorskip("dask.distributed") adapter_client = dd.Client(n_workers=2, threads_per_worker=1, resources={"process": 1}) # Not super happy about this line, but shuts up dangling reference errors adapter_client._should_close_loop = False elif mtype == "fireworks": fireworks = pytest.importorskip("fireworks") fireworks_name = storage_name + "_fireworks_queue" adapter_client = fireworks.LaunchPad(name=fireworks_name, logdir="/tmp/", strm_lvl="CRITICAL") elif mtype == "parsl": parsl = pytest.importorskip("parsl") # Must only be a single thread as we run thread unsafe applications. adapter_client = parsl.config.Config(executors=[ parsl.executors.threads.ThreadPoolExecutor(max_threads=1) ]) else: raise TypeError("fractal_compute_server: internal parametrize error") return adapter_client