Skip to content

Update child emulator and improve manifest dataset download #668

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 13 commits into from
Jul 16, 2024
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
2 changes: 0 additions & 2 deletions docs/source/asking_questions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ access the event store and run:
{
"event": {
"kind": "delivery_acknowledgement",
"datetime": "2024-03-06T15:44:18.156044"
},
},
{
Expand Down Expand Up @@ -156,7 +155,6 @@ access the event store and run:
{
"event": {
"kind": "heartbeat",
"datetime": "2024-03-06T15:46:18.167424"
},
},
{
Expand Down
160 changes: 81 additions & 79 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 @@ -83,7 +83,7 @@ Download all or a subset of datasets from a manifest.

.. note::

Datasets are downloaded to temporary directories if no paths are given.
Datasets are downloaded to a temporary directory if no paths are given.


Further information
Expand Down
233 changes: 128 additions & 105 deletions docs/source/testing_services.rst

Large diffs are not rendered by default.

45 changes: 23 additions & 22 deletions docs/source/troubleshooting_services.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
Troubleshooting services
========================

Crash diagnostics
=================
Services save the following data to the cloud if they crash while processing a question:
Diagnostics
===========
Services save the following data to the cloud if they crash while processing a question (the default), or when they
finish processing a question successfully if diagnostics are permanently turned on (not the default):

- Input values
- Input manifest and datasets
- Child configuration values
- Child configuration manifest and datasets
- Inputs to and messages received in answer to each question the service asked its children (if it has any). These are
- Inputs to and events received in response to each question the service asked its children (if it has any). These are
stored in the order the questions were asked.

.. important::
Expand All @@ -19,24 +20,24 @@ Services save the following data to the cloud if they crash while processing a q
configuration (:ref:`octue.yaml <octue_yaml>` file) set to a Google Cloud Storage path.


Accessing crash diagnostics
===========================
In the event of a crash, the service will upload the crash diagnostics and send the upload path to the parent as a log
message. A user with credentials to access this path can use the ``octue`` CLI to retrieve the crash diagnostics data:
Accessing diagnostics
=====================
If diagnostics are enabled, a service will upload the diagnostics and send the upload path to the parent as a log
message. A user with credentials to access this path can use the ``octue`` CLI to retrieve the diagnostics data:

.. code-block:: shell

octue get-crash-diagnostics <cloud-path>
octue get-diagnostics <cloud-path>

More information on the command:

.. code-block::

>>> octue get-crash-diagnostics -h
>>> octue get-diagnostics -h

Usage: octue get-crash-diagnostics [OPTIONS] CLOUD_PATH
Usage: octue get-diagnostics [OPTIONS] CLOUD_PATH

Download crash diagnostics for an analysis from the given directory in
Download diagnostics for an analysis from the given directory in
Google Cloud Storage. The cloud path should end in the analysis ID.

CLOUD_PATH: The path to the directory in Google Cloud Storage containing the
Expand All @@ -46,24 +47,24 @@ More information on the command:
--local-path DIRECTORY The path to a directory to store the directory of
diagnostics data in. Defaults to the current working
directory.
--download-datasets If provided, download any datasets from the crash
--download-datasets If provided, download any datasets from the
diagnostics and update their paths in their
manifests to the new local paths.
-h, --help Show this message and exit.

.. _test_fixtures_from_crash_diagnostics:
.. _test_fixtures_from_diagnostics:

Creating test fixtures from crash diagnostics
=============================================
You can create test fixtures directly from crash diagnostics, allowing you to recreate the exact conditions that caused
Creating test fixtures from diagnostics
=======================================
You can create test fixtures directly from diagnostics, allowing you to recreate the exact conditions that caused
your service to fail.

.. code-block:: python

from unittest.mock import patch

from octue import Runner
from octue.utils.testing import load_test_fixture_from_crash_diagnostics
from octue.utils.testing import load_test_fixture_from_diagnostics


(
Expand All @@ -72,7 +73,7 @@ your service to fail.
input_values,
input_manifest,
child_emulators,
) = load_test_fixture_from_crash_diagnostics(path="path/to/downloaded/crash/diagnostics")
) = load_test_fixture_from_diagnostics(path="path/to/downloaded/diagnostics")

# You can explicitly specify your children here as shown or
# read the same information in from your app configuration file.
Expand Down Expand Up @@ -108,9 +109,9 @@ your service to fail.
analysis = runner.run(input_values=input_values, input_manifest=input_manifest)


Disabling crash diagnostics
===========================
When asking a question to a child, parents can disable crash diagnostics upload in the child on a question-by-question
Disabling diagnostics
=====================
When asking a question to a child, parents can disable diagnostics upload in the child on a question-by-question
basis by setting ``save_diagnostics`` to ``"SAVE_DIAGNOSTICS_OFF"`` in :mod:`Child.ask <octue.resources.child.Child.ask>`.
For example:

Expand Down
Loading
Loading