diff --git a/RELEASE_GUIDELINES.md b/RELEASE_GUIDELINES.md index 68deedf263dd8431d4e37e8ea732af2dda3304f5..f2671ed5b35e04872e3081a3e65c51baf381410b 100644 --- a/RELEASE_GUIDELINES.md +++ b/RELEASE_GUIDELINES.md @@ -1,6 +1,6 @@ # Release Guidelines for the CaosDB Python Client Library -This document specifies release guidelines in addition to the generel release +This document specifies release guidelines in addition to the general release guidelines of the CaosDB Project ([RELEASE_GUIDELINES.md](https://gitlab.com/caosdb/caosdb/blob/dev/RELEASE_GUIDELINES.md)) @@ -38,5 +38,5 @@ guidelines of the CaosDB Project 10. Merge the main branch back into the dev branch. 11. After the merge of main to dev, start a new development version by - setting `ISRELEASED` to `False` and by increasing at least the `MIRCO` + setting `ISRELEASED` to `False` and by increasing at least the `MICRO` version in [setup.py](./setup.py) and preparing CHANGELOG.md. diff --git a/src/doc/tutorials/index.rst b/src/doc/tutorials/index.rst index 79068e9201498c87b2eb61b4ffbea0969845b404..0b08d0b4fe153d803a780bd144787819b827db78 100644 --- a/src/doc/tutorials/index.rst +++ b/src/doc/tutorials/index.rst @@ -16,4 +16,5 @@ advanced usage of the Python client. errors data-model-interface complex_data_models + serverside diff --git a/src/doc/tutorials/serverside.rst b/src/doc/tutorials/serverside.rst new file mode 100644 index 0000000000000000000000000000000000000000..93f0fdcf742efc70bc80f5113eb7c6ddbbf87cde --- /dev/null +++ b/src/doc/tutorials/serverside.rst @@ -0,0 +1,61 @@ + +Server Side Scripting +===================== + +The administrator may store regularly needed scripts, e.g. for computing a +standardized analysis, on the same machine as the CaosDB server, "on the server +side", where they can be run directly by the server. + +The execution of those scripts can be initiated using the Python client, or the +web interface. + +Call a Script +~~~~~~~~~~~~~ + +If you have access to the server and sufficient permissions to run the script, +execution is fairly simple: + +.. code:: python + + from caosdb.utils.server_side_scripting import run_server_side_script + response = run_server_side_script('scriptname.py') + print(response.stderr,response.stdout) + + +This makes the server run the script ``scriptname.py``. The output of the +script (``stderr`` and ``stdout``) is returned within an response object. + + +If the script requires additional arguments, those can be provided after the +script's name. + +Note that by default the script runs with your CaosDB account. It has your +permissions and changes are logged as if they were done by you directly. + + +Testing it +~~~~~~~~~~ + +You can try this out using for example the ``diagnostics.py`` script (it is part +of the `CaosDB server repository +<https://gitlab.indiscale.com/caosdb/src/caosdb-server/-/blob/main/scripting/bin/administration/diagnostics.py>`_ +and is also available on https://demo.indiscale.com). The script returns +information about the server in JSON format. You can do for example the +following: + +.. code:: python + + import json + from caosdb.utils.server_side_scripting import run_server_side_script + response = run_server_side_script('administration/diagnostics.py') + print("JSON content:") + print(json.loads(response.stdout)) + print("stderr:") + print(response.stderr) + + +Further Information +~~~~~~~~~~~~~~~~~~~ + +Additionally, you might want to have a look at +https://docs.indiscale.com/caosdb-server/specification/Server-side-scripting.html