Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add configuration setting for number of octopoes workers #3796

Merged
merged 3 commits into from
Nov 21, 2024

Conversation

dekkers
Copy link
Contributor

@dekkers dekkers commented Nov 5, 2024

Changes

This adds a setting to octopoes to configure the number of workers. While it is possible to do this directly in celery with CELERY_WORKER_CONCURRENCY, this value does not have a proper default and it not in our documentation. With this change we add a default and it will also automatically be included in the documentation.

This also removes CELERY_WORKER_CONCURRENCY from .env-dist because the default is 4 now and so we don't need this anymore.

QA notes

Check if setting OCTOPOES_WORKERS changes the number of octopoes celery processes that are started.


Checklist for code reviewers:

Copy-paste the checklist from the docs/source/templates folder into your comment.


Checklist for QA:

Copy-paste the checklist from the docs/source/templates folder into your comment.

@dekkers dekkers requested a review from a team as a code owner November 5, 2024 09:50
@underdarknl
Copy link
Contributor

This needs docs changes, and possibly a backward compatible solution for those who already set the celery env-var

Copy link
Contributor

@ammar92 ammar92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although this works, I think documenting or referencing the CELERY_WORKER_CONCURRENCY variable would've been easier. Because now we have an extra setting, possibly backwards compatibility issues and settings inconsistency (e.g. you can set other Celery settings, but for CELERY_WORKER_CONCURRENCY you'd now have to use OCTOPOES_WORKERS, which may be confusing for users who have Celery experience).

The last two can probably be solved using field aliases, something like:

workers: int = Field(4, description="Number of Octopoes Celery workers", alias=["OCTOPOES_WORKERS", "CELERY_WORKER_CONCURRENCY"])

(not tested, and note the extra OCTOPOES_ prefix, because env_prefix does not apply to fields with aliases)

I don't have a strong preference, but just giving another perspective

@ammar92
Copy link
Contributor

ammar92 commented Nov 6, 2024

Extra QA notes: you can verify the setting by checking the octopoes_api_worker logs:
image

@stephanie0x00
Copy link
Contributor

Checklist for QA:

  • I have checked out this branch, and successfully ran a fresh make reset.
  • I confirmed that there are no unintended functional regressions in this branch:
    • I have managed to pass the onboarding flow
    • Objects and Findings are created properly
    • Tasks are created and completed properly
  • I confirmed that the PR's advertised feature or hotfix works as intended.
  • I checked the logs for errors and/or warnings and made issues where necessary

What works:

Works, number of celery workers went from 4 to 6. Onboarding flow still works as expected.

What doesn't work:

n/a

Bug or feature?:

n/a

underdarknl
underdarknl previously approved these changes Nov 21, 2024
@underdarknl
Copy link
Contributor

This still needs documentation.

@dekkers
Copy link
Contributor Author

dekkers commented Nov 21, 2024

This still needs documentation.

The documentation of settings is auto generated, so should be online as soon we merge this. We could mention in the release notes when we write those.

@underdarknl underdarknl merged commit 745ff31 into main Nov 21, 2024
32 of 33 checks passed
@underdarknl underdarknl deleted the celery-workers-setting branch November 21, 2024 10:09
jpbruinsslot added a commit that referenced this pull request Nov 27, 2024
* main: (60 commits)
  Increase max number of PostgreSQL connections (#3889)
  Fix for task id as valid UUID (#3744)
  Add `auto_calculate_deadline` attribute to Scheduler (#3869)
  Ignore specific url parameters when following location headers (#3856)
  Let mailserver inherit l1 (#3704)
  Change plugins enabling in report flow to checkboxes (#3747)
  Fix rocky katalogus tests and delete unused fixtures (#3884)
  Enable/disable scheduled reports (#3871)
  optimize locking in katalogus.py, reuse available data (#3752)
  Updates boefje clearances and descriptions (#3863)
  Fixes for empty tables (#3844)
  Fix cron for last day of the month (#3831)
  Sub reports for Aggregate Report (#3852)
  Add start time to scheduled reports (#3809)
  Add configuration setting for number of octopoes workers (#3796)
  Limit requesting prior tasks for ranking in scheduler (#3836)
  Let local plugins (files) take precedence over database entries (#3858)
  Skip empty queues in the Rocky worker (#3860)
  Report types listed in a modal @ report plugins (#3718)
  Support a Schedule without a schedule in scheduler (#3834)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants