From 69e8a790e9d435dc4b9c9e8bffd9767b08c1422d Mon Sep 17 00:00:00 2001 From: Avrohom Gottlieb Date: Sun, 8 Dec 2024 13:06:32 -0500 Subject: [PATCH] remove logging --- api/scpca_portal/loader.py | 5 +--- .../commands/download_input_files.py | 29 ------------------- api/scpca_portal/s3.py | 7 ++--- 3 files changed, 3 insertions(+), 38 deletions(-) delete mode 100644 api/scpca_portal/management/commands/download_input_files.py diff --git a/api/scpca_portal/loader.py b/api/scpca_portal/loader.py index c8248412..f5abc638 100644 --- a/api/scpca_portal/loader.py +++ b/api/scpca_portal/loader.py @@ -8,7 +8,7 @@ from django.template.defaultfilters import pluralize from scpca_portal import metadata_file, s3 -from scpca_portal.config.logging import configure_runtime_logging, get_and_configure_logger +from scpca_portal.config.logging import get_and_configure_logger from scpca_portal.models import ( ComputedFile, Contact, @@ -19,7 +19,6 @@ ) logger = get_and_configure_logger(__name__) -log_runtime = configure_runtime_logging(logger) def prep_data_dirs(wipe_input_dir: bool = False, wipe_output_dir: bool = True) -> None: @@ -143,7 +142,6 @@ def create_project( return project -@log_runtime def _create_computed_file( computed_file: ComputedFile, update_s3: bool, clean_up_output_data: bool ) -> None: @@ -174,7 +172,6 @@ def _create_computed_file_callback(future, *, update_s3: bool, clean_up_output_d connection.close() -@log_runtime def generate_computed_file( *, download_config: Dict, diff --git a/api/scpca_portal/management/commands/download_input_files.py b/api/scpca_portal/management/commands/download_input_files.py deleted file mode 100644 index 1627f47a..00000000 --- a/api/scpca_portal/management/commands/download_input_files.py +++ /dev/null @@ -1,29 +0,0 @@ -import logging - -from django.core.management.base import BaseCommand - -from scpca_portal import common, loader, s3 -from scpca_portal.models import Project - -logger = logging.getLogger() -logger.setLevel(logging.INFO) -logger.addHandler(logging.StreamHandler()) - - -class Command(BaseCommand): - def handle(self, *args, **kwargs): - loader.prep_data_dirs(True) - - project = Project.objects.filter(scpca_id="SCPCP000006").first() - - download_config = common.PROJECT_DOWNLOAD_CONFIGS["SPATIAL_SINGLE_CELL_EXPERIMENT"] - libraries = project.get_libraries(download_config) - - library_data_file_paths = [ - fp for lib in libraries for fp in lib.get_download_config_file_paths(download_config) - ] - project_data_file_paths = project.get_download_config_file_paths(download_config) - - s3.download_input_files( - library_data_file_paths + project_data_file_paths, project.s3_input_bucket - ) diff --git a/api/scpca_portal/s3.py b/api/scpca_portal/s3.py index 73ee5ee6..8664829b 100644 --- a/api/scpca_portal/s3.py +++ b/api/scpca_portal/s3.py @@ -8,11 +8,9 @@ import boto3 from botocore.client import Config -from scpca_portal.config.logging import configure_runtime_logging, get_and_configure_logger +from scpca_portal.config.logging import get_and_configure_logger logger = get_and_configure_logger(__name__) -log_runtime = configure_runtime_logging(logger) - aws_s3 = boto3.client("s3", config=Config(signature_version="s3v4")) @@ -82,7 +80,6 @@ def list_input_paths( return file_paths -@log_runtime def download_input_files(file_paths: List[Path], bucket_name: str) -> bool: """Download all passed data file paths which have not previously been downloaded.'""" @@ -99,7 +96,7 @@ def download_input_files(file_paths: List[Path], bucket_name: str) -> bool: bucket_path = Path(file_path.parts[0]) if len(file_path.parts) > 2: - bucket_path = bucket_path / file_path.parts[1] + bucket_path /= file_path.parts[1] download_queue[bucket_path].append(file_path.relative_to(bucket_path))