Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
7f12adc
FIX: Update command in dockerfiles to use new `octue twined` CLI
cortadocodes Aug 4, 2025
93ed752
REF: Move relevant emulators into twined
cortadocodes Aug 4, 2025
39b2af1
REF: Move migrations subpackage
cortadocodes Aug 4, 2025
5c8669f
REF: Move rest of `octue.cloud` into `octue.twined.cloud`
cortadocodes Aug 4, 2025
0389f89
REF: Move `essentials`
cortadocodes Aug 4, 2025
e7b8522
REF: Move `metadata`
cortadocodes Aug 4, 2025
ccee6d3
REF: Move `resources`
cortadocodes Aug 4, 2025
3de3d00
REF: Move `templates`
cortadocodes Aug 4, 2025
b2817bc
REF: Merge `TwinedEncoder` with `OctueJSONEncoder`
cortadocodes Aug 4, 2025
ec35c7d
TST: Update path for test
cortadocodes Aug 4, 2025
cca43ce
REF: Remove unused `folders` utils
cortadocodes Aug 4, 2025
7895d8a
DOC: Update CLI command examples in docstrings and comments
cortadocodes Aug 4, 2025
decbd00
REF: Move `octue.utils.testing`
cortadocodes Aug 4, 2025
f4645bc
REF: Remove unused `isfolder` and `isfile` utils
cortadocodes Aug 4, 2025
b172c1d
REF: Move `octue.runner` to `octue.twined.runner`
cortadocodes Aug 4, 2025
1109cca
REF: Move `app_loading`
cortadocodes Aug 4, 2025
59f4517
REF: Move `octue.compatibility`
cortadocodes Aug 4, 2025
84ef8fe
REF: Move `configuration`
cortadocodes Aug 4, 2025
c4c3fd0
REF: Remove unused constant
cortadocodes Aug 4, 2025
28ef999
REF: Move definitions
cortadocodes Aug 4, 2025
4101ba9
REF: Move `diagnostics
cortadocodes Aug 4, 2025
dbeaa4c
REF: Remove unused exception
cortadocodes Aug 4, 2025
9a71d03
REF: Move relevant exceptions
cortadocodes Aug 4, 2025
528fdf4
REF: Move `AnalysisLogFormatterSwitcher`
cortadocodes Aug 4, 2025
b00d942
TST: Restructure test directories
cortadocodes Aug 4, 2025
6d539d8
TST: Remove unused base test method
cortadocodes Aug 4, 2025
e0f4a2b
FIX: Fix circular import with `mixins/__init__.py` and `datafile.py`
cortadocodes Aug 5, 2025
dd7d90b
REF: Rename `OCTUE_SERVICES_TOPIC_NAME` to `TWINED_SERVICES_TOPIC_NAME`
cortadocodes Aug 5, 2025
0562196
REF: Rename scripts
cortadocodes Aug 5, 2025
70d1f8a
CHO: Update version compatibility metadata
cortadocodes Aug 5, 2025
4225424
DOC: Update paths in docs
cortadocodes Aug 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/version-compatibility.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: version-compatibility
name: twined-version-compatibility

on:
push:
Expand All @@ -15,4 +15,4 @@ jobs:
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Check version compatibility has been tested
run: python scripts/check_version_compatibility_tested.py
run: python scripts/check_twined_version_compatibility_tested.py
12 changes: 6 additions & 6 deletions docs/source/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@ Manifest

Analysis
========
.. autoclass:: octue.resources.analysis.Analysis
.. autoclass:: octue.twined.resources.analysis.Analysis
:inherited-members:


Child
=====
.. autoclass:: octue.resources.child.Child
.. autoclass:: octue.twined.resources.child.Child


Child emulator
==============
.. autoclass:: octue.cloud.emulators.child.ChildEmulator
.. autoclass:: octue.twined.cloud.emulators.child.ChildEmulator


Filter containers
Expand All @@ -61,17 +61,17 @@ Configuration

Service configuration
---------------------
.. autoclass:: octue.configuration.ServiceConfiguration
.. autoclass:: octue.twined.configuration.ServiceConfiguration


Runner
======
.. autoclass:: octue.runner.Runner
.. autoclass:: octue.twined.runner.Runner


Octue essential monitor messages
================================
.. automodule:: octue.essentials.monitor_messages
.. automodule:: octue.twined.essentials.monitor_messages


Octue log handler
Expand Down
4 changes: 2 additions & 2 deletions docs/source/asking_questions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Asking a question

.. code-block:: python

from octue.resources import Child
from octue.twined.resources import Child

child = Child(
id="my-organisation/my-service:2.1.7",
Expand Down Expand Up @@ -103,7 +103,7 @@ access the event store and run:

.. code-block:: python

from octue.cloud.pub_sub.bigquery import get_events
from octue.twined.cloud.pub_sub.bigquery import get_events

events = get_events(question_uuid="53353901-0b47-44e7-9da3-a3ed59990a71")

Expand Down
236 changes: 119 additions & 117 deletions docs/source/inter_service_compatibility.rst

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/source/manifest.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Get a Twined service to analyse data for you as part of a larger analysis.

.. code-block:: python

from octue.resources import Child
from octue.twined.resources import Child

child = Child(
id="octue/wind-speed:2.1.0",
Expand Down
2 changes: 1 addition & 1 deletion docs/source/running_services_locally.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ like this:

.. code-block:: python

from octue import Runner
from octue.twined.runner import Runner

runner = Runner(app_src="path/to/app.py", twine="path/to/twine.json")
analysis = runner.run(input_values={"height": 5, "width": 10})
Expand Down
8 changes: 4 additions & 4 deletions docs/source/testing_services.rst
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ To emulate your children in tests, patch the :mod:`Child <octue.resources.child.

