Log start/stop times of gerrit user sync script.

Add rudimentary logging to the gerrit user sync script. Log the start
and stop times of script runs. Also modify timeout in the cronjob to
allow the job to run for up to 8 hours in order to get better log data.

Change-Id: I193911e2d4dcd6448ef8a61360e6fc9fff287c1a
Reviewed-on: https://review.openstack.org/11658
Reviewed-by: James E. Blair <corvus@inaugust.com>
Approved: James E. Blair <corvus@inaugust.com>
Tested-by: Jenkins
This commit is contained in:
Clark Boylan 2012-08-20 10:35:00 -07:00 committed by Jenkins
parent db0ea935a1
commit 92ede36c64
2 changed files with 8 additions and 1 deletions

View File

@ -52,6 +52,10 @@ except IOError:
# another instance is running
sys.exit(0)
log_file = '/home/gerrit2/lp_sync_log'
log_fp = open(log_file, 'a')
log_fp.write('sync start ' + str(datetime.now()) + '\n')
parser = argparse.ArgumentParser()
parser.add_argument('user', help='The gerrit admin user')
parser.add_argument('ssh_key', help='The gerrit admin SSH key file')
@ -409,3 +413,6 @@ os.system("ssh -i %s -p29418 %s@localhost gerrit flush-caches" %
(GERRIT_SSH_KEY, GERRIT_USER))
conn.commit()
log_fp.write('sync stop ' + str(datetime.now()) + '\n')
log_fp.close()

View File

@ -29,7 +29,7 @@ class launchpad_sync(
cron { "sync_launchpad_users":
user => $user,
minute => "*/15",
command => "sleep $((RANDOM\\%60+60)) && timeout -k 5m 65m python /usr/local/bin/update_gerrit_users.py ${script_user} ${script_key_file} ${site} ${root_team}",
command => "sleep $((RANDOM\\%60+60)) && timeout -k 5m 8h python /usr/local/bin/update_gerrit_users.py ${script_user} ${script_key_file} ${site} ${root_team}",
require => File['/usr/local/bin/update_gerrit_users.py'],
}