diff --git a/modules/elastic_recheck/manifests/cron.pp b/modules/elastic_recheck/manifests/cron.pp index aa1e8a7c3d..137d5015d2 100644 --- a/modules/elastic_recheck/manifests/cron.pp +++ b/modules/elastic_recheck/manifests/cron.pp @@ -19,18 +19,29 @@ class elastic_recheck::cron () { $er_state_path = $::elastic_recheck::recheck_state_dir - $graph_cmd = $::elastic_recheck::graph_cmd + $graph_all_cmd = $::elastic_recheck::graph_all_cmd + $graph_gate_cmd = $::elastic_recheck::graph_gate_cmd $uncat_cmd = $::elastic_recheck::uncat_cmd - cron { 'elastic-recheck': + cron { 'elastic-recheck-all': user => 'recheck', minute => '*/15', hour => '*', - command => "cd ${er_state_path} && er_safe_run.sh ${graph_cmd}", + command => "cd ${er_state_path} && er_safe_run.sh ${graph_all_cmd}", environment => 'PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin', require => Class['elastic_recheck'] } + cron { 'elastic-recheck-gate': + user => 'recheck', + minute => '*/15', + hour => '*', + command => "sleep $((RANDOM\%60+90)) && cd ${er_state_path} && er_safe_run.sh ${graph_gate_cmd}", + environment => 'PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin', + require => Class['elastic_recheck'] + } + + cron { 'elastic-recheck-uncat': user => 'recheck', minute => '59', diff --git a/modules/elastic_recheck/manifests/init.pp b/modules/elastic_recheck/manifests/init.pp index 6a2a820e9d..b17533147f 100644 --- a/modules/elastic_recheck/manifests/init.pp +++ b/modules/elastic_recheck/manifests/init.pp @@ -23,7 +23,8 @@ class elastic_recheck ( # any commit. So we need to define commands in a way that # we can trigger an exec here, as well as on cron. $recheck_state_dir = '/var/lib/elastic-recheck' - $graph_cmd = 'elastic-recheck-graph /opt/elastic-recheck/queries -o graph-new.json && mv graph-new.json graph.json' + $graph_all_cmd = 'elastic-recheck-graph /opt/elastic-recheck/queries -o all-new.json && mv all-new.json all.json' + $graph_gate_cmd = 'elastic-recheck-graph /opt/elastic-recheck/queries -o gate-new.json -q gate && mv gate-new.json gate.json' $uncat_cmd = 'elastic-recheck-uncategorized -d /opt/elastic-recheck/queries -t /usr/local/share/elastic-recheck/templates -o uncategorized-new.html && mv uncategorized-new.html uncategorized.html' group { 'recheck': @@ -45,8 +46,18 @@ class elastic_recheck ( source => 'https://git.openstack.org/openstack-infra/elastic-recheck', } - exec { 'run_er_graph': - command => "er_safe_run.sh ${graph_cmd}", + exec { 'run_er_graph_all': + command => "er_safe_run.sh ${graph_all_cmd}", + path => '/usr/local/bin:/usr/bin:/bin/', + cwd => $recheck_state_dir, + user => 'recheck', + refreshonly => true, + require => File['/usr/local/bin/er_safe_run.sh'], + subscribe => Vcsrepo['/opt/elastic-recheck'], + } + + exec { 'run_er_graph_gate_only': + command => "er_safe_run.sh ${graph_gate_cmd}", path => '/usr/local/bin:/usr/bin:/bin/', cwd => $recheck_state_dir, user => 'recheck',