-
Notifications
You must be signed in to change notification settings - Fork 2
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
Conversation
@@ -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): |
There was a problem hiding this comment.
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.
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): |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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:
- Config data is missing
Or - 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 - If
upload_results
is missing in config data, we checknumber_of_packings
and only upload/post if it is less than 1.
Let me know if this makes sense!
919d9a4
to
e96a996
Compare
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 | ||
): |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
Codecov ReportAll modified lines are covered by tests ✅
❗ 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. |
….com/mesoscope/cellpack into feature/upload-results-config-option
There was a problem hiding this 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!
Problem
What is the problem this work solves, including
closes #190
Solution
What I/we did to solve this problem
post_and_open_file
, to prevent excessive uploads to S3 as well as to avoid opening multiple browser tabs unnecessarilythe action takes place when:
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
upload_results
is missing in config data, we checknumber_of_packings
and only upload/post if it is less than 1.with @mogres
Type of change
Please delete options that are not relevant.
Steps to Verify: