Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-pylib
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-pylib
Commits
13557a17
Commit
13557a17
authored
3 years ago
by
Henrik tom Wörden
Browse files
Options
Downloads
Patches
Plain Diff
DOC: add doc on serverside
parent
e7b7de3f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!39
DOC: add doc on serverside
Pipeline
#17582
passed
3 years ago
Stage: code_style
Stage: linting
Stage: test
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/doc/tutorials/index.rst
+1
-0
1 addition, 0 deletions
src/doc/tutorials/index.rst
src/doc/tutorials/serverside.rst
+53
-0
53 additions, 0 deletions
src/doc/tutorials/serverside.rst
with
54 additions
and
0 deletions
src/doc/tutorials/index.rst
+
1
−
0
View file @
13557a17
...
...
@@ -16,4 +16,5 @@ advanced usage of the Python client.
errors
data-model-interface
complex_data_models
serverside
This diff is collapsed.
Click to expand it.
src/doc/tutorials/serverside.rst
0 → 100644
+
53
−
0
View file @
13557a17
Server Side Scripting
=====================
Some regular needed scripts, e.g. for computing a standardized analysis, might
be placed by the administrator on the same machine as the CaosDB server such
that they can be executed there, on the server side.
The execution of those scripts can also be started using the Python client.
Call a Script
~~~~~~~~~~~~~
Of course, you need to have access to the server and sufficient permissions to
run the script that you want to run. Execution is then 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 triggers the execution of 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
scriptname.
Note, that by default the script runs with your 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 ``diagnositics.py`` script (it is
also available on https://demo.indiscale.com). The script returns some
information 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.loads(response.stdout))
print(response.stderr)
Further Information
~~~~~~~~~~~~~~~~~~~
Additionally, you might have a look at https://docs.indiscale.com/caosdb-server/specification/Server-side-scripting.html
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment