fixes in secop_psi/sea.py

is_running parameter
This commit is contained in:
zolliker 2022-04-20 15:52:43 +02:00
parent 1da7657483
commit 774f33122a

View File

@ -406,7 +406,9 @@ class SeaModule(Module):
# with open(join(seaconfdir, json_file + '.json')) as fp: # with open(join(seaconfdir, json_file + '.json')) as fp:
# sea_object, descr = json.load(fp) # sea_object, descr = json.load(fp)
with open(join(seaconfdir, json_file)) as fp: with open(join(seaconfdir, json_file)) as fp:
descr = json.load(fp)[sea_object] content = json.load(fp)
# print(json_file, content.keys())
descr = content[sea_object]
if rel_paths == '*' or not rel_paths: if rel_paths == '*' or not rel_paths:
# take all # take all
main = descr['params'][0] main = descr['params'][0]
@ -419,13 +421,14 @@ class SeaModule(Module):
# filter by relative paths # filter by relative paths
rel_paths = rel_paths.split() rel_paths = rel_paths.split()
result = [] result = []
is_running = None
for rpath in rel_paths: for rpath in rel_paths:
include = True include = True
for paramdesc in descr['params']: for paramdesc in descr['params']:
path = paramdesc['path'] path = paramdesc['path']
if path.endswith('is_running'): if path.endswith('is_running'):
# take this always # take this always
result.append(paramdesc) is_running = paramdesc
continue continue
if paramdesc.get('visibility', 1) > visibility_level: if paramdesc.get('visibility', 1) > visibility_level:
continue continue
@ -437,6 +440,8 @@ class SeaModule(Module):
result.append(paramdesc) result.append(paramdesc)
elif sub[0] == rpath: elif sub[0] == rpath:
result.append(paramdesc) result.append(paramdesc)
if is_running: # take this at end
result.append(is_running)
descr['params'] = result descr['params'] = result
rel0 = '' if rel_paths[0] == '.' else rel_paths[0] rel0 = '' if rel_paths[0] == '.' else rel_paths[0]
if result[0]['path'] == rel0: if result[0]['path'] == rel0: