[BuildMonitor] change curr_sr_status_id to multi_sr_status_id 67/125667/3
authorSungHun Hwang <sh0924.hwang@samsung.com>
Tue, 18 Apr 2017 09:18:33 +0000 (18:18 +0900)
committerSungHun Hwang <sh0924.hwang@samsung.com>
Tue, 18 Apr 2017 09:59:50 +0000 (18:59 +0900)
PROBLEM:
  If a build break occur after SR accepted, the dashboard showed only one SR

ex)
  submit/tizen/xxxxxx.111111    Accepted
                               (Failed(I))
  submit/tizen/xxxxxx.222222    Accepted
                                (Imaging)
  submit/tizen/xxxxxx.333333    Accepted
                                (Imaging)

REASON:
  missing the multi_sr_status_id parts

SOLUTION:
  change curr_sr_status_id to multi_sr_status_id

Change-Id: I80c46a261c8dffa046ff36422e9fabeec61bf82e
Signed-off-by: SungHun Hwang <sh0924.hwang@samsung.com>
job_buildmonitor.py

index 194ae1b..889ff64 100644 (file)
@@ -624,19 +624,24 @@ def update_fail_create_image_for_sr_stage(fields, bm_start_datetime, bm_snapshot
         post_build_project_id = buildmonitor_db.get_value_from_query_data(query, query_data)
         print '[%s] post_build_project_id(%s)\n' % (__file__, post_build_project_id)
 
-        # get curr_sr_status_id
+        # get multi_sr_status_id
         query = "SELECT sr_status_id FROM sr_status_detail WHERE post_build_project_id = %s"
         query_data = (post_build_project_id,)
-        curr_sr_status_id = buildmonitor_db.get_value_from_query_data(query, query_data)
-        #print '[%s] curr_sr_status_id(%s)\n' % (__file__, curr_sr_status_id)
+        multi_sr_status_id = buildmonitor_db.get_multi_values_from_query_data(query, query_data)
+        #print '[%s] multi_sr_status_id(%s)\n' \
+        #      % (__file__, multi_sr_status_id)
 
-        ### [POST_IMAGE] stage : update fail status for [post] image creation
-        info_stage_id = POST_IMAGE
-        query = "UPDATE sr_stage SET stage_start_time = %s, 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_start_datetime, bm_end_datetime, 'F',
-                      curr_sr_status_id, info_stage_id, post_build_project_id)
-        buildmonitor_db.do_query(query, query_data)
+        ### [POST_IMAGE] stage end : [POST] image creation
+        for each_sr_status_id in multi_sr_status_id:
+            print '[%s] each_sr_status_id(%s)\n' % (__file__, each_sr_status_id)
+
+            ### [POST_IMAGE] stage : update fail status for [post] image creation
+            info_stage_id = POST_IMAGE
+            query = "UPDATE sr_stage SET stage_start_time = %s, 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_start_datetime, bm_end_datetime, 'F',
+                          each_sr_status_id[0], info_stage_id, post_build_project_id)
+            buildmonitor_db.do_query(query, query_data)
 
 def create_image_for_build_image(fields, bm_start_datetime,
                                  bm_end_datetime, bm_snapshot_name, bm_img_size):