Skip to content

Commit

Permalink
add a bucket for batch jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
rugeli committed Oct 25, 2024
1 parent 93324a6 commit 685d4ca
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions cellpack/autopack/upy/simularium/simularium_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -1402,7 +1402,7 @@ def post_and_open_file(self, file_name, open_results_in_browser=True):
if job_id:
print(f"Batch Job ID: {job_id}")
file_name, url = simulariumHelper.store_result_file(
simularium_file, storage="aws"
simularium_file, storage="aws", batch_job_id=job_id
)
if file_name and url:
simulariumHelper.store_metadata(
Expand All @@ -1412,14 +1412,21 @@ def post_and_open_file(self, file_name, open_results_in_browser=True):
simulariumHelper.open_in_simularium(url)

@staticmethod
def store_result_file(file_path, storage=None):
def store_result_file(file_path, storage=None, batch_job_id=None):
if storage == "aws":
handler = DATABASE_IDS.handlers().get(storage)
initialized_handler = handler(
bucket_name="cellpack-results",
sub_folder_name="simularium",
region_name="us-west-2",
)
if batch_job_id: # save results to batch job bucket
initialized_handler = handler(
bucket_name="cellpack-demo",
sub_folder_name="simularium",
region_name="us-west-2",
)
else:
initialized_handler = handler(
bucket_name="cellpack-results",
sub_folder_name="simularium",
region_name="us-west-2",
)
file_name, url = initialized_handler.save_file_and_get_url(file_path)
if not file_name or not url:
db_maintainer = DBMaintenance(initialized_handler)
Expand Down

0 comments on commit 685d4ca

Please sign in to comment.