Skip to content
Snippets Groups Projects
Commit efe465ea authored by Karim Ahmed's avatar Karim Ahmed
Browse files

instr. and det. prefix in path through repservice

parent e20e51b6
No related branches found
No related tags found
1 merge request!127feat/copy Figs of diff DETs in one INST
...@@ -37,7 +37,7 @@ SPB: ...@@ -37,7 +37,7 @@ SPB:
- 176 - 176
photon-energy: 9.2 photon-energy: 9.2
use-existing: "''" use-existing: "''"
out-folder: "/gpfs/exfel/data/scratch/xcal/report_service/tmp/AGIPD1M1_out1/" out-folder: "/gpfs/exfel/data/scratch/xcal/report_service/tmp/{instrument}/{detector}/"
cal-db-timeout: 180000 cal-db-timeout: 180000
cal-db-interface: "tcp://max-exfl016:8015#8025" cal-db-interface: "tcp://max-exfl016:8015#8025"
...@@ -62,7 +62,7 @@ MID: ...@@ -62,7 +62,7 @@ MID:
- 176 - 176
photon-energy: 9.2 photon-energy: 9.2
use-existing: "''" use-existing: "''"
out-folder: "/gpfs/exfel/data/scratch/xcal/report_service/tmp/AGIPD1M2_out1/" out-folder: "/gpfs/exfel/data/scratch/xcal/report_service/tmp/{instrument}/{detector}/"
cal-db-timeout: 180000 cal-db-timeout: 180000
cal-db-interface: "tcp://max-exfl016:8015#8025" cal-db-interface: "tcp://max-exfl016:8015#8025"
range-offset: range-offset:
...@@ -115,7 +115,7 @@ MID: ...@@ -115,7 +115,7 @@ MID:
- 50 - 50
photon-energy: 9.2 photon-energy: 9.2
use-existing: "''" use-existing: "''"
out-folder: "/gpfs/exfel/data/scratch/xcal/report_service/tmp/EPIX01_out1/" out-folder: "/gpfs/exfel/data/scratch/xcal/report_service/tmp/{instrument}/{detector}/"
cal-db-timeout: 180000 cal-db-timeout: 180000
cal-db-interface: "tcp://max-exfl016:8015#8025" cal-db-interface: "tcp://max-exfl016:8015#8025"
...@@ -138,7 +138,7 @@ MID: ...@@ -138,7 +138,7 @@ MID:
- 50 - 50
photon-energy: 9.2 photon-energy: 9.2
use-existing: "''" use-existing: "''"
out-folder: "/gpfs/exfel/data/scratch/xcal/report_service/tmp/EPIX02_out1/" out-folder: "/gpfs/exfel/data/scratch/xcal/report_service/tmp/{instrument}/{detector}/"
cal-db-timeout: 180000 cal-db-timeout: 180000
cal-db-interface: "tcp://max-exfl016:8015#8025" cal-db-interface: "tcp://max-exfl016:8015#8025"
...@@ -166,6 +166,6 @@ FXE: ...@@ -166,6 +166,6 @@ FXE:
- 512 - 512
photon-energy: 9.2 photon-energy: 9.2
use-existing: "''" use-existing: "''"
out-folder: "/gpfs/exfel/data/scratch/xcal/report_service/tmp/LPD1M1_out1/" out-folder: "/gpfs/exfel/data/scratch/xcal/report_service/tmp/{instrument}/{detector}/"
cal-db-timeout: 180000 cal-db-timeout: 180000
cal-db-interface: "tcp://max-exfl016:8015#8025" cal-db-interface: "tcp://max-exfl016:8015#8025"
...@@ -71,7 +71,7 @@ async def wait_jobs(joblist): ...@@ -71,7 +71,7 @@ async def wait_jobs(joblist):
counter += 10 counter += 10
async def get_run_base(detector): async def get_run_base(instr_name, det_name, detector):
run_base = ['xfel-calibrate'] + detector['det-type'] run_base = ['xfel-calibrate'] + detector['det-type']
...@@ -82,6 +82,9 @@ async def get_run_base(detector): ...@@ -82,6 +82,9 @@ async def get_run_base(detector):
run_base += ['--{}'.format(str(key))] run_base += ['--{}'.format(str(key))]
if not isinstance(item, list): if not isinstance(item, list):
if key == 'out-folder':
item = detector['out-folder'].format(instrument=instr_name,
detector=det_name)
run_base += [str(item)] run_base += [str(item)]
else: else:
for val in item: for val in item:
...@@ -224,8 +227,9 @@ async def server_runner(conf_file): ...@@ -224,8 +227,9 @@ async def server_runner(conf_file):
logging.info('Process detector: {}'.format(det_name)) logging.info('Process detector: {}'.format(det_name))
logging.debug('Config information: {}'.format(det_conf)) logging.debug('Config information: {}'.format(det_conf))
run_base = await get_run_base(det_conf) run_base = await get_run_base(instr_name,
det_name,
det_conf)
try: try:
output = await asyncio.create_subprocess_shell( output = await asyncio.create_subprocess_shell(
" ".join(run_base), stdout=PIPE, stderr=PIPE) " ".join(run_base), stdout=PIPE, stderr=PIPE)
...@@ -264,7 +268,9 @@ async def server_runner(conf_file): ...@@ -264,7 +268,9 @@ async def server_runner(conf_file):
# Copy all plots # Copy all plots
for det_name, det_conf in instrument.items(): for det_name, det_conf in instrument.items():
out_folder = det_conf['out-folder'] out_folder = det_conf['out-folder'].format(
instrument=instr_name,
detector=det_name)
path = cfg['GLOBAL']['git']['figures-local'] path = cfg['GLOBAL']['git']['figures-local']
figures = glob.glob("{}/*png".format(out_folder)) figures = glob.glob("{}/*png".format(out_folder))
...@@ -272,7 +278,8 @@ async def server_runner(conf_file): ...@@ -272,7 +278,8 @@ async def server_runner(conf_file):
for f in figures: for f in figures:
const = f.split('/')[-1].split('_')[0] const = f.split('/')[-1].split('_')[0]
fpath = '{}/{}/{}'.format(path, det_name, const) fpath = '{}/{}/{}'.format(path, instr_name,
det_name, const)
os.makedirs(fpath, exist_ok=True) os.makedirs(fpath, exist_ok=True)
det_new_files[f] = fpath det_new_files[f] = fpath
......
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