Make workers send task events only when required
Currently, that means only workers whose tasks are managed through the scheduler-runner and scheduler listener:
- save code now (swh-worker@loader_high_priority)
- vault (swh-worker@vault_cooker)
- indexer (swh-worker@indexer*)
- lister (swh-worker@lister)
All other workers (swh-worker@loader_*) are actually scheduled through the next-gen scheduler and no longer need to send those events. It's dealt with the scheduler journal client. So it's currently extra work for no reason (rabbitmq, celery, scheduler).
The following commit deactivates such events for all other workers.
Related to !424 (closed) Related to T3458
Test Plan
bin/octo-diff on worker2 staging (this node has both workers with and without events):
% $SWH_PUPPET_ENVIRONMENT_HOME/bin/octocatalog-diff --octocatalog-diff-args --no-truncate-details --to staging worker2
...
*******************************************
File[/etc/systemd/system/swh-worker@.service] =>
parameters =>
content =>
@@ -1,2 +1,5 @@
+# Managed by puppet - modifications will be overwritten
+# In defined class profile::swh::deploy::worker::base
+
[Unit]
Description=Software Heritage Worker (%i)
@@ -8,4 +11,6 @@
_
Type=simple
+# Following environment variables can be overriden in the respective
+# swh-worker@<service>.service.d/parameters.conf
Environment=SWH_CONFIG_FILENAME=/etc/softwareheritage/%i.yml
Environment=SWH_LOG_TARGET=journal
@@ -14,5 +19,6 @@
Environment=LOGLEVEL=info
Environment=CELERY_HOSTNAME=worker2.internal.staging.swh.network
-ExecStart=/usr/bin/python3 -m celery worker -n %i@${CELERY_HOSTNAME} --app=swh.scheduler.celery_backend.config.app --pool=prefork --events --concurrency=${CONCURRENCY} --maxtasksperchild=${MAX_TASKS_PER_CHILD} -Ofair --loglevel=${LOGLEVEL} --without-gossip --without-mingle --without-heartbeat
+Environment=CELERY_WORKER_EXTRA_ARGS=
+ExecStart=/usr/bin/python3 -m celery worker -n %i@${CELERY_HOSTNAME} --app=swh.scheduler.celery_backend.config.app --pool=prefork ${CELERY_WORKER_EXTRA_ARGS} --concurrency=${CONCURRENCY} --maxtasksperchild=${MAX_TASKS_PER_CHILD} -Ofair --loglevel=${LOGLEVEL} --without-gossip --without-mingle --without-heartbeat
_
KillMode=process
*******************************************
File[/etc/systemd/system/swh-worker@lister.service.d/parameters.conf] =>
parameters =>
content =>
@@ -11,2 +11,3 @@
_
_
+Environment=CELERY_WORKER_EXTRA_ARGS=--events
*******************************************
File[/etc/systemd/system/swh-worker@loader_high_priority.service.d/parameters.conf] =>
parameters =>
content =>
@@ -8,2 +8,3 @@
_
_
+Environment=CELERY_WORKER_EXTRA_ARGS=--events
*******************************************
File[/etc/systemd/system/swh-worker@vault_cooker.service.d/parameters.conf] =>
parameters =>
content =>
@@ -11,2 +11,3 @@
_
_
+Environment=CELERY_WORKER_EXTRA_ARGS=--events
*******************************************
Profile::Swh::Deploy::Worker::Instance[checker_deposit] =>
parameters =>
send_task_events =>
+ false
*******************************************
Profile::Swh::Deploy::Worker::Instance[lister] =>
parameters =>
send_task_events =>
+ true
*******************************************
Profile::Swh::Deploy::Worker::Instance[loader_archive] =>
parameters =>
send_task_events =>
+ false
*******************************************
Profile::Swh::Deploy::Worker::Instance[loader_cran] =>
parameters =>
send_task_events =>
+ false
*******************************************
Profile::Swh::Deploy::Worker::Instance[loader_debian] =>
parameters =>
send_task_events =>
+ false
*******************************************
Profile::Swh::Deploy::Worker::Instance[loader_deposit] =>
parameters =>
send_task_events =>
+ false
*******************************************
Profile::Swh::Deploy::Worker::Instance[loader_git] =>
parameters =>
send_task_events =>
+ false
*******************************************
Profile::Swh::Deploy::Worker::Instance[loader_high_priority] =>
parameters =>
send_task_events =>
+ true
*******************************************
Profile::Swh::Deploy::Worker::Instance[loader_mercurial] =>
parameters =>
send_task_events =>
+ false
*******************************************
Profile::Swh::Deploy::Worker::Instance[loader_nixguix] =>
parameters =>
send_task_events =>
+ false
*******************************************
Profile::Swh::Deploy::Worker::Instance[loader_npm] =>
parameters =>
send_task_events =>
+ false
*******************************************
Profile::Swh::Deploy::Worker::Instance[loader_opam] =>
parameters =>
send_task_events =>
+ false
*******************************************
Profile::Swh::Deploy::Worker::Instance[loader_pypi] =>
parameters =>
send_task_events =>
+ false
*******************************************
Profile::Swh::Deploy::Worker::Instance[loader_svn] =>
parameters =>
send_task_events =>
+ false
*******************************************
Profile::Swh::Deploy::Worker::Instance[vault_cooker] =>
parameters =>
send_task_events =>
+ true
*******************************************
Systemd::Dropin_file[swh-worker@lister/parameters.conf] =>
parameters =>
content =>
@@ -11,2 +11,3 @@
_
_
+Environment=CELERY_WORKER_EXTRA_ARGS=--events
*******************************************
Systemd::Dropin_file[swh-worker@loader_high_priority/parameters.conf] =>
parameters =>
content =>
@@ -8,2 +8,3 @@
_
_
+Environment=CELERY_WORKER_EXTRA_ARGS=--events
*******************************************
Systemd::Dropin_file[swh-worker@vault_cooker/parameters.conf] =>
parameters =>
content =>
@@ -11,2 +11,3 @@
_
_
+Environment=CELERY_WORKER_EXTRA_ARGS=--events
*******************************************
Systemd::Unit_file[swh-worker@.service] =>
parameters =>
content =>
@@ -1,2 +1,5 @@
+# Managed by puppet - modifications will be overwritten
+# In defined class profile::swh::deploy::worker::base
+
[Unit]
Description=Software Heritage Worker (%i)
@@ -8,4 +11,6 @@
_
Type=simple
+# Following environment variables can be overriden in the respective
+# swh-worker@<service>.service.d/parameters.conf
Environment=SWH_CONFIG_FILENAME=/etc/softwareheritage/%i.yml
Environment=SWH_LOG_TARGET=journal
@@ -14,5 +19,6 @@
Environment=LOGLEVEL=info
Environment=CELERY_HOSTNAME=worker2.internal.staging.swh.network
-ExecStart=/usr/bin/python3 -m celery worker -n %i@${CELERY_HOSTNAME} --app=swh.scheduler.celery_backend.config.app --pool=prefork --events --concurrency=${CONCURRENCY} --maxtasksperchild=${MAX_TASKS_PER_CHILD} -Ofair --loglevel=${LOGLEVEL} --without-gossip --without-mingle --without-heartbeat
+Environment=CELERY_WORKER_EXTRA_ARGS=
+ExecStart=/usr/bin/python3 -m celery worker -n %i@${CELERY_HOSTNAME} --app=swh.scheduler.celery_backend.config.app --pool=prefork ${CELERY_WORKER_EXTRA_ARGS} --concurrency=${CONCURRENCY} --maxtasksperchild=${MAX_TASKS_PER_CHILD} -Ofair --loglevel=${LOGLEVEL} --without-gossip --without-mingle --without-heartbeat
_
KillMode=process
*******************************************
*** End octocatalog-diff on worker2.internal.staging.swh.network```
Migrated from D6439 (view on Phabricator)