Skip to content

Commit

Permalink
exp: use celery threadpool worker instead of prefork
Browse files Browse the repository at this point in the history
  • Loading branch information
pmrowla committed Jul 12, 2022
1 parent dc4292c commit 22deca3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
19 changes: 18 additions & 1 deletion dvc/repo/experiments/queue/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,24 @@ def proc(self) -> "ProcessManager":
def worker(self) -> "TemporaryWorker":
from dvc_task.worker import TemporaryWorker

return TemporaryWorker(self.celery, concurrency=1, timeout=10)
# NOTE: Use thread pool with concurrency 1 and disabled prefetch.
# Worker scaling should be handled by running additional workers,
# rather than increasing pool concurrency.
#
# We use "threads" over "solo" (inline single-threaded) execution so
# that we still have access to the control/broadcast API (which
# requires a separate message handling thread in the worker).
#
# Disabled prefetch ensures that each worker will can only schedule and
# execute up to one experiment at a time (and a worker cannot prefetch
# additional experiments from the queue).
return TemporaryWorker(
self.celery,
pool="threads",
concurrency=1,
prefetch_multiplier=1,
timeout=10,
)

def spawn_worker(self):
from dvc_task.proc.process import ManagedProcess
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ install_requires =
aiohttp-retry>=2.4.5
scmrepo==0.0.25
dvc-render==0.0.6
dvc-task@git+https://github.com/iterative/dvc-task.git@0.0.6
dvc-task@git+https://github.com/iterative/dvc-task.git@0.0.7
dvclive>=0.7.3
dvc-data==0.0.23

Expand Down

0 comments on commit 22deca3

Please sign in to comment.