Skip to content
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

update documentation #248

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
13 changes: 10 additions & 3 deletions docs/developer/explanations/architecture.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,17 @@ the known expectations of the plan, passes it to the ``RunEngine`` and handles a
The Service Object
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's now called handler but maybe should have a better name

^^^^^^^^^^^^^^^^^^

Handles communications and the API layer. This object holds a reference to the worker
can interrogate it/give it instructions in response to messages it recieves from the message
bus. It can also forward the various events generated by the worker to topics on the bus.
Handles communications between the ``BlueskyContext`` and ``Worker`` and sets up subscriptions for
publishing Bluesky event documents to the message bus. This object is injected as a dependency into
(using the FastAPI_ dependency injection system) to all REST endpoints, exposing their methods to
Comment on lines +41 to +42
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
publishing Bluesky event documents to the message bus. This object is injected as a dependency into
(using the FastAPI_ dependency injection system) to all REST endpoints, exposing their methods to
publishing Bluesky event documents to the message bus. This object is injected as a dependency (using the FastAPI_ dependency injection system) into the REST endpoints, exposing their methods to

the REST API.

The REST API
^^^^^^^^^^^^

Exposes methods of the ``Worker`` to REST endpoints, which are used by the CLI as well.
Written with FastAPI_, this layer also validates request and response bodies/parameters.

.. _RunEngine: https://nsls-ii.github.io/bluesky/run_engine_api.html
.. _IPython: https://ipython.org/
.. _FastAPI: https://fastapi.tiangolo.com/lo/
14 changes: 14 additions & 0 deletions docs/developer/how-to/update-openapi.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Update the openapi schema
-------------------------

If you change any of the code in src/blueapi/service/main, it is imperative that
you update the openapi schema to reflect these changes. There is a test to check
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add reason why

that this has been done.

Simply type,
```
blueapi schema -u
```

To update. You can also specify a `-o` tag to generate the schema elsewhere - note
this doesn't work in combination to the `-u` tag.
1 change: 1 addition & 0 deletions docs/developer/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ side-bar.
how-to/static-analysis
how-to/lint
how-to/update-tools
how-to/update-openapi
how-to/make-release

+++
Expand Down
Binary file modified docs/images/blueapi-architecture.png
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check how this shows up in dark mode

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 14 additions & 2 deletions docs/user/how-to/configure-app.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,17 @@ and simply pass it to the CLI by typing::
$ blueapi --config path/to/file.yaml

where ``path/to/file.yaml`` is the relative path to the configuration file you
wish to use. Then, any subsequent calls to child commands of blueapi will
use this file.
wish to use.

Note: child commands
--------------------
Configuration options need to be passed down to child commands. For example,
if you start the server with::
$ blueapi --config path/to/file.yaml

And then use the CLI to discover the devices with::
$ blueapi controller devices

The configuration for the second command will be different to the first. You
must supply the correct configuration in this case::
$ blueapi --config path/to/file.yaml controller devices
39 changes: 39 additions & 0 deletions docs/user/how-to/use-cli.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Use the command line interface (CLI)
====================================

Blueapi comes pacakged with a simple click based CLI. You can start the server
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete first sentence

and then query it for plans and devices, as well as ask it to run a plan, through
the CLI.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
the CLI.
the bundled CLI client.


Starting the server
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-------------------
You can start the server and optionally specify configuration options (see the
documentation section on how to :doc:`configure blueapi <./configure-app>`) with
the following command::
blueapi serve

The default configuration options for this command will start up the server using
startup scripts found in `src/blueapi/startup` - this will initialise the server
with existing plans and devices that can be run with those plans.

Find devices
------------
A list of all usable devices can be retrieved with the following command::
blueapi controller devices

Find plans
----------
A list of all plans runnable by the server can be queried with::
blueapi controller plans

Run a plan
----------
To run a plan, you must specify a valid name of a plan with correct parameters.
The 'sleep' command would need to be run like so::
blueapi controller run sleep '{"time": 2.0}'

where `2.0` can be any number. By default, the worker will try to run the plan
until completion, but you can specify a timeout::
blueapi controller run sleep '{"time": 2.0}' -t 1.0

In this case, this will fail with a timeout error.