Skip to content

Commit e798cb9

Browse files
address comment
1 parent 4c164df commit e798cb9

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

monitor.py

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ def fetch_build_time(build):
5555

5656
try:
5757
response = requests.get(url, verify=False, timeout=15)
58+
<<<<<<< HEAD
5859
<<<<<<< HEAD
5960
if response.status_code == 200:
6061
buildtime = json.loads(response.text)
@@ -79,19 +80,31 @@ def fetch_build_time(build):
7980

8081
buildtime = response.json() # Directly parse JSON
8182
timestamp_str = buildtime["metadata"]["creationTimestamp"]
83+
=======
84+
if response.status_code == 200:
85+
buildtime = json.loads(response.text)
86+
timestamp_str = buildtime["metadata"]["creationTimestamp"]
87+
>>>>>>> 342858c (address comment)
8288

8389
# Convert timestamp to datetime object (UTC)
84-
utc_time = datetime.strptime(timestamp_str, "%Y-%m-%dT%H:%M:%SZ")
90+
utc_time = datetime.strptime(timestamp_str, "%Y-%m-%dT%H:%M:%SZ")
8591

8692
# Convert UTC to IST (UTC +5:30)
87-
ist_time = utc_time + timedelta(hours=5, minutes=30)
93+
ist_time = utc_time + timedelta(hours=5, minutes=30)
8894

8995
# Extract date and time separately
90-
ist_date = ist_time.strftime("%Y-%m-%d") # YYYY-MM-DD
91-
ist_time_formatted = ist_time.strftime("%H:%M") # HH:MM (without seconds)
96+
ist_date = ist_time.strftime("%Y-%m-%d") # YYYY-MM-DD
97+
ist_time_formatted = ist_time.strftime("%H:%M") # HH:MM (without seconds)
9298

99+
return ist_date, ist_time_formatted # Returning both date and time
100+
else:
101+
return 'ERROR'
102+
103+
<<<<<<< HEAD
93104
return ist_date, ist_time_formatted # Returning both date and time
94105
>>>>>>> 2464102 (Added Time in both brief and detailed output)
106+
=======
107+
>>>>>>> 342858c (address comment)
95108

96109
except requests.Timeout:
97110
return "Request timed out", None
@@ -1342,11 +1355,15 @@ def get_detailed_job_info(build_list,prow_ci_name,zone=None):
13421355
date,time=fetch_build_time(build)
13431356

13441357
print(i,"Job link:"+constants.JOB_LINK_URL+build)
1358+
<<<<<<< HEAD
13451359
<<<<<<< HEAD
13461360
print("Build start time: "+time +" "+date)
13471361
=======
13481362
print("Build started time: "+time +" "+date)
13491363
>>>>>>> 2464102 (Added Time in both brief and detailed output)
1364+
=======
1365+
print("Build start time: "+time +" "+date)
1366+
>>>>>>> 342858c (address comment)
13501367

13511368
build_status = check_job_status(build)
13521369
sensitive_info_expose_status=check_if_sensitive_info_exposed(build)

0 commit comments

Comments
 (0)