SR-SYNC: Wait until the dashboard finalizing snapshot info 48/143648/1
authorhyokeun <hyokeun.jeon@samsung.com>
Fri, 11 Aug 2017 00:49:18 +0000 (09:49 +0900)
committerhyokeun <hyokeun.jeon@samsung.com>
Fri, 11 Aug 2017 00:49:34 +0000 (09:49 +0900)
Problem: No data if the dashboard has not been updated snapshot info.
Cause: Waiting for the completion of post-snapshot job or BUILD-MONITOR.
Fix: Wait some time and request again.

Change-Id: Ia880c61e7eb3b1792be4f35141f4618aa2d98ed9

job_submit_request_sync.py

index 5b76e22..b846b1a 100644 (file)
@@ -117,7 +117,15 @@ def main():
         project = os.getenv('UPSTREAM_OBS_PROJECT')
         #target_project = os.getenv('TARGET_PROJECT')
         # Retrieve SR list of the snapshot from dashboard
-        official_data = request_sr_list_for_snapshot(project, snapshot, reason)
+        retry_count = 10
+        while retry_count > 0:
+            official_data = request_sr_list_for_snapshot(project, snapshot, reason)
+            if len(official_data['requests'][0]['submit_list']) <= 0:
+                print 'Fetching dashboard data failed, retrying...'
+                retry_count -= 1; sleep(180); continue
+            break
+        if retry_count <= 0:
+            raise Exception('Fail to fetch snapshot info from dashboard')
     elif os.getenv('TRIGGER_INFO', None):
         manual_trigger = trigger_info(os.getenv('TRIGGER_INFO'))
         snapshot = 'SR-SYNC'