11# save-and-restore-api
22
3- The repository contains a Python package for communicating with Save-and-Restore service
4- (CSS Phoebus). The package provides syncronous (thread-based) and asynchronous (asyncio)
3+ ` save-and-restore-api ` is a Python library for communicating with Save-and-Restore service
4+ (CS Studio Phoebus). The package provides syncronous (thread-based) and asynchronous (asyncio)
55versions of the API functions.
66
7- ## Examples
7+ ## How to Use the Library
88
9- The following code creates a folder node named "My Folder" under the root node:
9+ The following example code creates a folder node named "My Folder" under the root node:
1010
1111``` python
1212
@@ -23,7 +23,7 @@ with SaveRestoreAPI(base_url="http://localhost:8080/save-restore") as SR:
2323 print (f " Created folder metadata: { folder} " )
2424```
2525
26- Async version of the same code:
26+ Here is an async version of the same code:
2727
2828``` python
2929
@@ -39,16 +39,11 @@ async with SaveRestoreAPI(base_url="http://localhost:8080/save-restore") as SR:
3939 print (f " Created folder metadata: { folder} " )
4040```
4141
42-
4342## ` save-and-restore ` CLI Tool
4443
45- The package also provides a simple CLI tool (` save-and-restore ` ) for performing a small
46- set of basic operations on the nodes of the Save-and-Restore service. The tool was
47- primarily developed for creating snapshot configurations based on lists of PVs.
48- For example, the tool can read a list of PVs from a .sav file generated by IOC autosave
49- and create a configuration node based on that list. Currently only autosave files
50- are supported, but support for other formats can be added if needed. The list of
51- supported functions can also be extended. Current functions are:
44+ ` save-and-restore ` CLI tool is installed with the package. The tool allows performing
45+ a limited set of basic operations on the nodes of the Save-and-Restore service.
46+ The currently selected set of operations:
5247
5348- LOGIN: test login credentials;
5449
@@ -58,4 +53,43 @@ supported functions can also be extended. Current functions are:
5853
5954- CONFIG GET: get information about an existing configuration node, including the list of PVs.
6055
61- Use ` save-and-restore -h ` to see the list of options.
56+ The tool was primarily developed for adding snapshot configurations to Save-and-Restore
57+ based on lists of PVs loaded from local files. Typical use case is to create a configuration
58+ based on a list of PVs read from an autosave (` .sav ` ) file saved by an IOC. Currently only
59+ autosave files are supported, but support for other formats can be added if needed.
60+ The list of supported functions can also be extended.
61+
62+ ## How to use ` save-and-restore ` CLI Tool
63+
64+ Read the configuration node named 'eiger_config'. Print the full configuration data
65+ (the list of PVs):
66+
67+ ``` bash
68+ save-and-restore --host-url http://localhost:8080/save-restore \
69+ CONFIG GET --config-name /detectors/imaging/eiger_config --show-data=ON
70+ ```
71+
72+ Create a new configuration node named 'eiger_config'. Load the list of PVs from
73+ file `` eiger_pvs.sav `` . Automatically create any missing parent folders in
74+ the path:
75+
76+ ``` bash
77+ save-and-restore --host-url=http://localhost:8080/save-restore --username=user\
78+ --create-folders=true CONFIG ADD --config-name=/detectors/imaging/eiger_config \
79+ --file-name=eiger_pvs.sav --file-format=autosave
80+ ```
81+
82+ Update an existing configuration node named 'eiger_config'. Load the list of PVs
83+ from the file `` eiger_pvs.sav `` :
84+
85+ ``` bash
86+ save-and-restore --host-url http://localhost:8080/save-restore --username=user\
87+ CONFIG UPDATE --config-name /detectors/imaging/eiger_config \
88+ --file-name eiger_pvs.sav --file-format autosave
89+ ```
90+
91+ Print full list of options:
92+
93+ ``` bash
94+ save-and-restore -h
95+ ```
0 commit comments