From fee423fe7a046c9f818a6a05ac4bf5b0b958a16f Mon Sep 17 00:00:00 2001 From: Ruge Li <91452427+rugeli@users.noreply.github.com> Date: Tue, 26 Sep 2023 17:10:11 -0700 Subject: [PATCH] add upload_results as a config option (#191) * upload local recipes to S3 * update README and add boto3 into requirements * lint * rerange import order * add save_file for S3 uploads and url generation * delete redundant error msg * add "upload_results" in config files as an option * conditionally call post_and_open_file * add check `number_of_packings` * update conditional statement * update --- cellpack/autopack/loaders/config_loader.py | 1 + cellpack/autopack/writers/__init__.py | 5 ++++- cellpack/tests/packing-configs/test_parallel_config.json | 3 ++- .../tests/packing-configs/test_variable_count_config.json | 3 ++- examples/packing-configs/pcna_parallel_packing_config.json | 3 ++- examples/packing-configs/peroxisome_packing_config.json | 3 ++- .../packing-configs/peroxisome_parallel_packing_config.json | 5 +++-- examples/packing-configs/run.json | 3 ++- 8 files changed, 18 insertions(+), 8 deletions(-) diff --git a/cellpack/autopack/loaders/config_loader.py b/cellpack/autopack/loaders/config_loader.py index 252a03be5..7b071af21 100644 --- a/cellpack/autopack/loaders/config_loader.py +++ b/cellpack/autopack/loaders/config_loader.py @@ -43,6 +43,7 @@ class ConfigLoader(object): "show_sphere_trees": False, "show_progress_bar": False, "spacing": None, + "upload_results": False, "use_periodicity": False, "version": 1.0, } diff --git a/cellpack/autopack/writers/__init__.py b/cellpack/autopack/writers/__init__.py index d67a91928..0d1893124 100644 --- a/cellpack/autopack/writers/__init__.py +++ b/cellpack/autopack/writers/__init__.py @@ -185,7 +185,10 @@ def save_as_simularium(self, env, all_ingr_as_array, compartments): file_name = env.helper.writeToFile( env.result_file, env.boundingBox, env.name, env.version ) - autopack.helper.post_and_open_file(file_name) + if env.config_data.get( + "upload_results", env.config_data.get("number_of_packings", 1) <= 1 + ): + autopack.helper.post_and_open_file(file_name) def save_Mixed_asJson( self, diff --git a/cellpack/tests/packing-configs/test_parallel_config.json b/cellpack/tests/packing-configs/test_parallel_config.json index 162f1cab4..e7b528e3c 100644 --- a/cellpack/tests/packing-configs/test_parallel_config.json +++ b/cellpack/tests/packing-configs/test_parallel_config.json @@ -14,5 +14,6 @@ "number_of_packings": 5, "spacing": null, "use_periodicity": false, - "show_sphere_trees": true + "show_sphere_trees": true, + "upload_results": false } \ No newline at end of file diff --git a/cellpack/tests/packing-configs/test_variable_count_config.json b/cellpack/tests/packing-configs/test_variable_count_config.json index 013bb3ab9..564400e5f 100644 --- a/cellpack/tests/packing-configs/test_variable_count_config.json +++ b/cellpack/tests/packing-configs/test_variable_count_config.json @@ -13,5 +13,6 @@ "spacing": null, "parallel": false, "use_periodicity": false, - "show_sphere_trees": true + "show_sphere_trees": true, + "upload_results": false } \ No newline at end of file diff --git a/examples/packing-configs/pcna_parallel_packing_config.json b/examples/packing-configs/pcna_parallel_packing_config.json index 8b7c00af5..ffc847fee 100644 --- a/examples/packing-configs/pcna_parallel_packing_config.json +++ b/examples/packing-configs/pcna_parallel_packing_config.json @@ -16,5 +16,6 @@ "show_progress_bar": true, "spacing": 2.5, "use_periodicity": false, - "show_sphere_trees": false + "show_sphere_trees": false, + "upload_results": false } \ No newline at end of file diff --git a/examples/packing-configs/peroxisome_packing_config.json b/examples/packing-configs/peroxisome_packing_config.json index a7ff885a4..461705aec 100644 --- a/examples/packing-configs/peroxisome_packing_config.json +++ b/examples/packing-configs/peroxisome_packing_config.json @@ -14,5 +14,6 @@ "spacing": 2.5, "use_periodicity": false, "show_sphere_trees": false, - "load_from_grid_file": false + "load_from_grid_file": true, + "upload_results": false } \ No newline at end of file diff --git a/examples/packing-configs/peroxisome_parallel_packing_config.json b/examples/packing-configs/peroxisome_parallel_packing_config.json index b6bcd5a1c..d20a272cd 100644 --- a/examples/packing-configs/peroxisome_parallel_packing_config.json +++ b/examples/packing-configs/peroxisome_parallel_packing_config.json @@ -18,7 +18,8 @@ "show_sphere_trees": false, "image_export_options": { "hollow": false, - "voxel_size": [1,1,1], + "voxel_size": [1, 1, 1], "projection_axis": "z" - } + }, + "upload_results": false } \ No newline at end of file diff --git a/examples/packing-configs/run.json b/examples/packing-configs/run.json index 18f658e12..7a10d021b 100644 --- a/examples/packing-configs/run.json +++ b/examples/packing-configs/run.json @@ -13,5 +13,6 @@ "use_periodicity": false, "show_sphere_trees": false, "load_from_grid_file": false, - "save_converted_recipe": true + "save_converted_recipe": true, + "upload_results": true } \ No newline at end of file