Skip to content

scheduler: Add schedule recurrent tasks service

Instal the new service in charge of scheduling regularly recurrent tasks.

Related to T3667

Test Plan

octo-diff:

$SWH_PUPPET_ENVIRONMENT_HOME/bin/octocatalog-diff --octocatalog-diff-args --no-truncate-details --to staging scheduler0.internal.staging.swh.network
...
*** Running octocatalog-diff on host scheduler0.internal.staging.swh.network
I, [2021-10-28T11:33:43.361928 #2339353]  INFO -- : Catalogs compiled for scheduler0.internal.staging.swh.network
I, [2021-10-28T11:33:43.655918 #2339353]  INFO -- : Diffs computed for scheduler0.internal.staging.swh.network
diff origin/production/scheduler0.internal.staging.swh.network current/scheduler0.internal.staging.swh.network
*******************************************
+ File[/etc/systemd/system/swh-scheduler-schedule-recurrent.service] =>
   parameters =>
      "ensure": "file"
      "group": "root"
      "mode": "0444"
      "notify": "Class[Systemd::Systemctl::Daemon_reload]"
      "owner": "root"
      "show_diff": true
      "content": >>>
# Scheduler Runner unit file
# Managed by puppet class profile::swh::deploy::scheduler
# Changes will be overwritten

[Unit]
Description=Software Heritage scheduler runner
Requires=network.target rabbitmq-server.service
After=network.target rabbitmq-server.service

[Service]
User=swhscheduler
Group=swhscheduler
Type=simple
Environment=SWH_LOG_TARGET=journal
Environment=SWH_SENTRY_DSN=https://swh::deploy::scheduler::sentry_token@sentry.softwareheritage.org/7
Environment=SWH_SENTRY_ENVIRONMENT=staging
Environment=SWH_MAIN_PACKAGE=swh.scheduler
ExecStart=/usr/bin/swh --log-level INFO scheduler --config-file /etc/softwareheritage/scheduler/listener-runner.yml schedule-recurrent
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target
<<<
*******************************************
  Profile::Swh::Deploy::Scheduler::Runner[swh-scheduler-runner-priority] =>
   parameters =>
     default_runner =>
      + true
*******************************************
  Profile::Swh::Deploy::Scheduler::Runner[swh-scheduler-runner] =>
   parameters =>
     default_runner =>
      + true
*******************************************
+ Profile::Swh::Deploy::Scheduler::Runner[swh-scheduler-schedule-recurrent] =>
   parameters =>
      "config_file": "/etc/softwareheritage/scheduler/listener-runner.yml"
      "default_runner": false
      "group": "swhscheduler"
      "packages": ["python3-swh.scheduler"]
      "priority": false
      "sentry_dsn": "https://swh::deploy::scheduler::sentry_token@sentry.softwareheritage.org/7"
      "sentry_environment": "staging"
      "sentry_swh_package": "swh.scheduler"
      "service_name": "swh-scheduler-schedule-recurrent"
      "user": "swhscheduler"
*******************************************
+ Service[swh-scheduler-schedule-recurrent] =>
   parameters =>
      "enable": true
      "ensure": "running"
      "subscribe": ["Package[python3-swh.scheduler]"]
*******************************************
+ Systemd::Unit_file[swh-scheduler-schedule-recurrent.service] =>
   parameters =>
      "ensure": "present"
      "group": "root"
      "mode": "0444"
      "notify": "Service[swh-scheduler-schedule-recurrent]"
      "owner": "root"
      "path": "/etc/systemd/system"
      "show_diff": true
      "content": >>>
# Scheduler Runner unit file
# Managed by puppet class profile::swh::deploy::scheduler
# Changes will be overwritten

[Unit]
Description=Software Heritage scheduler runner
Requires=network.target rabbitmq-server.service
After=network.target rabbitmq-server.service

[Service]
User=swhscheduler
Group=swhscheduler
Type=simple
Environment=SWH_LOG_TARGET=journal
Environment=SWH_SENTRY_DSN=https://swh::deploy::scheduler::sentry_token@sentry.softwareheritage.org/7
Environment=SWH_SENTRY_ENVIRONMENT=staging
Environment=SWH_MAIN_PACKAGE=swh.scheduler
ExecStart=/usr/bin/swh --log-level INFO scheduler --config-file /etc/softwareheritage/scheduler/listener-runner.yml schedule-recurrent --period 10
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target
<<<
*******************************************
*** End octocatalog-diff on scheduler0.internal.staging.swh.network

Migrated from D6574 (view on Phabricator)

Merge request reports