Skip to content

Commit

Permalink
FIX: Pass output arguments into Analysis and use them
Browse files Browse the repository at this point in the history
  • Loading branch information
cortadocodes committed Aug 16, 2024
1 parent b2987c5 commit d6a17bc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 5 additions & 2 deletions octue/resources/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def __init__(self, twine, handle_monitor_message=None, **kwargs):

# Non-strands.
self.output_location = kwargs.pop("output_location", None)
self.use_signed_urls_for_output_datasets = kwargs.pop("use_signed_urls_for_output_datasets", True)

self._calculate_strand_hashes(strands=strand_kwargs)
self._periodic_monitor_message_sender_threads = []
Expand Down Expand Up @@ -136,14 +137,14 @@ def set_up_periodic_monitor_message(self, create_monitor_message, period=60):
self._periodic_monitor_message_sender_threads.append(thread)
logger.info("Periodic monitor message set up to send every %ss.", period)

def finalise(self, upload_output_datasets_to=None, use_signed_urls=True):
def finalise(self, upload_output_datasets_to=None, use_signed_urls=None):
"""Validate the output values and output manifest and, if the analysis produced an output manifest, upload its
output datasets to a unique subdirectory within the analysis's output location. This output location can be
overridden by providing a different cloud path via the `upload_output_datasets_to` parameter. Either way, the
dataset paths in the output manifest are replaced with signed URLs for easier, expiring access.
:param str|None upload_output_datasets_to: If not provided but an output location was provided at instantiation, upload any output datasets into a unique subdirectory within this output location; if provided, upload into this location instead. The output manifest is updated with the upload locations.
:param bool use_signed_urls: if `True`, use signed URLs instead of cloud URIs for dataset paths in the output manifest
:param bool|None use_signed_urls: if `True`, use signed URLs instead of cloud URIs for dataset paths in the output manifest; if `None`, use the value of `use_signed_urls_for_output_datasets` given at instantiation
:return None:
"""
serialised_strands = {"output_values": None, "output_manifest": None}
Expand All @@ -163,6 +164,8 @@ def finalise(self, upload_output_datasets_to=None, use_signed_urls=True):
if self.output_location and not upload_output_datasets_to:
upload_output_datasets_to = storage.path.join(self.output_location, coolname.generate_slug())

use_signed_urls = use_signed_urls or self.use_signed_urls_for_output_datasets

# If there isn't both an output manifest and upload location, nothing is uploaded.
if not (upload_output_datasets_to and hasattr(self, "output_manifest")):
return
Expand Down
2 changes: 2 additions & 0 deletions octue/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,8 @@ def run(
id=analysis_id,
twine=self.twine,
handle_monitor_message=handle_monitor_message,
output_location=self.output_location,
use_signed_urls_for_output_datasets=self.use_signed_urls_for_output_datasets,
**self.configuration,
**inputs,
**outputs_and_monitors,
Expand Down

0 comments on commit d6a17bc

Please sign in to comment.