Skip to content

Commit ca9c922

Browse files
authored
MRG: Merge pull request #739 from octue/rewrite-docs
Improve CLI and rewrite documentation
2 parents 5ef4730 + b56c26c commit ca9c922

File tree

74 files changed

+2410
-2199
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+2410
-2199
lines changed

.pre-commit-config.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ repos:
99
hooks:
1010
- id: trailing-whitespace
1111
- id: end-of-file-fixer
12-
- id: check-yaml
1312
- id: check-added-large-files
1413

1514
- repo: https://github.com/astral-sh/ruff-pre-commit

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
The python SDK for running [Octue](https://octue.com) data services, digital twins, and applications - get faster data
1212
groundwork so you have more time for the science!
1313

14-
Read the docs [here.](https://octue-python-sdk.readthedocs.io/en/latest/)
14+
Read the docs [here.](https://twined.octue.com/)
1515

1616
Uses our [twined](https://twined.readthedocs.io/en/latest/) library for data validation.
1717

@@ -41,7 +41,6 @@ Usage: octue [OPTIONS] COMMAND [ARGS]...
4141
Read more in the docs: https://octue-python-sdk.readthedocs.io/en/latest/
4242
4343
Options:
44-
--logger-uri TEXT Stream logs to a websocket at the given URI.
4544
--log-level [debug|info|warning|error]
4645
Log level used for the analysis. [default:
4746
info]

docs/authentication.md

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,35 @@
1-
# Authentication
1+
You need authentication while using Twined to:
22

3-
You need authentication while using `octue` to:
4-
5-
- Access data from Google Cloud Storage
6-
- Use, run, or deploy Twined services
3+
- Use or run services
4+
- Access input and output data from analyses run on services
75

86
Authentication is provided by a GCP service account.
97

108
## Creating a service account
119

1210
By setting up your Twined service network with the
13-
[Twined Terraform modules](/deploying_services), a set of maintainer service accounts have already been
14-
created with the required permissions.
11+
[Twined Terraform modules](core_concepts/deploying_services.md), a set of maintainer service accounts have already been
12+
created with the required permissions. These will have names starting with `maintainer-`.
1513

1614
## Using a service account
1715

1816
### Locally
1917

2018
1. Access your service accounts
2119
[here](https://console.cloud.google.com/iam-admin/serviceaccounts),
22-
making sure the correct project is selected
20+
making sure the correct project is selected, or ask your Twined service network administrator
2321
2. Click on the relevant service account, go to the "Keys" tab, and
2422
create (download) a JSON key for it - it will be called
2523
`<project-name>-XXXXX.json`.
2624

2725
!!! danger
2826

29-
It's best not to store this in your project to prevent accidentally
27+
It's best not to store this in your repository to prevent accidentally
3028
committing it or building it into a docker image layer. Instead, keep it
3129
somewhere else on your local system with any other service account keys
3230
you already have.
3331

34-
If you must keep within your project, it's good practice to name the
32+
If you must keep within your repository, it's good practice to name the
3533
file `gcp-credentials.json` and make sure that `gcp-cred*` is in your
3634
`.gitignore` and `.dockerignore` files.
3735

@@ -46,8 +44,7 @@ created with the required permissions.
4644

4745
### On GCP infrastructure / deployed services
4846

49-
- Credentials are automatically provided when running code or services
50-
on GCP infrastructure, including the Kubernetes cluster
51-
- `octue` uses these when when running on these platforms, so there's
52-
no need to upload a service account key or include one in service
53-
docker images
47+
- Credentials are automatically provided when running code or services on GCP infrastructure, including the Kubernetes
48+
cluster
49+
- Twined uses these when running on these platforms, so there's no need to upload a service account key or include one
50+
in service docker images

docs/available_filters.md

Lines changed: 0 additions & 110 deletions
This file was deleted.

docs/asking_questions.md renamed to docs/core_concepts/asking_questions.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ to a child for processing/analysis. Questions can be:
2121
or custom logic in your own webserver.
2222

2323
Questions are always asked to a _revision_ of a service. You can ask a
24-
service a question if you have its [SRUID](/services/#service-names), project ID, and the necessary permissions.
24+
service a question if you have its [SRUID](services.md/#service-names), project ID, and the necessary permissions.
2525

2626
## Asking a question
2727

@@ -49,7 +49,7 @@ answer["output_manifest"]["my_dataset"].files
4949

5050
If you're using an environment other than the `main` environment, then before asking any questions to your Twined
5151
services, set the `TWINED_SERVICES_TOPIC_NAME` environment variable to the name of the Twined services Pub/Sub topic
52-
(this is set when [deploying a service network](/deploying_services/#deploying-services-advanced-developers-guide).
52+
(this is set when [deploying a service network](deploying_services.md).
5353
It will be in the form `<environment-name>.octue.twined.services`
5454

5555
!!! note
@@ -64,7 +64,7 @@ You can also set the following options when you call `Child.ask`:
6464

6565
- `children` - If the child has children of its own (i.e. grandchildren of the parent), this optional argument can be
6666
used to override the child's "default" children. This allows you to specify particular versions of grandchildren to
67-
use (see [this subsection below](#overriding-a-childs-children).
67+
use (see [this subsection below](#overriding-a-childs-children)).
6868
- `subscribe_to_logs` - if true, the child will forward its logs to you
6969
- `allow_local_files` - if true, local files/datasets are allowed in any input manifest you supply
7070
- `handle_monitor_message` - if provided a function, it will be called on any monitor messages from the child
@@ -242,10 +242,10 @@ at once instead of one after another.
242242
## Asking a question within a service
243243

244244
If you have
245-
[created your own Twined service](/creating_services) and want to ask children questions, you can do this more
245+
[created your own Twined service](creating_services.md) and want to ask children questions, you can do this more
246246
easily than above. Children are accessible from the `analysis` object by
247247
the keys you give them in the
248-
[service configuration](/creating_services/#octueyaml) file. For example, you can ask an `elevation` service a
248+
[service configuration](creating_services.md/#octueyaml) file. For example, you can ask an `elevation` service a
249249
question like this:
250250

251251
```python
@@ -314,7 +314,7 @@ you want it to use (dynamic children) to the
314314
children will instead go to the dynamic children. Note that:
315315

316316
- You must provide the children in the same format as they're provided
317-
in the [service configuration](/creating_services/#octueyaml)
317+
in the [service configuration](../core_concepts/creating_services.md/#octueyaml)
318318
- If you override one static child, you must override others, too
319319
- The dynamic children must have the same keys as the static children
320320
(so the child knows which service to ask which questions)

docs/creating_apps.md renamed to docs/core_concepts/creating_apps.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# app.py file {#creating_apps}
1+
# The `app.py` file
22

33
The `app.py` file is, as you might expect, the entrypoint to your app.
44
It can contain any valid python including imports and use of any number

docs/creating_services.md renamed to docs/core_concepts/creating_services.md

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,16 @@ run locally on any machine or be deployed to the cloud. Currently:
1212

1313
## Anatomy of a Twined service
1414

15-
A Twined service is defined by the following files (located in the
16-
repository root by default).
15+
A Twined service is defined by the following files (located in the repository root by default).
1716

1817
### app.py
1918

20-
This is the entrypoint into your code - read more [here](/creating_apps).
19+
This is the entrypoint into your code - read more [here](creating_apps.md).
2120

2221
### twine.json
2322

24-
This file defines the schema for the service's configuration, input,
25-
and output data. Read more
26-
[here](https://twined.readthedocs.io/en/latest/) and see an example
27-
[here](https://twined.readthedocs.io/en/latest/quick_start_create_your_first_twine.html).
23+
This file defines the schema for the service's configuration, input, and output data. Read more [here](twines/anatomy.md) and
24+
see an example [here](twines/twine_file_quickstart.md).
2825

2926
### Dependencies file
3027

@@ -45,26 +42,26 @@ are supported.
4542

4643
``` yaml
4744
services:
48-
- namespace: my-organisation
45+
- namespace: my-organisation
4946
name: my-app
5047
```
5148
It may also need the following key-value pairs:
52-
49+
5350
- `app_source_path: <path>` - if your `app.py` file is not in the repository root
54-
51+
5552
All paths should be relative to the repository root. Other valid
5653
entries can be found in the `ServiceConfiguration` constructor.
57-
54+
5855
!!! warning
59-
56+
6057
Currently, only one service can be defined per repository, but it must
6158
still appear as a list item of the "services" key. At some point, it
6259
will be possible to define multiple services in one repository.
63-
60+
6461
If a service's app needs any configuration, asks questions to any
6562
other Twined services, or produces output datafiles/datasets, you will
6663
need to provide some or all of the following values for that service:
67-
64+
6865
- `configuration_values`
6966
- `configuration_manifest`
7067
- `children`
@@ -95,36 +92,35 @@ are supported.
9592
- [An OpenFAST service](https://github.com/octue/openfast-service/blob/main/Dockerfile)
9693

9794
If you do provide one, you must provide its path relative to your
98-
repository to the [build-twined-services] GitHub Actions [workflow](https://github.com/octue/workflows/blob/main/.github/workflows/build-twined-service.yml).
95+
repository to the `build-twined-services` GitHub Actions [workflow](https://github.com/octue/workflows/blob/main/.github/workflows/build-twined-service.yml).
9996

10097
As always, if you need help with this, feel free to drop us a message or raise an issue!
10198

102-
10399
### Where to specify the namespace, name, and revision tag
104100

105-
See [here](/services/#service-names) for service naming requirements.
101+
See [here](services.md/#service-names) for service naming requirements.
106102

107103
**Namespace**
108104

109105
- Required: yes
110106
- Set in:
111-
- `octue.yaml`
112-
- `OCTUE_SERVICE_NAMESPACE` environment variable (takes priority)
107+
- `octue.yaml`
108+
- `OCTUE_SERVICE_NAMESPACE` environment variable (takes priority)
113109

114110
**Name**
115111

116112
- Required: yes
117113
- Set in:
118-
- `octue.yaml`
119-
- `OCTUE_SERVICE_NAME` environment variable (takes priority)
114+
- `octue.yaml`
115+
- `OCTUE_SERVICE_NAME` environment variable (takes priority)
120116

121117
**Revision tag**
122118

123119
- Required: no
124120
- Default: a random "coolname" (e.g. `hungry-hippo`)
125121
- Set in:
126-
- `OCTUE_SERVICE_REVISION_TAG` environment variable
127-
- If using `octue twined service start` command, the `--revision-tag` option (takes priority)
122+
- `OCTUE_SERVICE_REVISION_TAG` environment variable
123+
- If using `octue twined service start` command, the `--revision-tag` option (takes priority)
128124

129125
## Template apps
130126

@@ -153,4 +149,4 @@ Automated deployment with Octue means:
153149
other services are sent to it, meaning there are minimal costs to
154150
having it deployed but not in use.
155151

156-
If you'd like help deploying services, contact us. To do it yourself, see [here](/deploying_services).
152+
If you'd like help deploying services, [contact us](../support.md). To do it yourself, see [here](deploying_services.md).

0 commit comments

Comments
 (0)