Isolate anatric subprocesses
This commit is contained in:
parent
67853b8db4
commit
00ff4117ea
@ -23,12 +23,13 @@ REFLECTION_PRINTER_FORMATS = [
|
|||||||
ALGORITHMS = ["adaptivemaxcog", "adaptivedynamic"]
|
ALGORITHMS = ["adaptivemaxcog", "adaptivedynamic"]
|
||||||
|
|
||||||
|
|
||||||
def anatric(config_file, anatric_path="/afs/psi.ch/project/sinq/rhel7/bin/anatric"):
|
def anatric(config_file, anatric_path="/afs/psi.ch/project/sinq/rhel7/bin/anatric", cwd=None):
|
||||||
comp_proc = subprocess.run(
|
comp_proc = subprocess.run(
|
||||||
[anatric_path, config_file],
|
[anatric_path, config_file],
|
||||||
check=True,
|
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.STDOUT,
|
stderr=subprocess.STDOUT,
|
||||||
|
cwd=cwd,
|
||||||
|
check=True,
|
||||||
text=True,
|
text=True,
|
||||||
)
|
)
|
||||||
print(" ".join(comp_proc.args))
|
print(" ".join(comp_proc.args))
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import base64
|
import base64
|
||||||
import io
|
import io
|
||||||
|
import os
|
||||||
import re
|
import re
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
@ -347,14 +348,14 @@ def create():
|
|||||||
temp_file = temp_dir + "/config.xml"
|
temp_file = temp_dir + "/config.xml"
|
||||||
config.save_as(temp_file)
|
config.save_as(temp_file)
|
||||||
if doc.anatric_path:
|
if doc.anatric_path:
|
||||||
pyzebra.anatric(temp_file, anatric_path=doc.anatric_path)
|
pyzebra.anatric(temp_file, anatric_path=doc.anatric_path, cwd=temp_dir)
|
||||||
else:
|
else:
|
||||||
pyzebra.anatric(temp_file)
|
pyzebra.anatric(temp_file, cwd=temp_dir)
|
||||||
|
|
||||||
with open(config.logfile) as f_log:
|
with open(os.path.join(temp_dir, config.logfile)) as f_log:
|
||||||
output_log.value = f_log.read()
|
output_log.value = f_log.read()
|
||||||
|
|
||||||
with open(config.reflectionPrinter_file) as f_res:
|
with open(os.path.join(temp_dir, config.reflectionPrinter_file)) as f_res:
|
||||||
output_res.value = f_res.read()
|
output_res.value = f_res.read()
|
||||||
|
|
||||||
process_button = Button(label="Process", button_type="primary")
|
process_button = Button(label="Process", button_type="primary")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user