Something went wrong on our end
-
Karim Ahmed authoredKarim Ahmed authored
request_repeat.py 1.07 KiB
"""Send a request to repeat previous corrections.
The repeat mechanism is meant for if corrected data has been deleted,
but this script can also be used for testing.
"""
import argparse
from glob import glob
import zmq
parser = argparse.ArgumentParser(description='Request repeat correction.')
parser.add_argument('proposal', type=int, help='The proposal number')
parser.add_argument('run', type=int, help='The run number')
parser.add_argument('--mymdc-id', type=int, default=0, help="Run ID in myMdC")
parser.add_argument('--endpoint', default='tcp://max-exfl-cal001:5555',
help="The ZMQ endpoint to connect to (max-exfl-cal002 for testing)")
args = parser.parse_args()
prop_dir = glob('/gpfs/exfel/exp/*/*/p{:06d}'.format(args.proposal))[0]
instrument, cycle = prop_dir.split('/')[4:6]
con = zmq.Context()
socket = con.socket(zmq.REQ)
con = socket.connect(args.endpoint)
parm_list = ["recorrect", str(args.mymdc_id), instrument, cycle,
f'{args.proposal:06d}', str(args.run)]
socket.send(repr(parm_list).encode())
resp = socket.recv()
print(resp.decode())