From ecfc3c8bff319f34bff3dadb834f01b9491ae04e Mon Sep 17 00:00:00 2001 From: shubham-html-css-js Date: Mon, 22 Jan 2024 17:21:25 +0530 Subject: [PATCH] Fix errors in ci puller job --- core/opl/shovel.py | 5 ++--- opl/shovel.py | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) mode change 100644 => 100755 opl/shovel.py diff --git a/core/opl/shovel.py b/core/opl/shovel.py index 57a5133..3ed2541 100755 --- a/core/opl/shovel.py +++ b/core/opl/shovel.py @@ -17,7 +17,6 @@ def list(self): response = requests.get(f"{self.args.prow_base_url}/{self.args.prow_job_name}") # Extract 19-digit numbers using regular expression numbers = re.findall(r"\b[0-9]{19}\b", response.text) - # Sort the numbers in natural order and get the last 10 unique numbers sorted_numbers = sorted(set(numbers), key=lambda x: int(x)) last_10_numbers = sorted_numbers[-10:] @@ -27,10 +26,10 @@ def download(self): from_url = f"{self.args.prow_base_url}/{self.args.prow_job_name}/{self.args.prow_test_name}/{self.args.prow_artifact_path}" to_path = f"{self.args.prow_data_file}" if not os.path.isfile(to_path): - logging.info(f"INFO: Downloading {from_url} ... ", end="") + logging.info(f"INFO: Downloading {from_url} ... ") response = requests.get(f"{from_url}") with open(to_path, "w") as f: - f.write(response.content) + f.write(json.dumps(response.json())) logging.info("DONE") else: logging.info(f"DEBUG: File {to_path} already present, skipping download") diff --git a/opl/shovel.py b/opl/shovel.py old mode 100644 new mode 100755 index 57a5133..3ed2541 --- a/opl/shovel.py +++ b/opl/shovel.py @@ -17,7 +17,6 @@ def list(self): response = requests.get(f"{self.args.prow_base_url}/{self.args.prow_job_name}") # Extract 19-digit numbers using regular expression numbers = re.findall(r"\b[0-9]{19}\b", response.text) - # Sort the numbers in natural order and get the last 10 unique numbers sorted_numbers = sorted(set(numbers), key=lambda x: int(x)) last_10_numbers = sorted_numbers[-10:] @@ -27,10 +26,10 @@ def download(self): from_url = f"{self.args.prow_base_url}/{self.args.prow_job_name}/{self.args.prow_test_name}/{self.args.prow_artifact_path}" to_path = f"{self.args.prow_data_file}" if not os.path.isfile(to_path): - logging.info(f"INFO: Downloading {from_url} ... ", end="") + logging.info(f"INFO: Downloading {from_url} ... ") response = requests.get(f"{from_url}") with open(to_path, "w") as f: - f.write(response.content) + f.write(json.dumps(response.json())) logging.info("DONE") else: logging.info(f"DEBUG: File {to_path} already present, skipping download")