From 1120fef5733905982c44d268bbd9d2269d8cd74a Mon Sep 17 00:00:00 2001 From: David Dotson Date: Mon, 5 Aug 2024 19:17:39 -0700 Subject: [PATCH] Exposed processpool num workers setting --- alchemiscale_fah/compute/service.py | 2 +- alchemiscale_fah/compute/settings.py | 6 ++++++ devtools/configs/fah-asynchronous-compute-settings.yaml | 4 ++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/alchemiscale_fah/compute/service.py b/alchemiscale_fah/compute/service.py index 0d784de..87fdbe5 100644 --- a/alchemiscale_fah/compute/service.py +++ b/alchemiscale_fah/compute/service.py @@ -399,7 +399,7 @@ def cycle_init(self): self._start_time = time.time() # create process pool - self._pool = ProcessPoolExecutor() + self._pool = ProcessPoolExecutor(self.settings.max_processpool_workers) # open index self.index = FahComputeServiceIndex(self.index_dir, self.obj_store) diff --git a/alchemiscale_fah/compute/settings.py b/alchemiscale_fah/compute/settings.py index 1bf9c7c..4eeab21 100644 --- a/alchemiscale_fah/compute/settings.py +++ b/alchemiscale_fah/compute/settings.py @@ -9,6 +9,12 @@ class FahAsynchronousComputeServiceSettings(ComputeServiceSettings): """Settings schema for a FahSynchronousComputeService.""" + # Maximum number of workers to allocate to the service's process pool + max_processpool_workers: Optional[int] = Field( + None, + description="Maximum number of workers to allocate to the service's process pool; `None` will default to number of processors on host.", + ) + fah_as_url: str = Field( ..., description="URL of the FAH assignment server to use.", diff --git a/devtools/configs/fah-asynchronous-compute-settings.yaml b/devtools/configs/fah-asynchronous-compute-settings.yaml index dae3aa4..4789390 100644 --- a/devtools/configs/fah-asynchronous-compute-settings.yaml +++ b/devtools/configs/fah-asynchronous-compute-settings.yaml @@ -78,6 +78,10 @@ init: ## FAH-specific settings + # Maximum number of workers to allocate to the service's process pool; + # `null` will default to number of processors on host. + max_processpool_workers: null + # URL of the FAH assignment server to use. fah_as_url: "https://assign1.foldingathome.org"