-
Notifications
You must be signed in to change notification settings - Fork 14
docs: restructure how-to and tutorial pages #1564
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
Open
shree-iyengar-dls
wants to merge
38
commits into
main
Choose a base branch
from
1468_restructure_blueapi_docs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
6c82b8c
docs: restructure how-to and tutorial pages
shree-iyengar-dls 7145c06
docs: change relative paths for cross-referencing
shree-iyengar-dls c598238
Merge branch 'main' into 1468_restructure_blueapi_docs
shree-iyengar-dls b7d552f
docs: addition to start rabbitmq section of run-bus.md
shree-iyengar-dls ddcb178
docs: add info on how to run a plan from docs page
shree-iyengar-dls 65ebde1
docs: add details on how to run a plan from the docs page
shree-iyengar-dls f2a670f
docs: finish off writing docs to run a plan through docs page
shree-iyengar-dls e7f9688
docs: fix reference in run-cli.md file
shree-iyengar-dls 417ed4a
chore: change image in docs from jpeg to png
shree-iyengar-dls 2e9099b
docs: update based on PR comments
shree-iyengar-dls 77a3ee1
style: reword Run Auth locally docs page
shree-iyengar-dls 4abb4d8
docs: add note about needing access to namespaces
shree-iyengar-dls 9f1ce6a
docs: add details to troubleshooting section
shree-iyengar-dls ad72bc7
Merge branch 'main' into 1468_restructure_blueapi_docs
shree-iyengar-dls 94c2586
change working in step 3 of run plan through docs page
shree-iyengar-dls 1d3ec09
style: fix typo in step 3 of run plan through docs page
shree-iyengar-dls 67ae317
docs: number and restructure tutorials section
shree-iyengar-dls 3f2dfec
docs: restructure how tos section
shree-iyengar-dls 8658cec
docs: move a couple of pages to how-to section
shree-iyengar-dls 4aeed5a
Update docs/how-to/local-auth.md
shree-iyengar-dls f99328a
docs: reorder files in tutorials folder
shree-iyengar-dls de79db7
docs: change file path in config docs page
shree-iyengar-dls 0ee422b
docs: rewrite tutorials section such that it walks through additions …
shree-iyengar-dls 7d6aa6a
chore: improve one of the error messages in def run_plan
shree-iyengar-dls d1bef1c
docs: add extra detail to top of Run a Plan from Docs page page
shree-iyengar-dls 8882fe2
docs: address comments for adding plns to init file
shree-iyengar-dls 6ca878a
style: fix typo
shree-iyengar-dls b3f08bc
docs: updates to tutorial pages after testing
shree-iyengar-dls 979405f
docs: update how-to pages
shree-iyengar-dls 1b3ffb0
chore: resolve issues due to CI failing
shree-iyengar-dls ccccaed
tests: fix test_run_plan_feedback unit test
shree-iyengar-dls 7d0a1df
docs: add detail on how to add extra config components and link to ho…
shree-iyengar-dls 6db9c97
docs: restructure how-to section for config details
shree-iyengar-dls 412bca8
docs: update myst cross references
shree-iyengar-dls c8e42ea
docs: fix typos and add links for blueapi deployment
shree-iyengar-dls f5b0dda
docs: add docs for dev tooling
shree-iyengar-dls 193333e
Merge branch 'main' into 1468_restructure_blueapi_docs
shree-iyengar-dls d96757c
chore: add back disable worker restart
shree-iyengar-dls File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
docs/how-to/integrate-with-numtracker.md → docs/how-to/1.4 integrate-with-numtracker.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| # 1.6 Tiled | ||
|
|
||
| Tiled is a server and data management system used to store and organise experimental data through a web API. It is run as a (mostly) centralised service. The RunEngine inserts bluesky documents directly into Tiled. At the moment, NeXus files are written from the messages published on the message bus. Tiled should contain the same information that is in the NeXus files but in due course, Tiled should be the one source of truth. | ||
|
|
||
| ## Configuration | ||
|
|
||
| An example configuration to enable tiled is shown in this `config.yaml` file. | ||
|
|
||
| ```{literalinclude} ../../tests/system_tests/config.yaml | ||
| :language: yaml | ||
| ``` | ||
|
|
||
| The options to configure Tiled are in the `TiledConfig` model which can be found in the [config.py file](../../src/blueapi/config.py). Apart from the url, the main aspect is authentication. This is either an ApiKey: | ||
|
|
||
| ``` | ||
| authentication: secret-key | ||
| ``` | ||
|
|
||
| or service account details: | ||
|
|
||
| ``` | ||
| authentication: | ||
| client_id: "client-id" | ||
| client_secret: "secret" | ||
| token_url: "url" | ||
| ``` | ||
|
|
||
| The values in the `config.yaml` are the default ones use if the user doesn't provide them. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # Deploying a new version of BlueAPI | ||
|
|
||
| Follow these [instructions](https://gitlab.diamond.ac.uk/sscc-docs/developer-guide/-/blob/4f28b0c4b17e34ae19faf698024bceb6e20992c9/topics/kubernetes/docs/tutorials/local_helm_on_argocd.md) for changing/testing new Blueapi deployments. | ||
|
|
||
|
|
||
| Links to the relevant services and deployment repositories: | ||
| - Testing (pxx) beamlines: [epics-containers](https://github.com/epics-containers) | ||
| - Other beamlines: [GitLab folder](https://gitlab.diamond.ac.uk/controls/containers/beamline) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| # Commands for dev tooling | ||
|
|
||
| This page outlines useful commands for dev tooling. More information can be found in the [python-copier-template docs](https://github.com/DiamondLightSource/python-copier-template/tree/main/docs). | ||
|
|
||
| The table below outlines useful commands with instructions for download on Diamond workstations. | ||
|
|
||
| | Command | Installation | Example of use| | ||
| | ------------- | ------------- | ------------- | | ||
| | `podman` | [Dev-Guide link](https://dev-guide.diamond.ac.uk/containers/tutorials/podman/) | `podman run ghcr.io/diamondlightsource/blueapi:latest` to pull the blueapi container from the GitHub container registry | | ||
| | `docker-compose` | [Dev-Guide link](https://dev-guide.diamond.ac.uk/epics-containers/reference/setup/#docker-compose) | `docker compose -f tests/system_tests/compose.yaml up -d` to spin up dummy versions of blueapi associated services | | ||
| | `uv` | `module load uv` | `uv run --with blueapi path/to/script.py` to run a standalone script | | ||
| | `prek` | Run `uv run prek install` the first time the repo is cloned to set up pre-commit checks | `uv run prek` or `uv run prek --all-files` | | ||
| | `tox` | `uv tool install tox` | `tox -e tests -- tests/unit_tests/test_config.py::test_config_yaml_parsed` is an example of running a specific test and `tox -e tests` will run all unit tests| | ||
| | `just` | `uv tool rust-just` | `just lint` will run all pre-commit checks| |
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| [rabbitmq_stomp]. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # 2. Quickstart guide | ||
|
|
||
| Blueapi acts as a worker that can run Bluesky plans against devices for a specific laboratory setup. It can control devices to collect data and export events to tell downstream services about the data it has collected. | ||
|
|
||
| You should be in the blueapi directory that you have cloned. From here, if you open VSCode, you will probably be prompted to 'Reopen in Container' which you can do and then run the following commands to start the worker. | ||
|
|
||
| If you not, you can still run the following from the venv created in page 1 but you may need to run the command below to have the dependencies required for this tutorial. | ||
|
|
||
| ``` | ||
| pip install .[demo] | ||
| ``` | ||
|
|
||
| ## Start Worker | ||
|
|
||
| To start the worker: | ||
| ``` | ||
| blueapi serve | ||
| ``` | ||
| This will use all the defaults in `src/blueapi/config.py` | ||
|
|
||
| ## Basic Introspection | ||
|
|
||
| Blueapi comes with a minimal CLI client for basic control/debugging. We can use this to see which plans and devices are available. In a new terminal window, run the following commands. | ||
|
|
||
| If working in a venv, you may need to reactivate it. To do this, assuming you are still in the blueapi repo in your terminal, use: | ||
| ``` | ||
| source .venv/bin/activate | ||
| ``` | ||
|
|
||
| Now, run the following to see what plans and devices are available: | ||
|
|
||
| ``` | ||
| blueapi controller plans | ||
| blueapi controller devices | ||
| ``` | ||
|
|
||
| We should now have an empty context. | ||
|
|
||
| See also [Full CLI reference](../reference/cli.md) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| # 3. Config add devices | ||
|
|
||
| Blueapi is highly configurable. The config details aspects that impact how Blueapi works and it is customisable. | ||
|
|
||
| As a first step, create a `config.yaml` file. This would be best placed in the `docs/resources` folder. | ||
|
|
||
| Initially, add devices using the following code: | ||
|
|
||
| ```yaml | ||
| env: | ||
| metadata: | ||
| instrument: demo | ||
| sources: | ||
| - kind: deviceManager | ||
| module: blueapi.tutorial.devices | ||
| ``` | ||
|
|
||
| The `env` section of the `config.yaml` file lets you create and set environment variables. The `demo` points to optional dependencies in the [pyproject.toml file](../../pyproject.toml). The module above points to the devices you will use for this tutorial which can be found [here](../../src/blueapi/tutorial/devices.py). | ||
|
|
||
| Save the file and restart the worker to use this new `config.yaml` file you have created. To do this, navigate back to the terminal window where the worker is running, CTRL+C to close it then run the following command: | ||
| ``` | ||
| blueapi --config docs/resources/config.yaml serve | ||
| ``` | ||
|
|
||
| The above command assumes you created the `config.yaml` file in `docs/resources`. Else, replace `docs/resources/config.yaml` with whichever file path your `config.yaml` has. | ||
|
|
||
| Now run | ||
| ```blueapi controller devices``` in the same terminal window as you did when previously running this command and you should see `det` and `stage`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # 4. Config add plans | ||
|
|
||
| As well as adding devices to the `config.yaml`, you can add plans. Under the code you already have, add the following: | ||
|
|
||
| ``` yaml | ||
| - kind: planFunctions | ||
| module: dodal.plans | ||
| - kind: planFunctions | ||
| module: dodal.plan_stubs.wrapped | ||
| ``` | ||
| These plans that will be used in this tutorial can be found in the [dodal repository](https://github.com/DiamondLightSource/dodal/tree/b4b38f1e0cf480faeb29d67695440c45a148f169). Specifically, in `dodal/src/dodal/plans/wrapped.py` and `dodal/src/dodal/plan_stubs/wrapped.py`. | ||
|
|
||
| Save the changes you've made to the `config.yaml` file. Navigate back to the terminal where the blueapi worker is running. Restart the server to use this updated `config.yaml` file. | ||
|
|
||
| Now run | ||
| ```blueapi controller plans``` in the same terminal window used previously for this command and you should see a list of plans that can be run. For example, `count`, `list_grid_scan`, `num_scan` etc. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worker or server?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm is it better to say 'Blueapi contains a worker that can run ...' ?