Skip to content

Commit d948b8f

Browse files
authored
MRG: Merge pull request #680 from octue/check-for-service-revision-existence
Check for service revision existence
2 parents f1bce70 + acd16c2 commit d948b8f

File tree

11 files changed

+273
-149
lines changed

11 files changed

+273
-149
lines changed

docs/source/inter_service_compatibility.rst

+93-89
Large diffs are not rendered by default.

octue/cloud/pub_sub/service.py

+18-6
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ def services_topic(self):
118118
topic = Topic(name=OCTUE_SERVICES_PREFIX, project_name=self.backend.project_name)
119119

120120
if not topic.exists():
121-
raise octue.exceptions.ServiceNotFound(f"{topic!r} cannot be found.")
121+
raise octue.exceptions.ServiceNotFound(
122+
f"The {topic!r} topic cannot be found. Check that it's been created for this service network."
123+
)
122124

123125
return topic
124126

@@ -147,7 +149,7 @@ def serve(self, timeout=None, delete_topic_and_subscription_on_exit=False, allow
147149
logger.info("Starting %r.", self)
148150

149151
subscription = Subscription(
150-
name=".".join((OCTUE_SERVICES_PREFIX, self._pub_sub_id)),
152+
name=self._pub_sub_id,
151153
topic=self.services_topic,
152154
filter=f'attributes.recipient = "{self.id}" AND attributes.sender_type = "{PARENT_SENDER_TYPE}"',
153155
expiration_time=None,
@@ -328,6 +330,8 @@ def ask(
328330
"""
329331
service_namespace, service_name, service_revision_tag = split_service_id(service_id)
330332

333+
# If using a service registry, check that the service revision is registered, or get the default service
334+
# revision if no revision tag is provided.
331335
if self.service_registries:
332336
if service_revision_tag:
333337
raise_if_revision_not_registered(sruid=service_id, service_registries=self.service_registries)
@@ -338,7 +342,17 @@ def ask(
338342
service_registries=self.service_registries,
339343
)
340344

341-
elif not service_revision_tag:
345+
# If not using a service registry, check that the service revision exists by checking for its subscription.
346+
elif service_revision_tag:
347+
service_revision_subscription = Subscription(
348+
name=convert_service_id_to_pub_sub_form(service_id),
349+
topic=self.services_topic,
350+
)
351+
352+
if not service_revision_subscription.exists():
353+
raise octue.exceptions.ServiceNotFound(f"Service revision {service_id!r} not found.")
354+
355+
else:
342356
raise octue.exceptions.InvalidServiceID(
343357
f"A service revision tag for {service_id!r} must be provided if service registries aren't being used."
344358
)
@@ -362,10 +376,8 @@ def ask(
362376
if asynchronous and not push_endpoint:
363377
answer_subscription = None
364378
else:
365-
pub_sub_id = convert_service_id_to_pub_sub_form(self.id)
366-
367379
answer_subscription = Subscription(
368-
name=".".join((OCTUE_SERVICES_PREFIX, pub_sub_id, ANSWERS_NAMESPACE, question_uuid)),
380+
name=".".join((self._pub_sub_id, ANSWERS_NAMESPACE, question_uuid)),
369381
topic=self.services_topic,
370382
filter=(
371383
f'attributes.recipient = "{self.id}" '

octue/configuration.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def __init__(
119119
configuration_manifest=None,
120120
children=None,
121121
output_location=None,
122-
use_signed_urls_for_output_datasets=True,
122+
use_signed_urls_for_output_datasets=False,
123123
**kwargs,
124124
):
125125
self.configuration_values = configuration_values

0 commit comments

Comments
 (0)