from unittest.mock import patch

from octue import Runner
from octue.cloud.emulators import ChildEmulator
from octue.twined.runner import Runner
from octue.twined.cloud.emulators import ChildEmulator


app_directory_path = "path/to/directory_containing_app"
Expand Down Expand Up @@ -227,7 +227,7 @@ child.
.. code-block:: python

import json
from octue.resources import Child
from octue.twined.resources import Child


child = Child(
Expand Down Expand Up @@ -276,7 +276,7 @@ You can then feed these into a child emulator to emulate one possible response o

.. code-block:: python

from octue.cloud.emulators import ChildEmulator
from octue.twined.cloud.emulators import ChildEmulator


child_emulator = ChildEmulator(events=child.received_events)
Expand Down
4 changes: 2 additions & 2 deletions docs/source/troubleshooting_services.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ your service to fail.

from unittest.mock import patch

from octue import Runner
from octue.utils.testing import load_test_fixture_from_diagnostics
from octue.twined.runner import Runner
from octue.twined.utils.testing import load_test_fixture_from_diagnostics


(
Expand Down
3 changes: 0 additions & 3 deletions octue/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@
import os

from .log_handlers import apply_log_handler, should_use_octue_log_handler
from .runner import Runner

logger = logging.getLogger(__name__)


__all__ = ("Runner",)
REPOSITORY_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))

if should_use_octue_log_handler():
Expand Down
28 changes: 15 additions & 13 deletions octue/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,22 @@
from google import auth

from octue.cloud import storage
from octue.cloud.events.answer_question import answer_question
from octue.cloud.events.question import make_question_event
from octue.cloud.events.replayer import EventReplayer
from octue.cloud.events.validation import VALID_EVENT_KINDS
from octue.cloud.pub_sub.bigquery import DEFAULT_EVENT_STORE_TABLE_ID, get_events
from octue.cloud.pub_sub.service import Service
from octue.cloud.service_id import create_sruid, get_sruid_parts
from octue.cloud.storage import GoogleCloudStorageClient
from octue.configuration import ServiceConfiguration
from octue.definitions import LOCAL_SDK_VERSION, MANIFEST_FILENAME, VALUES_FILENAME
from octue.exceptions import ServiceAlreadyExists
from octue.definitions import LOCAL_SDK_VERSION
from octue.log_handlers import apply_log_handler, get_remote_handler
from octue.resources import Child, Manifest, service_backends
from octue.runner import Runner
from octue.resources import Manifest
from octue.twined.cloud.events.answer_question import answer_question
from octue.twined.cloud.events.question import make_question_event
from octue.twined.cloud.events.replayer import EventReplayer
from octue.twined.cloud.events.validation import VALID_EVENT_KINDS
from octue.twined.cloud.pub_sub.bigquery import DEFAULT_EVENT_STORE_TABLE_ID, get_events
from octue.twined.cloud.pub_sub.service import Service
from octue.twined.cloud.service_id import create_sruid, get_sruid_parts
from octue.twined.configuration import ServiceConfiguration
from octue.twined.definitions import MANIFEST_FILENAME, VALUES_FILENAME
from octue.twined.exceptions import ServiceAlreadyExists
from octue.twined.resources import Child, service_backends
from octue.twined.runner import Runner
from octue.utils.decoders import OctueJSONDecoder
from octue.utils.encoders import OctueJSONEncoder

