Skip to content
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

#256: Fixed type hints #260

Merged
merged 12 commits into from
Jan 27, 2025
Prev Previous commit
Next Next commit
Removed ExportContainerBaseTask.task_logger
  • Loading branch information
tomuben committed Jan 27, 2025
commit 45c4c0ed8d7b73bdec780c5c4c9bbfc1618fd108
13 changes: 6 additions & 7 deletions exasol/slc/internal/tasks/export/export_container_base_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@


class ExportContainerBaseTask(FlavorBaseTask):
task_logger = logging.getLogger("luigi-interface")
export_path: Optional[str] = luigi.OptionalParameter(None) # type: ignore
release_name: Optional[str] = luigi.OptionalParameter(None) # type: ignore
release_goal: str = luigi.Parameter(None) # type: ignore
Expand Down Expand Up @@ -149,15 +148,15 @@ def _remove_cached_exported_file_if_requested(
or build_config().force_pull
or not checksum_file.exists()
):
self.task_logger.info("Removed container file %s", release_file)
self.logger.info("Removed container file %s", release_file)
os.remove(release_file)
if checksum_file.exists():
os.remove(checksum_file)

def _export_release(
self, release_image_name: str, release_file: Path, checksum_file: Path
) -> None:
self.task_logger.info("Create container file %s", release_file)
self.logger.info("Create container file %s", release_file)
temp_directory = tempfile.mkdtemp(
prefix="release_archive_", dir=build_config().temporary_base_directory
)
Expand All @@ -176,7 +175,7 @@ def _export_release(
shutil.rmtree(temp_directory)

def _compute_checksum(self, release_file: Path, checksum_file: Path) -> None:
self.task_logger.info("Compute checksum for container file %s", release_file)
self.logger.info("Compute checksum for container file %s", release_file)
command = f"""{CHECKSUM_ALGORITHM} '{release_file}'"""
completed_process = subprocess.run(shlex.split(command), capture_output=True)
completed_process.check_returncode()
Expand All @@ -188,7 +187,7 @@ def _compute_checksum(self, release_file: Path, checksum_file: Path) -> None:
def _create_and_export_container(
self, release_image_name: str, temp_directory: str
) -> str:
self.task_logger.info("Export container %s", release_image_name)
self.logger.info("Export container %s", release_image_name)
with self._get_docker_client() as docker_client:
container = docker_client.containers.create(image=release_image_name)
try:
Expand All @@ -215,7 +214,7 @@ def _export_container(
def _pack_release_file(
self, log_path: Path, extract_dir: str, release_file: Path
) -> None:
self.task_logger.info("Pack container file %s", release_file)
self.logger.info("Pack container file %s", release_file)
extract_content = " ".join(f"'{file}'" for file in os.listdir(extract_dir))
if not str(release_file).endswith("tar.gz"):
raise ValueError(
Expand Down Expand Up @@ -256,7 +255,7 @@ def _modify_extracted_container(extract_dir: str) -> None:
def _extract_exported_container(
self, log_path: Path, export_file: str, temp_directory: str
) -> str:
self.task_logger.info("Extract exported file %s", export_file)
self.logger.info("Extract exported file %s", export_file)
extract_dir = temp_directory + "/extract"
os.makedirs(extract_dir)
excludes = " ".join(
Expand Down
Loading