Skip to content
Snippets Groups Projects
Commit 179713a0 authored by Thomas Kluyver's avatar Thomas Kluyver
Browse files

Add script for testing repeat mechanism in webservice

parent 852ac9e1
No related branches found
No related tags found
1 merge request!695[webservice] Support requests to repeat correction from myMdC
"""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('--endpoint', default='tcp://max-exfl016:5555',
help="The ZMQ endpoint to connect to (max-exfl017 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 = ["repeat", "0", instrument, cycle,
f'{args.proposal:06d}', str(args.run)]
socket.send(repr(parm_list).encode())
resp = socket.recv()
print(resp.decode())
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