Expand Down Expand Up @@ -193,7 +195,7 @@ def remote(sruid, input_values, input_manifest, project_id, asynchronous, servic
def local(input_values, input_manifest, attributes, service_config):
"""Ask a question to a local Octue Twined service.

This command is similar to running `octue start` and asking the resulting local service revision a question
This command is similar to running `octue twined start` and asking the resulting local service revision a question
via Pub/Sub. Instead of starting a local Pub/Sub service revision, however, no Pub/Sub subscription or subscriber is
created; the question is instead passed directly to local the service revision without Pub/Sub being involved.
Everything after this runs the same, though, with the service revision emitting any events via Pub/Sub as usual.
Expand Down
9 changes: 0 additions & 9 deletions octue/cloud/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +0,0 @@
import octue.exceptions
import octue.twined.exceptions
from octue.utils.exceptions import create_exceptions_mapping

EXCEPTIONS_MAPPING = create_exceptions_mapping(
globals()["__builtins__"],
vars(octue.twined.exceptions),
vars(octue.exceptions),
)
4 changes: 0 additions & 4 deletions octue/cloud/emulators/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +0,0 @@
from .child import ChildEmulator


__all__ = ["ChildEmulator"]
3 changes: 0 additions & 3 deletions octue/cloud/events/__init__.py

This file was deleted.

19 changes: 0 additions & 19 deletions octue/definitions.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,4 @@
import importlib.metadata

VALUES_FILENAME = "values.json"
MANIFEST_FILENAME = "manifest.json"

STRAND_FILENAME_MAP = {
"configuration_values": VALUES_FILENAME,
"configuration_manifest": MANIFEST_FILENAME,
"input_values": VALUES_FILENAME,
"input_manifest": MANIFEST_FILENAME,
"output_values": VALUES_FILENAME,
"output_manifest": MANIFEST_FILENAME,
}

# TODO this should probably be defined in twined
OUTPUT_STRANDS = ("output_values", "output_manifest")

# TODO this should probably be defined in twined
RUN_STRANDS = ("input_values", "input_manifest", "credentials", "children")

GOOGLE_COMPUTE_PROVIDERS = {"GOOGLE_CLOUD_FUNCTION"}
LOCAL_SDK_VERSION = importlib.metadata.version("octue")
DEFAULT_MAXIMUM_HEARTBEAT_INTERVAL = 360
36 changes: 0 additions & 36 deletions octue/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,57 +66,21 @@ class InvalidLabelException(OctueSDKException, ValueError):
"""Raise when a label applied to a data file or dataset"""


class ServiceNotFound(OctueSDKException):
"""Raise when a Service of the given ID has not been found on the Google Pub/Sub server (i.e. if there is no topic
associated with the Service ID).
"""


class ServiceAlreadyExists(OctueSDKException):
"""Raise if trying to create a service with the ID of an existing service."""


class BackendNotFound(OctueSDKException):
"""Raise when details of a backend that doesn't exist in `octue.resources.service_backends` are given for use as a
Service backend.
"""


class AttributeConflict(OctueSDKException):
"""Raise if, when trying to set an attribute whose current value has a significantly higher confidence than the new
value, the new value conflicts with the current value.
"""


class MissingServiceID(OctueSDKException):
"""Raise when a specific ID for a service is expected to be provided, but is missing or None."""


class InvalidServiceID(OctueSDKException):
"""Raise when a service ID is invalid."""


class CloudLocationNotSpecified(OctueSDKException):
"""Raise when attempting to interact with a cloud resource implicitly but the implicit details of its location are
missing.
"""


class InvalidMonitorMessage(OctueSDKException):
"""Raise if a monitor message fails validation against the "monitor_message_schema" field of the Twine."""


class DeploymentError(OctueSDKException):
"""Raise if an error occurs during the deployment of an octue service."""


class CloudStorageBucketNotFound(OctueSDKException):
"""Raise if attempting to access a cloud storage bucket that cannot be found."""


class NotAPullSubscription(OctueSDKException):
"""Raise if attempting to pull a subscription that's not a pull subscription."""


class ReadOnlyResource(OctueSDKException):
"""Raise if attempting to alter a read-only resource."""
Loading
Loading