Skip to content

Commit

Permalink
Fix the worker for Windows
Browse files Browse the repository at this point in the history
This disables --beat on Windows and sets FORKED_BY_MULTIPROCESSING=1, which is
required to make the default celery pool work on Windows.
  • Loading branch information
asmeurer committed Sep 25, 2023
1 parent abb13ed commit cf4951e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion conda-store-server/conda_store_server/worker/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,18 @@ def start(self):
argv = [
"worker",
"--loglevel=INFO",
"--beat",
]

# The default Celery pool requires this on Windows. See
# https://stackoverflow.com/questions/37255548/how-to-run-celery-on-windows
if sys.platform == "win32":
os.environ.setdefault('FORKED_BY_MULTIPROCESSING', '1')
else:
# --beat does not work on Windows
argv += [
"--beat",
]

if self.concurrency:
argv.append(f"--concurrency={self.concurrency}")

Expand Down

0 comments on commit cf4951e

Please sign in to comment.