[BuildMonitor] Add the image-creation check routine
authorSungHun Hwang <sh0924.hwang@samsung.com>
Mon, 6 Feb 2017 05:23:11 +0000 (14:23 +0900)
committerSoonKyu Park <sk7.park@samsung.com>
Thu, 23 Feb 2017 08:35:19 +0000 (17:35 +0900)
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 <sh0924.hwang@samsung.com>
job_buildmonitor.py
job_create_snapshot.py

index 027fcd4..83509c5 100644 (file)
@@ -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]
index 60b6588..4e9c788 100755 (executable)
@@ -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())