Skip to content

Add support to fetch a single success job by setting a flag #101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CI_JobHistory.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ def main():
parser.add_argument('--zone', help='specify the lease/zone', type= lambda arg:arg.split(','))
parser.add_argument('--job_type', default='p', choices=['p','z','pa'], help= 'Specify the CI job type (Power(p) or s390x(z) or Power Auxillary(pa)), default is p')
parser.add_argument('--filter',default='All',type= lambda arg:arg.split(','), help='Specify the filter string to fetch jobs (Example heavy build / libvirt / powervs / upgrade / 4.14 / 4.15 / 4.16 / 4.17/ 4.18 )')
parser.add_argument('--fetch_one_success_job',action='store_true', help='Set this flag to check job runs until one success job is found')
args = parser.parse_args()
filter=args.filter

Expand Down Expand Up @@ -372,7 +373,7 @@ def main():
if option == '7':
for ci_name,ci_link in ci_list.items():
spy_links = monitor.get_jobs_with_date(ci_link,start_date,end_date)
monitor.get_detailed_job_info(spy_links,ci_name,zone=args.zone)
monitor.get_detailed_job_info(spy_links,ci_name,zone=args.zone,fetch_one_success_job=args.fetch_one_success_job)
monitor.final_job_list = []

if __name__ == "__main__":
Expand Down
6 changes: 4 additions & 2 deletions monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1118,7 +1118,6 @@ def get_jobs_with_date(prowci_url,start_date,end_date):
if end_date <= job_time <= start_date and ele["Result"] != "PENDING" :
job_log_path = ele["SpyglassLink"]
final_job_list.append(job_log_path)

#build match extracts the next page spylink
build_regex = r"/([^/?]+)\?.+"
build_match = re.search(build_regex,next_link)
Expand Down Expand Up @@ -1266,7 +1265,7 @@ def get_brief_job_info(build_list,prow_ci_name,zone=None):
summary_list.append(job_dict)
return summary_list

def get_detailed_job_info(build_list,prow_ci_name,zone=None):
def get_detailed_job_info(build_list,prow_ci_name,zone=None,fetch_one_success_job=False):

"""
Prints detailed information of all the jobs.
Expand Down Expand Up @@ -1320,6 +1319,9 @@ def get_detailed_job_info(build_list,prow_ci_name,zone=None):
print("Lease Quota-", lease)
check_node_crash(build)
print("Build Passed")
if fetch_one_success_job == True:
print("Found a passed job, hence ignoring subsequent jobs")
break
elif build_status == 'FAILURE':
cluster_status=cluster_deploy_status(build)
if "sno" not in build:
Expand Down