Changeset View
Changeset View
Standalone View
Standalone View
site-modules/profile/manifests/swh/deploy/scheduler.pp
Show First 20 Lines • Show All 85 Lines • ▼ Show 20 Lines | class profile::swh::deploy::scheduler { | ||||
# scheduler rpc server | # scheduler rpc server | ||||
::profile::swh::deploy::rpc_server {'scheduler': | ::profile::swh::deploy::rpc_server {'scheduler': | ||||
config_key => 'scheduler::remote', | config_key => 'scheduler::remote', | ||||
executable => 'swh.scheduler.api.server:make_app_from_configfile()', | executable => 'swh.scheduler.api.server:make_app_from_configfile()', | ||||
http_check_string => 'Software Heritage scheduler RPC server', | http_check_string => 'Software Heritage scheduler RPC server', | ||||
} | } | ||||
# scheduler update metrics routine | |||||
# Template uses variables | |||||
# - $user | |||||
# - $group | |||||
# - $config_file | |||||
# | |||||
$update_metrics_service_name = "swh-scheduler-update-metrics" | |||||
$update_metrics_unit_template = "profile/swh/deploy/scheduler/${update_metrics_service_name}.service.erb" | |||||
$update_metrics_timer_name = "${update_metrics_service_name}.timer" | |||||
$update_metrics_timer_template = "profile/swh/deploy/scheduler/${update_metrics_timer_name}.erb" | |||||
::systemd::timer { $update_metrics_timer_name: | |||||
timer_content => template($update_metrics_timer_template), | |||||
service_content => template($update_metrics_unit_template), | |||||
active => true, | |||||
enable => true, | |||||
require => Package[$packages], | |||||
} | |||||
# task archival cron | # task archival cron | ||||
$archive_config_file = lookup('swh::deploy::scheduler::archive::conf_file') | $archive_config_file = lookup('swh::deploy::scheduler::archive::conf_file') | ||||
$archive_config = lookup('swh::deploy::scheduler::archive::config') | $archive_config = lookup('swh::deploy::scheduler::archive::config') | ||||
file {$archive_config_file: | file {$archive_config_file: | ||||
ensure => present, | ensure => present, | ||||
owner => 'root', | owner => 'root', | ||||
Show All 15 Lines | profile::cron::d {'scheduler_archive_tasks': | ||||
hour => '0', | hour => '0', | ||||
minute => '0', | minute => '0', | ||||
require => [ | require => [ | ||||
Package[$packages], | Package[$packages], | ||||
File[$archive_config_file], | File[$archive_config_file], | ||||
], | ], | ||||
} | } | ||||
# Update metrics cron every hours (takes ~13min) | |||||
profile::cron::d {'scheduler_update_metrics': | |||||
user => $user, | |||||
command => "/usr/bin/swh scheduler --config-file ${config_file} origin update-metrics", | |||||
minute => 'fqdn_rand', | |||||
require => Package[$packages], | |||||
} | |||||
} | } |