Skip to content

Commit

Permalink
Merge pull request #531 from dandi/celery-worker-concurrency
Browse files Browse the repository at this point in the history
Add environment setting for Celery concurrency
  • Loading branch information
dchiquito committed Sep 27, 2021
2 parents 10cb3b9 + b07e020 commit 496714b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions dandiapi/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ def before_binding(configuration: Type[ComposedConfiguration]):
'DEFAULT_AUTO_SCHEMA_CLASS': 'dandiapi.swagger.DANDISwaggerAutoSchema',
}

# Some tasks working with lots of data need lots of memory, so we need to artificially lower
# the number of concurrent tasks (default is 8) to keep memory usage down.
CELERY_WORKER_CONCURRENCY = values.IntegerValue(environ=True, default=8)


class DevelopmentConfiguration(DandiMixin, DevelopmentBaseConfiguration):
# This makes pydantic model schema allow URLs with localhost in them.
Expand Down Expand Up @@ -106,7 +110,3 @@ class HerokuProductionConfiguration(DandiMixin, HerokuProductionBaseConfiguratio
# the API server is running in (production/local or staging).
class HerokuStagingConfiguration(HerokuProductionConfiguration):
OAUTH2_PROVIDER_APPLICATION_MODEL = 'api.StagingApplication'

# We are using cheaper Heroku dynos for staging, so we need to artificially lower the number
# of concurrent tasks (default is 8) to keep memory usage down.
CELERY_WORKER_CONCURRENCY = 2
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
include_package_data=True,
install_requires=[
'celery',
'dandischema>=0.3.4',
'dandischema==0.3.4',
'django>=3.1.2',
'django-admin-display',
'django-allauth',
Expand Down

0 comments on commit 496714b

Please sign in to comment.