From 96eb81033ff07898f1485ded8429aef4596e5f4a Mon Sep 17 00:00:00 2001 From: zhiren Date: Tue, 7 Nov 2023 11:43:31 -0500 Subject: [PATCH 1/3] update the error message when user abort folder merging --- app/services/file_manager/file_upload/file_upload.py | 12 +++++++++--- app/services/output_manager/message_handler.py | 4 ++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/services/file_manager/file_upload/file_upload.py b/app/services/file_manager/file_upload/file_upload.py index 93224751..9ad2b925 100644 --- a/app/services/file_manager/file_upload/file_upload.py +++ b/app/services/file_manager/file_upload/file_upload.py @@ -12,6 +12,7 @@ from typing import Tuple import click +from click.exceptions import Abort import app.services.logger_services.log_functions as logger import app.services.output_manager.message_handler as mhandler @@ -194,9 +195,14 @@ def simple_upload( # noqa: C901 elif len(duplicated_file) > 0: mhandler.SrvOutPutHandler.file_duplication_check_success() duplicate_warning_format = '\n'.join(duplicated_file) - click.confirm( - customized_error_msg(ECustomizedError.UPLOAD_SKIP_DUPLICATION) % (duplicate_warning_format), abort=True - ) + try: + click.confirm( + customized_error_msg(ECustomizedError.UPLOAD_SKIP_DUPLICATION) % (duplicate_warning_format), + abort=True, + ) + except Abort: + mhandler.SrvOutPutHandler.cancel_upload() + exit(1) # here is list of pre upload result. We decided to call pre upload api by batch pre_upload_infos = [] diff --git a/app/services/output_manager/message_handler.py b/app/services/output_manager/message_handler.py index a6aab665..e7fbfd24 100644 --- a/app/services/output_manager/message_handler.py +++ b/app/services/output_manager/message_handler.py @@ -191,6 +191,10 @@ def start_uploading(filename): """e.g. Start Uploading: ./test_file.""" logger.info(f'Starting upload of: {filename}') + @staticmethod + def cancel_upload(): + logger.warning('Upload cancelled.') + @staticmethod def start_requests(): """e.g. start requests.""" From ee426d5f1f93216e179665eb2c8ab5b370629088 Mon Sep 17 00:00:00 2001 From: zhiren Date: Tue, 7 Nov 2023 11:44:47 -0500 Subject: [PATCH 2/3] update command sync to download --- app/commands/file.py | 2 +- tests/app/commands/test_entry_point.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/commands/file.py b/app/commands/file.py index a77a0dc0..58871f25 100644 --- a/app/commands/file.py +++ b/app/commands/file.py @@ -349,7 +349,7 @@ def file_list(paths, zone, page, page_size, detached): srv_list.list_files_with_pagination(paths, zone, page, page_size) -@click.command(name='sync') +@click.command(name='download') @click.argument('paths', type=click.STRING, nargs=-1) @click.argument('output_path', type=click.Path(exists=True), nargs=1) @click.option( diff --git a/tests/app/commands/test_entry_point.py b/tests/app/commands/test_entry_point.py index b95ea560..2085de4b 100644 --- a/tests/app/commands/test_entry_point.py +++ b/tests/app/commands/test_entry_point.py @@ -60,7 +60,7 @@ def test_file_commands(user_login_true): 'upload': file_put, 'attribute-list': file_check_manifest, 'attribute-export': file_export_manifest, - 'sync': file_download, + 'download': file_download, 'resume': file_resume, } file_commands_object = entry_point.commands.get('file') From 8bacc7e02f4f7f3a1cd7ec113d1ca271db65e20f Mon Sep 17 00:00:00 2001 From: zhiren Date: Tue, 7 Nov 2023 11:45:06 -0500 Subject: [PATCH 3/3] bumpup the version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index d442ac23..3378cefa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "app" -version = "2.8.0" +version = "2.8.1" description = "This service is designed to support pilot platform" authors = ["Indoc Systems"]