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

add upload_results as a config option #191

Merged
merged 14 commits into from
Sep 27, 2023

Conversation

rugeli
Copy link
Collaborator

@rugeli rugeli commented Sep 8, 2023

Problem

What is the problem this work solves, including
closes #190

Solution

What I/we did to solve this problem

  • added a key `upload_results in the config file
  • check config file settings before calling post_and_open_file, to prevent excessive uploads to S3 as well as to avoid opening multiple browser tabs unnecessarily

the action takes place when:

  • If upload_results is present in config data, it uses whatever value is specified: this allows the user to disable the opening of tabs automatically if they wish.
    Or
  • If upload_results is missing in config data, we check number_of_packings and only upload/post if it is less than 1.

with @mogres

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

Steps to Verify:

  1. Pack a local recipe with or without the "upload_results" option in the config file

@rugeli rugeli requested review from mogres and meganrm September 8, 2023 19:27
@github-actions
Copy link

github-actions bot commented Sep 8, 2023

Packing analysis report

Analysis for packing results located at cellpack/tests/outputs/test_spheres/spheresSST

Ingredient name Encapsulating radius Average number packed
ext_A 25 236.0

Packing image

Packing image

Distance analysis

Expected minimum distance: 50.00
Actual minimum distance: 50.01

Ingredient key Pairwise distance distribution
ext_A Distance distribution ext_A

@@ -175,7 +175,8 @@ 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 is None or env.config_data.get("upload_results", True):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check is a bit confusing for me. We're uploading and posting results if the config_data is missing or if upload_results is not set?

I would consider adding another check on number_of_packings to make sure we don't end up opening multiple browser tabs if upload_results is not set or missing on a config with 100s of packings.

Suggested change
if env.config_data is None or env.config_data.get("upload_results", True):
if env.config_data is None or env.config_data.get("upload_results", env.config_data.get("number_of_packings", 1) <= 1):

Copy link
Collaborator Author

@rugeli rugeli Sep 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your suggestion of adding a check for number_of_packings! If number_of_packings is always going to be specified in parallel packings, then we should be able to prevent opening multiple browser tabs by just checking the number_of_packings key.

That way, we wouldn't need to worry about adding the upload_results key to the config.

For example, we could use if env.config_data.get("number_of_packings", 1) <= 1):, just as you suggested

@@ -175,7 +175,8 @@ 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("number_of_packings", 1) <= 1:
Copy link
Collaborator

@mogres mogres Sep 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for incorporating this! However, I think keeping the upload_results option is still a good idea and we should only fall back on number_of_packings check if upload_results is missing from the config.

My suggestion was:
if env.config_data is None or env.config_data.get("upload_results", env.config_data.get("number_of_packings", 1) <= 1):
which only uploads results and opens a tab if following conditions are met:

  1. Config data is missing
    Or
  2. If upload_results is present in config data, it uses whatever value is specified: this allows the user to disable the opening of tabs automatically if they wish. Having this option would be useful in my opinion.
    Or
  3. If upload_results is missing in config data, we check number_of_packings and only upload/post if it is less than 1.
    Let me know if this makes sense!

@rugeli rugeli force-pushed the feature/upload-results-config-option branch from 919d9a4 to e96a996 Compare September 18, 2023 23:04
autopack.helper.post_and_open_file(file_name)
if env.config_data is None or env.config_data.get(
"upload_results", env.config_data.get("number_of_packings", 1) <= 1
):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

two things: I don't thin env.config_data can ever be none, so I don't think you need that check
I think you could do 3 or less. I have run some multiple packings recently that I would like to see the results of.

@@ -14,5 +14,6 @@
"spacing": 2.5,
"use_periodicity": false,
"show_sphere_trees": false,
"load_from_grid_file": true
"load_from_grid_file": true,
"upload_results": false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all config settings should also have a default setting in the config loader

Base automatically changed from feature/upload-local-recipes-to-S3 to main September 22, 2023 21:18
@codecov-commenter
Copy link

codecov-commenter commented Sep 25, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (58c0256) 98.52% compared to head (17fd02f) 98.52%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #191   +/-   ##
=======================================
  Coverage   98.52%   98.52%           
=======================================
  Files          16       16           
  Lines         476      476           
=======================================
  Hits          469      469           
  Misses          7        7           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rugeli rugeli requested review from meganrm and mogres September 25, 2023 20:10
Copy link
Collaborator

@mogres mogres left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! I think we can build upon this by using a single simularium file with multiple packings using time as an index.

Should be good to merge once conflicts are resolved!

@rugeli rugeli merged commit fee423f into main Sep 27, 2023
7 checks passed
@rugeli rugeli deleted the feature/upload-results-config-option branch September 27, 2023 00:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

make posting results to s3 a config option
4 participants