Skip to content

Commit a937ef6

Browse files
committed
First documentation of usage, configuration build, install
README.md now contains short usage example
1 parent 0012605 commit a937ef6

File tree

6 files changed

+148
-24
lines changed

6 files changed

+148
-24
lines changed

README.md

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,22 @@
1-
# bact-archiver BACT: access to the archiver appliance
1+
# bact-archiver: access to the archiver appliance
22

3-
Build instructions
4-
------------------
3+
## Usage
54

6-
Distribution files contain the files generated by protoc and cython. THus
7-
standard python build commands are sufficient. If you are using the
8-
git repository you need to execute described below.
95

6+
Typically download bact-archiver-local.
7+
Rename it and configure it as described in the configuration section of this
8+
package documentation.
109

11-
Rebuilding generated files
12-
--------------------------
10+
Then you can use it by
1311

14-
This packages uses the following code generation tools
12+
```python3
1513

16-
* protoc, the protocl buffer compiler
17-
* cython, the cython compiler
14+
from <your-local-bact-archiver-package> import default as default_archiver
15+
import datetime
1816

19-
To rebuild the files generated by protoc use
20-
```shell
21-
> python3 setup.py build_proto_c
22-
```
23-
24-
To force that the cython generated files are rebuilt use
25-
```shell
26-
> CYTHONIZE=1 setup.py
27-
```
17+
t0 = datetime.datetime(2020, 11, 20, 7, 40)
18+
t1 = datetime.datetime(2020, 11, 20, 7, 50)
2819

29-
Finally use the usual build commands:
30-
```shell
31-
> python3 setup.py build
20+
pvname = 'TOPUPCC:rdCur'
21+
df = default_archiver.getData(pvname, t0=t0, t1=t1)
3222
```

doc/bact_archiver.rst

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
bact-archiver package
22
=====================
33

4+
The module :mod:`bact_archiver` provides access to an EPICS appliance
5+
archiver using the protocol buffer interface.
6+
7+
8+
.. toctree::
9+
10+
bact_archiver_usage
11+
bact_archiver_build
12+
bact_archiver_config
13+
bact_archiver_register
14+
bact_archiver.archiver
15+
416
Module contents
517
---------------
618

@@ -13,4 +25,3 @@ Subpackages
1325
-----------
1426

1527
.. toctree::
16-
bact-archiver.archiver

doc/bact_archiver_build.rst

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
Building the bact archiver package
2+
==================================
3+
This packages implements the protobuf based access to the archiver
4+
appliance. This packages contains:
5+
6+
* In directory `proto`
7+
8+
* the protocol definition
9+
* cython files for the access
10+
11+
12+
* In directory `proto_gen`
13+
14+
* the files generated by the protoc compiler, as long as these
15+
need to be compiled (i.e. c++ source and header files)
16+
17+
18+
So a typical build process adheres to standard package interface
19+
20+
Budiling protocol buffer files
21+
------------------------------
22+
23+
A custom command is provided for the protoc compile step. Please use
24+
25+
.. code::python
26+
27+
python3 setup.py build_proto_c
28+
29+
30+
for this step. This step is typically required to keep track with the locally
31+
used protobuf implementation. A following build will cythonize and
32+
compile the generated files.

doc/bact_archiver_config.rst

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,39 @@
11
Configuring bact archiver
22
=========================
3+
4+
This packages contains the code implementing the protobuf based
5+
protocol. For adaption to local installation it is recommended
6+
to create a package like e.g. http:pypi.org//bact-archiver-bessyii.
7+
8+
Apart from files required by setup, this packages contains two files:
9+
10+
`config/archiver.cfg`
11+
access information to the available archivers
12+
13+
`__init__.py`:
14+
executes register function from bact-archiver
15+
16+
17+
Format of `config/archiver.cfg`
18+
-------------------------------
19+
The default section contains the name of the archivers, that should be
20+
your default archiver. Apart from the default section, each section
21+
reflects the access to an archiver appliance. Each entry matches
22+
one keyword of the initaliser of
23+
:class:`bact_archiver.config.ArchiverConfiguration`.
24+
25+
26+
27+
Configuration Classes
28+
---------------------
29+
30+
.. autoclass:: bact_archiver.config.ArchiverConfigurationInterface
31+
:members:
32+
:undoc-members:
33+
:show-inheritance:
34+
35+
36+
.. autoclass:: bact_archiver.config.ArchiverConfiguration
37+
:members:
38+
:undoc-members:
39+
:show-inheritance:

doc/bact_archiver_register.rst

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
Registering archivers in your module
2+
====================================
3+
4+
Typically it will be sufficient to
5+
6+
* edit `config/archiver.cfg`
7+
8+
* leave the following lines in `__init__.py`
9+
10+
11+
.. code:: python
12+
13+
from bact_archiver import register_archivers
14+
register_archivers(__name__)
15+
16+
17+
if you modify `bact-archiver-local` to your needs. When your packages
18+
is loaded, :func:`bact_archiver.register_archivers` will read your
19+
configuration file. It will add each archiver it finds there to your
20+
module using the `section name` in the configuration. Furthermore it
21+
will add the default one as 'default'. Thus the default archiver can
22+
be accessed by `<your-package-name>.default`.
23+
24+
25+
Internals of the register module
26+
--------------------------------
27+
28+
The register module is split up in different parts. These are
29+
considered internal to the package. Please drop a line if you need
30+
parts of this functionality exposed.
31+
32+
.. automodule:: bact_archiver.register
33+
:members:
34+
:undoc-members:
35+
:show-inheritance:

doc/bact_archiver_usage.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Usage
2+
=====
3+
4+
A typical usage scenario is given below
5+
6+
.. code:: python
7+
8+
from <your-local-bact-archiver-package> import default as default_archiver
9+
import datetime
10+
11+
t0 = datetime.datetime(2020, 11, 20, 7, 40)
12+
t1 = datetime.datetime(2020, 11, 20, 7, 50)
13+
14+
pvname = 'TOPUPCC:rdCur'
15+
df = default_archiver.getData(pvname, t0=t0, t1=t1)
16+
17+
18+
if help is required, please address it to the mailing list.
19+
Examples are very welcomed!

0 commit comments

Comments
 (0)