Skip to content

Move app configuration into service configuration #730

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 0 additions & 5 deletions docs/source/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,11 @@ FilterDict

Configuration
=============
.. autofunction:: octue.configuration.load_service_and_app_configuration

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

App configuration
-----------------
.. autoclass:: octue.configuration.AppConfiguration


Runner
======
Expand Down
10 changes: 5 additions & 5 deletions docs/source/asking_questions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -223,14 +223,14 @@ Asking a question within a service
==================================
If you have :doc:`created your own Twined service <creating_services>` and want to ask children questions, you can do
this more easily than above. Children are accessible from the ``analysis`` object by the keys you give them in the
:ref:`app configuration <app_configuration>` file. For example, you can ask an ``elevation`` service a question like
:ref:`service configuration <service_configuration>` file. For example, you can ask an ``elevation`` service a question like
this:

.. code-block:: python

answer, question_uuid = analysis.children["elevation"].ask(input_values={"longitude": 0, "latitude": 1})

if your app configuration file is:
if these values are in your service configuration file:

.. code-block:: json

Expand Down Expand Up @@ -272,7 +272,7 @@ and your ``twine.json`` file includes the child keys in its ``children`` field:
]
}

See the parent service's `app configuration <https://github.com/octue/octue-sdk-python/blob/main/octue/templates/template-child-services/parent_service/app_configuration.json>`_
See the parent service's `service configuration <https://github.com/octue/octue-sdk-python/blob/main/octue/templates/template-child-services/parent_service/octue.yaml>`_
and `app.py file <https://github.com/octue/octue-sdk-python/blob/main/octue/templates/template-child-services/parent_service/app.py>`_
in the `child-services app template <https://github.com/octue/octue-sdk-python/tree/main/octue/templates/template-child-services>`_
to see this in action.
Expand All @@ -285,14 +285,14 @@ If the child you're asking a question to has its own children (static children),
IDs of the children you want it to use (dynamic children) to the :mod:`Child.ask <octue.resources.child.Child.ask>`
method. Questions that would have gone to the static children will instead go to the dynamic children. Note that:

- You must provide the children in the same format as they're provided in the :ref:`app configuration <app_configuration>`
- You must provide the children in the same format as they're provided in the :ref:`service configuration <service_configuration>`
- If you override one static child, you must override others, too
- The dynamic children must have the same keys as the static children (so the child knows which service to ask which
questions)
- You should ensure the dynamic children you provide are compatible with and appropriate for questions from the child
service

For example, if the child requires these children in its app configuration:
For example, if the child requires these children in its service configuration:

.. code-block:: json

Expand Down
6 changes: 3 additions & 3 deletions docs/source/creating_apps.rst
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ When the analysis has finished, it is automatically finalised. This means:
.. note::

You can manually call :mod:`analysis.finalise <octue.resources.analysis.Analysis.finalise>` if you want to upload
any output datasets to a different location to the one specified in the app configuration. If you do this, the
any output datasets to a different location to the one specified in the service configuration. If you do this, the
analysis will not be finalised again - make sure you only call it when your output data is ready. Note that the
``output_location`` and ``use_signed_urls_for_output_datasets`` settings in the app configuration are ignored if you
call it manually.
``output_location`` and ``use_signed_urls_for_output_datasets`` settings in the service configuration are ignored if
you call it manually.
21 changes: 3 additions & 18 deletions docs/source/creating_services.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ a `requirements.txt file <https://learnpython.com/blog/python-requirements-file/
`pyproject.toml file <https://python-poetry.org/docs/pyproject/>`_ listing all the python packages your app depends on
and the version ranges that are supported.

.. _octue_yaml:
.. _service_configuration:

octue.yaml
----------
Expand All @@ -51,7 +51,6 @@ octue.yaml
It may also need the following key-value pairs:

- ``app_source_path: <path>`` - if your ``app.py`` file is not in the repository root
- ``app_configuration_path: <path>`` - if your app needs an app configuration file that isn't in the repository root

All paths should be relative to the repository root. Other valid entries can be found in the
:mod:`ServiceConfiguration <octue.configuration.ServiceConfiguration>` constructor.
Expand All @@ -61,29 +60,15 @@ octue.yaml
Currently, only one service can be defined per repository, but it must still appear as a list item of the
"services" key. At some point, it will be possible to define multiple services in one repository.

.. _app_configuration:

App configuration file (optional)
---------------------------------

.. collapse:: An optional app configuration JSON file specifying, for example, any children your app depends on - read more...

----

If your app needs any configuration, asks questions to any other Twined services, or produces output
datafiles/datasets, you will need to provide an app configuration. Currently, this must take the form of a JSON
file. It can contain the following keys:
If a service's app needs any configuration, asks questions to any other Twined services, or produces output
datafiles/datasets, you will need to provide some or all of the following values for that service:

- ``configuration_values``
- ``configuration_manifest``
- ``children``
- ``output_location``
- ``use_signed_urls_for_output_datasets``

If an app configuration file is provided, its path must be specified in ``octue.yaml`` under the
"app_configuration_path" key.

See the :mod:`AppConfiguration <octue.configuration.AppConfiguration>` constructor for more information.

Dockerfile (optional)
---------------------
Expand Down
Loading
Loading