Skip to content
Snippets Groups Projects
Commit d85b319c authored by Steffen Hauf's avatar Steffen Hauf
Browse files

Fixes

parent 56c5690b
No related branches found
No related tags found
1 merge request!47Fixes from webservices
This diff is collapsed.
......@@ -6,13 +6,13 @@ import urllib.parse
import zmq
parser = argparse.ArgumentParser(
description='Request dark characterization')
parser.add_argument('--proposal', type=str)
parser.add_argument('--instrument', type=str, choices=["SPB", "MID", "FXE", "SCS", "SQS", "HED"])
parser.add_argument('--cycle', type=str)
parser.add_argument('--run-high', type=str)
parser.add_argument('--run-med', type=str)
parser.add_argument('--run-low', type=str)
description='Request dark characterization. Will wait on data transfers to complete first!')
parser.add_argument('--proposal', type=str, help='The proposal number, without leading p, but with leading zeros')
parser.add_argument('--instrument', type=str, choices=["SPB", "MID", "FXE", "SCS", "SQS", "HED"], help='The instrument')
parser.add_argument('--cycle', type=str, help='The facility cycle')
parser.add_argument('--run-high', type=str, help='Run number of high gain data as an integer')
parser.add_argument('--run-med', type=str, help='Run number of medium gain data as an integer')
parser.add_argument('--run-low', type=str, help='Run number of low gain data as an integer')
args = vars(parser.parse_args())
......
......@@ -5,7 +5,7 @@ con = zmq.Context()
socket = con.socket(zmq.REQ)
con = socket.connect("tcp://localhost:5555")
if sys.argv[1] == "correct":
msg = "','".join(["correct", "23010", "SASE1", "SPB", "201930", "900062", "333"])
msg = "','".join(["correct", "23440", "SASE1", "SPB", "201921", "2413", "4"])
if sys.argv[1] == "dark":
msg = "','".join(["dark", "20829", "SASE1", "SPB", "201930", "900062", "(\"run-high\", \"264\")", "(\"run-med\", \"265\")", "(\"run-low\", \"266\")"])
......
......@@ -168,8 +168,8 @@ async def update_job_db(config):
"""
logging.info("Starting config db handling")
conn = await init_job_db(config)
mdc = await init_md_client(config)
while True:
mdc = await init_md_client(config)
statii = await slurm_status()
c = conn.cursor()
c.execute("SELECT * FROM jobs")
......@@ -376,7 +376,7 @@ async def server_runner(config, mode):
mdc = await init_md_client(config)
async def do_action():
async def do_action(action, payload):
in_folder = None
out_folder = None
run_mapping = {}
......@@ -399,7 +399,7 @@ async def server_runner(config, mode):
else:
run_mapping['no_mapping_{}'.format(i)] = erun
wait_runs.append(erun)
proposal = "{:06d}".format(int(proposal))
specific_conf_file = "{}/{}/{}.yaml".format(
config['config-repo']['local-path'], cycle, proposal)
if os.path.exists(specific_conf_file):
......@@ -438,6 +438,7 @@ async def server_runner(config, mode):
["getfattr", "-n", "user.status", rpath],
stdout=subprocess.PIPE)
rstr = ret.stdout.decode()
print(rstr)
if tries > max_tries:
return False
tries += 1
......@@ -445,6 +446,7 @@ async def server_runner(config, mode):
return ret.returncode == 0
transfer_complete = await wait_on_transfer()
print("Transfer complete: ", transfer_complete)
all_transfers.append(transfer_complete)
if not transfer_complete:
logging.error(
......@@ -457,13 +459,16 @@ async def server_runner(config, mode):
if response.status_code != 200:
logging.error(Errors.MDC_RESPONSE.format(response))
print("All transfers", all(all_transfers))
if not all(all_transfers):
logging.error(Errors.TRANSFER_EVAL_FAILED.format(proposal,
",".join(
wait_runs)))
return
print("Now doing: {}".format(action))
if action == 'dark':
print("Running dark cal")
status = []
detectors = {}
out_folder = config[action]['out-folder'].format(
......@@ -491,6 +496,7 @@ async def server_runner(config, mode):
del thisconf[
"inset"] # don't need this for xfel-calibrate
detectors[detector] = thisconf
print("Detectors:", detectors)
for detector, dconfig in detectors.items():
cmd = ["python", "-m", "xfel_calibrate.calibrate",
detector, "DARK"]
......@@ -513,7 +519,8 @@ async def server_runner(config, mode):
status.append(ret)
if action == 'correct':
rpath = "{}/r{:04d}/".format(in_folder, int(wait_runs[0]))
runnr = wait_runs[0]
rpath = "{}/r{:04d}/".format(in_folder, int(runnr))
out_folder = config[action]['out-folder'].format(
instrument=instrument, cycle=cycle, proposal=proposal)
......@@ -566,7 +573,7 @@ async def server_runner(config, mode):
instrument, cycle, proposal)
try:
asyncio.ensure_future(do_action())
asyncio.ensure_future(do_action(copy.copy(action), copy.copy(payload)))
except Exception as e: # actions that fail are only error logged
logging.error(str(e))
......
......@@ -16,7 +16,7 @@ jupyter_path = "jupyter"
karabo_activate_path = ""
# Path to use for calling ipcluster. If the environment is correctly set, simply the command
ipcluster_path = "/home/haufs/calkarabo/karabo/extern/bin/ipcluster"
ipcluster_path = "ipcluster"
# Path to store reports in
report_path = "{}/calibration_reports/".format(os.getcwd())
......
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