From 3c5d1b583f75f969bd4875d0b18fcc4a027a5c93 Mon Sep 17 00:00:00 2001 From: SungHun Hwang Date: Mon, 6 Feb 2017 14:23:11 +0900 Subject: [PATCH] [BuildMonitor] Add the image-creation check routine 1. Add the image-creation check routine to check the completion of image-creation stage at Post-release 2. modifications [job_create_snapshot.py] triggering to 'BUILD-MONITOR-POST' job [job_buildmonitor.py] get the event & fill the status in the db Change-Id: If4fa718f7d697b578d54b5e3222703c6e104d3a8 Signed-off-by: SungHun Hwang --- job_buildmonitor.py | 8 ++++---- job_create_snapshot.py | 10 ++++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/job_buildmonitor.py b/job_buildmonitor.py index 027fcd4..83509c5 100644 --- a/job_buildmonitor.py +++ b/job_buildmonitor.py @@ -82,7 +82,6 @@ def bm_connect_db(): def bm_disconnect_db(): buildmonitor_db.disconnect_db() - #=============================================================================== # [job_submit.py] @@ -689,9 +688,10 @@ def create_image_for_build_image(fields, bm_start_datetime, def end_create_image_for_sr_stage(bm_start_datetime, project): print '[%s] enter end_create_image_for_sr_stage project(%s)\n' % (__file__, project) + bm_end_datetime = datetime.datetime.now() + #if project.startswith("home:prerelease:"): if project.startswith("home:prerelease:") or project.startswith("home:trbs:"): - bm_end_datetime = datetime.datetime.now() bm_git_tag = project.split(":")[-3] + '/' + project.split(":")[-2] + '/' + project.split(":")[-1] #print '[%s] bm_git_tag(%s)\n' % (__file__, bm_git_tag) @@ -778,14 +778,14 @@ def end_create_image_for_sr_stage(bm_start_datetime, project): query = "UPDATE sr_stage SET stage_end_time = %s, stage_status = %s " \ "WHERE sr_status_id = %s AND info_stage_id = %s AND build_project_id = %s" query_data = (bm_end_datetime, 'S', - each_sr_status_id, info_stage_id, curr_build_project_id) + each_sr_status_id[0], info_stage_id, curr_build_project_id) buildmonitor_db.do_query(query, query_data) info_stage_id = POST_IMAGE query = "UPDATE sr_stage SET stage_end_time = %s, stage_status = %s " \ "WHERE sr_status_id = %s AND info_stage_id = %s AND build_project_id = %s" query_data = (bm_end_datetime, 'S', - each_sr_status_id, info_stage_id, curr_build_project_id) + each_sr_status_id[0], info_stage_id, curr_build_project_id) buildmonitor_db.do_query(query, query_data) #=============================================================================== # [job_request.py] diff --git a/job_create_snapshot.py b/job_create_snapshot.py index 60b6588..4e9c788 100755 --- a/job_create_snapshot.py +++ b/job_create_snapshot.py @@ -375,6 +375,16 @@ def main(): } trigger_next("BUILD-MONITOR-4-%s" % bm_stage, bm_data) + # To check the completion of image-creation stage at Post-release + #buildmonitor.end_create_image_for_sr_stage(bm_start_datetime, + # project) + bm_stage = 'Post_Image' + bm_data = {"bm_stage" : bm_stage, + "bm_start_datetime" : str(bm_start_datetime), + "project" : project, + } + trigger_next("BUILD-MONITOR-POST", bm_data) + if __name__ == '__main__': try: sys.exit(main()) -- 2.7.4