Skip to content

Commit d7b85a6

Browse files
Merge branch 'main' into fix-release-date
2 parents bca9916 + 20fccf0 commit d7b85a6

File tree

2 files changed

+79
-37
lines changed

2 files changed

+79
-37
lines changed

README.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,21 +52,52 @@ Create a virtualenv if required and install required packages using "pip install
5252
4. The CI_DailyBuildUpdates.py script when invoked with command line arguments info_type as "detailed" and zone, it will display the builds details in the provided zone.
5353

5454
```python3 CI_DailyBuildUpdates.py --info_type detailed --zone syd04```
55+
56+
5. The CI_DailyBuildUpdates.py script when invoked with command line arguments info_type as "detailed" and --job_type as "pa", it will display the builds details in the given job type.
57+
58+
Supported value [p','z','pa']
59+
60+
pa - ppc64le architecture auxilliary jobs
61+
62+
p - ppc64le architecture periodic jobs
63+
64+
z - s390x architecture periodic jobs
65+
66+
```python3 CI_DailyBuildUpdates.py --info_type detailed --job_type pa```
5567

5668

5769

5870
2. **CI_JobHistory.py:** The CI_JobHistory.py is a script which allows user to query a specific information from all builds that ran on the CI system within a given date range.
5971

6072
```python3 CI_JobHistory.py```
6173

74+
```python3 CI_Jobhistory.py --zone ``` This command line allows user to fetch query based on zone type.
75+
76+
```python3 CI_Jobhistory.py --job_type ``` This command line allows user to fetch query based on job type.
77+
78+
```python3 CI_Jobhistory.py --filter ``` This command line allows user to fetch query based on search filter.
79+
Specify the filter string to fetch jobs (Example 'heavy build' / libvirt / powervs / upgrade /multi / 4.14 / 4.15 / 4.16 / 4.17/ 4.18 )'
80+
81+
82+
6283
1. Interactive Execution: The CI_JobHistory.py can be executed in a interactive mode by setting JENKINS variable as False in config.ini file.
6384

6485
2. Non-Interactive Execution: The CI_JobHistory.py can be executed in a non-interactive mode by setting JENKINS variable as True in config.ini file, along with the JENKINS variable user needs to provide values for the following variables:
6586
```
6687
selected_ci: CI's from where to fetch the jobs.
88+
query_option: Query code to fetch information from builds.
89+
• Check Node Crash: Detects if a node crashed during execution.
90+
• Brief Job Information: Provides a summary of job execution.
91+
• Detailed Job Information: Provides in-depth details of jobs.
92+
• Failed Test Cases: Provides a list of test cases that are failed in the CI run.
93+
• Get Builds with Test Case Failures: Identifies builds where given test cases failed.
94+
• Test Case Failure Frequency: Analyzes how often test cases fail.
95+
• Get Build Based on Release: Retrieves builds corresponding to a specific release
96+
release: release that needs to be checked
97+
next release: next release or latest
98+
6799
before_date: End date.
68100
after_date: Start date.
69-
query_option: Query code to fetch information from builds.
70101
tc_name: Testcase name which will be used in quering the failure frequency.
71102
```
72103

monitor.py

Lines changed: 47 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from bs4 import BeautifulSoup
55
import urllib3
66
import requests
7+
import time
78
from datetime import datetime , timedelta
89
import xml.etree.ElementTree as ET
910
import constants
@@ -586,44 +587,54 @@ def get_quota_and_nightly(spy_link):
586587
'''
587588

588589
_,job_platform = job_classifier(spy_link)
589-
lease = ""
590+
lease = None
591+
nightly = None
592+
max_retries = 3
593+
delay = 5 # seconds
590594
build_log_url = constants.PROW_VIEW_URL + spy_link[8:] + "/build-log.txt"
591-
try:
592-
build_log_response = requests.get(build_log_url, verify=False, timeout=15)
593-
if 'ppc64le' in spy_link:
594-
if job_platform == "libvirt":
595-
job_platform+="-ppc64le-s2s"
596-
elif job_platform == "powervs":
597-
job_platform+="-[1-9]"
598-
lease = get_lease(build_log_response,job_platform)
599-
nightly = get_nightly(build_log_url,build_log_response, 'ppc64le')
600-
601-
elif 's390x' in spy_link:
602-
job_platform+="-s390x"
603-
lease = get_lease(build_log_response,job_platform )
604-
nightly = get_nightly(build_log_url,build_log_response, 's390x')
605-
elif "multi" in spy_link:
606-
if "powervs" in spy_link:
607-
job_platform = "powervs"
608-
job_platform+="-[1-9]"
609-
lease=get_lease(build_log_response,job_platform)
595+
for attempt in range(1, max_retries + 1):
596+
try:
597+
build_log_response = requests.get(build_log_url, verify=False, timeout=15)
598+
if 'ppc64le' in spy_link:
599+
if job_platform == "libvirt":
600+
job_platform += "-ppc64le-s2s"
601+
elif job_platform == "powervs":
602+
job_platform += "-[1-9]"
603+
lease = get_lease(build_log_response, job_platform)
604+
nightly = get_nightly(build_log_url, build_log_response, 'ppc64le')
605+
606+
elif 's390x' in spy_link:
607+
job_platform += "-s390x"
608+
lease = get_lease(build_log_response, job_platform)
609+
nightly = get_nightly(build_log_url, build_log_response, 's390x')
610+
611+
elif "multi" in spy_link:
612+
if "powervs" in spy_link:
613+
job_platform = "powervs-[1-9]"
614+
lease = get_lease(build_log_response, job_platform)
615+
else:
616+
job_platform = "multi"
617+
lease = get_lease(build_log_response, 'libvirt-ppc64le-s2s')
618+
nightly = get_nightly(build_log_url, build_log_response, "multi")
619+
620+
elif "mce" in spy_link:
621+
job_platform = "aws"
622+
lease = get_lease(build_log_response, job_platform)
623+
nightly = get_nightly(build_log_url, build_log_response, "multi")
624+
610625
else:
611-
job_platform="multi"
612-
lease=get_lease(build_log_response,'libvirt-ppc64le-s2s')
613-
nightly = get_nightly(build_log_url,build_log_response, "multi")
614-
615-
elif "mce" in spy_link:
616-
job_platform = "aws"
617-
lease = get_lease(build_log_response,job_platform )
618-
nightly = get_nightly(build_log_url,build_log_response, "multi")
619-
else:
620-
# lease is not applicable for SNO
621-
nightly = get_nightly(build_log_url,build_log_response, "multi")
622-
return lease, nightly
623-
except requests.Timeout:
624-
return "Request timed out"
625-
except requests.RequestException:
626-
return "Error while sending request to url"
626+
# lease is not applicable for SNO
627+
nightly = get_nightly(build_log_url, build_log_response, "multi")
628+
629+
break # If successful, break out of retry loop
630+
631+
except (requests.Timeout, requests.RequestException) as e:
632+
if attempt == max_retries - 1:
633+
print(f"Request failed after {max_retries} attempts: {e}")
634+
else:
635+
time.sleep(delay)
636+
637+
return lease, nightly
627638

628639
def job_classifier(spy_link):
629640

0 commit comments

Comments
 (0)