Skip to content

Commit

Permalink
queue start: give every worker a unique name
Browse files Browse the repository at this point in the history
Currently, all of our celery workers are called `dvc-exp-worker` and
they will write to the same log path.

We give every single worker a unique name and seperate they logs if
under a debug log level
  • Loading branch information
karajan1001 authored and pmrowla committed Jul 11, 2022
1 parent fcd504d commit 780ebe7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions dvc/repo/experiments/queue/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,18 +124,21 @@ def worker(self) -> "TemporaryWorker":
)

def spawn_worker(self):
from shortuuid import uuid

from dvc_task.proc.process import ManagedProcess

logger.debug("Spawning exp queue worker")
wdir_hash = hashlib.sha256(self.wdir.encode("utf-8")).hexdigest()[:6]
node_name = f"dvc-exp-{wdir_hash}-1@localhost"
cmd = ["exp", "queue-worker", node_name]
name = "dvc-exp-worker"
if logger.getEffectiveLevel() < logging.INFO:
name = name + str(uuid())
if os.name == "nt":
daemonize(cmd)
else:
ManagedProcess.spawn(
["dvc"] + cmd, wdir=self.wdir, name="dvc-exp-worker"
)
ManagedProcess.spawn(["dvc"] + cmd, wdir=self.wdir, name=name)

def put(self, *args, **kwargs) -> QueueEntry:
"""Stash an experiment and add it to the queue."""
Expand Down

0 comments on commit 780ebe7

Please sign in to comment.