45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
# File 'modules/profile/manifests/mediawiki/sharded_periodic_job.pp', line 45
define profile::mediawiki::sharded_periodic_job(
String $script,
Variant[
Systemd::Timer::Interval,
Systemd::Timer::Datetime
] $interval,
Array[String] $shards = ['s1', 's2', 's3', 's4', 's5', 's6', 's7', 's8'],
Array[String] $kubernetes_shards = [],
Optional[Wmflib::Cron_schedule] $cron_schedule = undef,
Optional[Integer] $splay = undef,
Boolean $kubernetes = false,
Optional[String] $script_label = undef,
Optional[String] $team = undef,
Optional[String] $description = undef,
Optional[Stdlib::Unixpath] $helmfile_defaults_dir = '/etc/helmfile-defaults',
Optional[Integer] $ttlsecondsafterfinished = undef,
Optional[Integer] $failedjobshistorylimit = undef,
Optional[Integer] $successfuljobshistorylimit = undef,
Optional[Boolean] $foreachwiki_ignore_errors = false,
Optional[Boolean] $mesh_check_skip = false,
Wmflib::Ensure $ensure = present,
) {
$real_description = $description ? {
undef => $title,
default => $description,
}
$shards.map |$shard| {
# For back-compat, support "s1@11" style shards
$real_shard = regsubst($shard, '@.*', '')
# Inject the dblist as the second argument (after the PHP script)
$script = regsubst($script, '\.php', ".php ${real_shard}.dblist")
# If we have not set the whole sharded_periodic_job to run on kubernetes,
# check if the current shard is part of the kubernetes_shards array.
unless $kubernetes {
$kubernetes = $shard in $kubernetes_shards
}
profile::mediawiki::periodic_job { "${title}_${shard}":
ensure => $ensure,
kubernetes => $kubernetes,
command => "/usr/local/bin/mwscriptwikiset ${script}",
interval => $interval,
splay => $splay,
cron_schedule => $cron_schedule,
script_label => $script_label,
team => $team,
description => "${real_description} in ${real_shard}",
helmfile_defaults_dir => $helmfile_defaults_dir,
ttlsecondsafterfinished => $ttlsecondsafterfinished,
failedjobshistorylimit => $failedjobshistorylimit,
successfuljobshistorylimit => $successfuljobshistorylimit,
foreachwiki_ignore_errors => $foreachwiki_ignore_errors,
mesh_check_skip => $mesh_check_skip,
}
}
profile::mediawiki::periodic_job { "${title}_s11":
ensure => absent,
command => "/usr/local/bin/mwscriptwikiset ${script}",
interval => $interval,
}
}
|