From aee059c74e1d0832b7a809fdf943dac7a303303a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Brand=C3=A3o?= <555migalves555@gmail.com> Date: Tue, 8 Aug 2023 11:12:36 +0100 Subject: [PATCH 1/2] using unused statuses for cps data-indices file upload MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miguel Brandão <555migalves555@gmail.com> --- deepsearch/cps/cli/data_indices_typer.py | 7 ++++++- deepsearch/cps/data_indices/utils.py | 6 +++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/deepsearch/cps/cli/data_indices_typer.py b/deepsearch/cps/cli/data_indices_typer.py index ade0f569..ab684d48 100644 --- a/deepsearch/cps/cli/data_indices_typer.py +++ b/deepsearch/cps/cli/data_indices_typer.py @@ -157,7 +157,7 @@ def upload_files( raise typer.Abort() coords = ElasticProjectDataCollectionSource(proj_key=proj_key, index_key=index_key) - utils.upload_files( + statuses = utils.upload_files( api=api, coords=coords, url=urls, @@ -165,6 +165,11 @@ def upload_files( s3_coordinates=cos_coordinates, ) + if all([status == "SUCCESS" for status in statuses]): + typer.echo("File upload completed successfully") + else: + # TODO + typer.echo("Some files did not upload successfully") @app.command( name="add-attachment", help="Add attachment to a index item", no_args_is_help=True diff --git a/deepsearch/cps/data_indices/utils.py b/deepsearch/cps/data_indices/utils.py index 53058035..b3168be0 100644 --- a/deepsearch/cps/data_indices/utils.py +++ b/deepsearch/cps/data_indices/utils.py @@ -94,7 +94,7 @@ def process_url_input( ) print(success_message) - return + return statuses def process_local_file( @@ -160,7 +160,7 @@ def process_local_file( ) print(success_message) cleanup(root_dir=root_dir) - return + return statuses def process_external_cos( @@ -197,4 +197,4 @@ def process_external_cos( api=api, cps_proj_key=coords.proj_key, task_ids=task_ids ) print(success_message) - return + return statuses From 55c09740d2a4356884063521f68fadc38ef562e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Brand=C3=A3o?= <555migalves555@gmail.com> Date: Tue, 8 Aug 2023 11:25:02 +0100 Subject: [PATCH 2/2] passing pre-commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miguel Brandão <555migalves555@gmail.com> --- deepsearch/cps/cli/data_indices_typer.py | 1 + 1 file changed, 1 insertion(+) diff --git a/deepsearch/cps/cli/data_indices_typer.py b/deepsearch/cps/cli/data_indices_typer.py index ab684d48..acb22a4a 100644 --- a/deepsearch/cps/cli/data_indices_typer.py +++ b/deepsearch/cps/cli/data_indices_typer.py @@ -171,6 +171,7 @@ def upload_files( # TODO typer.echo("Some files did not upload successfully") + @app.command( name="add-attachment", help="Add attachment to a index item", no_args_is_help=True )