Skip to content
Snippets Groups Projects
Commit 407c8ce7 authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

MAINT: call scripts via API

parent 10b876b6
No related branches found
No related tags found
2 merge requests!39Release 0.4.0,!20created draft for generic analysis method
Pipeline #16682 failed
......@@ -92,6 +92,7 @@ import subprocess
import sys
import caosdb as db
from caosdb.utils.server_side_scripting import run_server_side_script
logger = logging.getLogger(__name__)
......@@ -134,21 +135,23 @@ def check_referenced_script(record: db.Record):
def call_script(script_name, record_id):
if script_name not in os.listdir("."):
logger.warning("No script with the name '{}' is installed.".format(
script_name))
ret = run_server_side_script(script_name, record_id)
return
# if script_name not in os.listdir("."):
# logger.warning("No script with the name '{}' is installed.".format(
# script_name))
# return
cmd = ["./"+script_name, str(record_id)]
print("Running: "+" ".join(cmd))
logger.debug("Running: "+" ".join(cmd))
ret = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
print(ret.stdout.decode())
print(ret.stderr.decode())
#cmd = ["./"+script_name, str(record_id)]
#print("Running: "+" ".join(cmd))
#logger.debug("Running: "+" ".join(cmd))
#ret = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
print(ret.stdout)
print(ret.stderr)
if ret.returncode != 0:
logger.warning("Skript failed")
logger.warning("Script failed")
def run(dataAnalysisRecord: db.Record):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment