From f7f85b5870fa31ff96606128408fc9fed38c420a Mon Sep 17 00:00:00 2001 From: Daniel <d.hornung@indiscale.com> Date: Fri, 29 Nov 2024 12:07:25 +0100 Subject: [PATCH] FIX: Miscellaneous changes for code review. --- src/ruqad/qualitycheck.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/ruqad/qualitycheck.py b/src/ruqad/qualitycheck.py index f3b9a54..2b17bfc 100755 --- a/src/ruqad/qualitycheck.py +++ b/src/ruqad/qualitycheck.py @@ -117,8 +117,7 @@ out : bool self._download_result(job_id=job_id, target_dir=target_dir) except self.CheckFailed as cfe: print("Check failed") - from IPython import embed - embed() + breakpoint() check_ok = False @@ -156,7 +155,8 @@ This deletes all the objects in the bucket. for name in zipf.namelist(): if name.endswith(".json"): continue - self._upload(os.path.join(tmp, name), remove_prefix=tmp) + if upload: + self._upload(os.path.join(tmp, name), remove_prefix=tmp) def _upload(self, filename: str, remove_prefix: Optional[str] = None): """Upload the file to the S3 bucket. @@ -178,7 +178,8 @@ remove_prefix : Optional[str] target_filename = filename if remove_prefix: - assert filename.startswith(remove_prefix) + if not filename.startswith(remove_prefix): + raise ValueError(f"{filename} was expected to start with {remove_prefix}") target_filename = filename[len(remove_prefix):] self._s3_client.upload_file(filename, self._bucketname, os.path.join("data", target_filename)) @@ -233,6 +234,10 @@ remove_prefix : Optional[str] raise self.CheckFailed(result) # Get jobs. + # We expect that these jobs are run runby the pipeline: + # - evaluate: run the quality check + # - report: build the report + # - pages: publish the report (not relevant for us) cmd = [ "curl", "--header", f"PRIVATE-TOKEN: {self._config['gitlab_api_token']}", -- GitLab