Skip to content
Snippets Groups Projects
Commit cad8cdaa authored by Mikhail Karnevskiy's avatar Mikhail Karnevskiy
Browse files

Merge branch 'fix/mdc_communication' into 'master'

Fix: Convert rid to int

See merge request detectors/pycalibration!221
parents bb552241 df01c543
No related branches found
No related tags found
1 merge request!221Fix: Convert rid to int
......@@ -165,7 +165,7 @@ async def change_config(socket, config, updated_config, instrument, cycle,
fpath = "{}/{:06d}.yaml".format(prop_dir, int(proposal))
if not os.path.exists(fpath):
with open("{}/default.yaml".format(repo.working_tree_dir), "r") as f:
defconf = yaml.load(f.read())
defconf = yaml.load(f.read(), Loader=yaml.FullLoader)
subconf = {}
for action, instruments in defconf.items():
subconf[action]= {}
......@@ -174,7 +174,7 @@ async def change_config(socket, config, updated_config, instrument, cycle,
wf.write(yaml.dump(subconf, default_flow_style=False))
new_conf = None
with open(fpath, "r") as rf:
existing_conf = yaml.load(rf.read())
existing_conf = yaml.load(rf.read(), Loader=yaml.FullLoader)
new_conf = merge(updated_config, existing_conf)
if apply:
with open(fpath, "w") as wf:
......@@ -307,7 +307,7 @@ async def update_job_db(config):
flg_order = {"R": 2, "A": 1, "NA": 0}
for rid, value in combined.items():
if rid==0:
if int(rid)==0:
continue
flgs, statii = value
flg = max(flgs, key=lambda i: flg_order[i])
......@@ -536,12 +536,12 @@ async def server_runner(config, mode):
config['config-repo']['local-path'], cycle, proposal)
if os.path.exists(specific_conf_file):
with open(specific_conf_file, "r") as f:
pconf = yaml.load(f.read())[action]
pconf = yaml.load(f.read(), Loader=yaml.FullLoader)[action]
else:
default_file = "{}/default.yaml".format(
config['config-repo']['local-path'])
with open(default_file, "r") as f:
pconf = yaml.load(f.read())[action]
pconf = yaml.load(f.read(), Loader=yaml.FullLoader)[action]
if instrument not in pconf:
socket.send(Errors.NOT_CONFIGURED.encode())
logging.info(
......@@ -767,7 +767,7 @@ if __name__ == "__main__":
args = vars(parser.parse_args())
conf_file = args["config_file"]
with open(conf_file, "r") as f:
config = yaml.load(f.read())
config = yaml.load(f.read(), Loader=yaml.FullLoader)
mode = args["mode"]
logfile = args["log_file"]
fmt = '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
......
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