Skip to content

Commit

Permalink
REF: Remove unnecessary analysis finalisation from other template apps
Browse files Browse the repository at this point in the history
skipci
  • Loading branch information
cortadocodes committed Aug 14, 2024
1 parent 45697d1 commit 36bd91b
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ def run(analysis):
:return None:
"""
analysis.output_values = [random.randint(0, 200) for location in analysis.input_values["locations"]]
analysis.finalise()
6 changes: 0 additions & 6 deletions octue/templates/template-fractal/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,3 @@ def run(analysis):

# Add the app's output values to the analysis.
analysis.output_values = {"data": data, "layout": layout}

# Optionally finalise the analysis. This validates the output data and output manifest against the twine and uploads
# any datasets in the output manifest to the service's cloud bucket. Signed URLs are provided so that the parent
# that asked the service for the analysis can access the data (until the signed URLs expire). Finalising explicitly
# isn't needed unless the output location is different from (or not specified in) the service configuration.
analysis.finalise()
6 changes: 0 additions & 6 deletions octue/templates/template-using-manifests/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from octue.resources import Datafile, Dataset
from octue.utils.files import RegisteredTemporaryDirectory
from tests import TEST_BUCKET_NAME


logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -100,11 +99,6 @@ def run(analysis):
# also used to separate words in natural language search.
analysis.output_manifest.get_dataset("cleaned_met_mast_data").labels = ["met", "mast", "cleaned"]

# Finalise the analysis. This validates the output data and output manifest against the twine and optionally
# uploads any datasets in the output manifest to the service's cloud bucket. Signed URLs are provided so that
# the parent that asked the service for the analysis can access the data (until the signed URLs expire).
analysis.finalise(upload_output_datasets_to=f"gs://{TEST_BUCKET_NAME}/output/test_using_manifests_analysis")

# We're done! There's only one datafile in the output dataset, but you could create thousands more and add them
# all :)
#
Expand Down
5 changes: 3 additions & 2 deletions tests/templates/test_template_apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@ def test_fractal_template_with_default_configuration(self):
def test_using_manifests_template(self):
"""Ensure the `using-manifests` template app works correctly."""
self.set_template("template-using-manifests")
output_location = f"gs://{TEST_BUCKET_NAME}"

runner = Runner(
app_src=self.template_path,
twine=self.template_twine,
configuration_values=os.path.join("data", "configuration", "values.json"),
output_location=output_location,
)

with patch("google.cloud.storage.blob.Blob.generate_signed_url", new=mock_generate_signed_url):
Expand All @@ -56,8 +58,7 @@ def test_using_manifests_template(self):
)

output_url = urlparse(downloaded_output_manifest.datasets["cleaned_met_mast_data"].files.one().cloud_path).path

self.assertTrue(output_url.startswith(f"/{TEST_BUCKET_NAME}/output/test_using_manifests_analysis"))
self.assertTrue(output_url.startswith(f"/{TEST_BUCKET_NAME}"))
self.assertTrue(output_url.endswith("/cleaned_met_mast_data/cleaned.csv"))

@unittest.skipIf(condition=os.name == "nt", reason="See issue https://github.com/octue/octue-sdk-python/issues/229")
Expand Down

0 comments on commit 36bd91b

Please sign in to comment.