Merge "Generate two elastic-recheck-graph json files all, and gate only"

This commit is contained in:
Jenkins 2014-02-10 23:20:57 +00:00 committed by Gerrit Code Review
commit 60fd91d2c0
2 changed files with 28 additions and 6 deletions

View File

@ -19,18 +19,29 @@
class elastic_recheck::cron () { class elastic_recheck::cron () {
$er_state_path = $::elastic_recheck::recheck_state_dir $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 $uncat_cmd = $::elastic_recheck::uncat_cmd
cron { 'elastic-recheck': cron { 'elastic-recheck-all':
user => 'recheck', user => 'recheck',
minute => '*/15', minute => '*/15',
hour => '*', 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', environment => 'PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin',
require => Class['elastic_recheck'] 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': cron { 'elastic-recheck-uncat':
user => 'recheck', user => 'recheck',
minute => '59', minute => '59',

View File

@ -23,7 +23,8 @@ class elastic_recheck (
# any commit. So we need to define commands in a way that # any commit. So we need to define commands in a way that
# we can trigger an exec here, as well as on cron. # we can trigger an exec here, as well as on cron.
$recheck_state_dir = '/var/lib/elastic-recheck' $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' $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': group { 'recheck':
@ -45,8 +46,18 @@ class elastic_recheck (
source => 'https://git.openstack.org/openstack-infra/elastic-recheck', source => 'https://git.openstack.org/openstack-infra/elastic-recheck',
} }
exec { 'run_er_graph': exec { 'run_er_graph_all':
command => "er_safe_run.sh ${graph_cmd}", 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/', path => '/usr/local/bin:/usr/bin:/bin/',
cwd => $recheck_state_dir, cwd => $recheck_state_dir,
user => 'recheck', user => 'recheck',