Skip to content

Commit

Permalink
Merge class defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
slominskir committed May 19, 2021
1 parent 12dabde commit 8b893e9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions examples/registrations/alarm-registrations
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
alarm1={"producer": {"org.jlab.jaws.entity.EPICSProducer": {"pv": "channel1"}}, "class": "Base_Class", "location": "INJ", "category": "RF", "latching": false, "filterable": true, "ondelayseconds": null, "offdelayseconds": null, "screenpath": "/", "priority": null, "pointofcontactusername": null, "rationale": null, "correctiveaction": "", "maskedby": null}
alarm2={"producer": {"org.jlab.jaws.entity.EPICSProducer": {"pv": "channel2"}}, "class": "Base_Class", "location": "INJ", "category": "RF", "latching": false, "filterable": true, "ondelayseconds": null, "offdelayseconds": null, "screenpath": "/", "priority": null, "pointofcontactusername": null, "rationale": null, "correctiveaction": "", "maskedby": null}
alarm3={"producer": {"org.jlab.jaws.entity.EPICSProducer": {"pv": "channel3"}}, "class": "Base_Class", "location": "INJ", "category": "RF", "latching": false, "filterable": true, "ondelayseconds": null, "offdelayseconds": null, "screenpath": "/", "priority": null, "pointofcontactusername": null, "rationale": null, "correctiveaction": "", "maskedby": null}
alarm1={"producer": {"org.jlab.jaws.entity.EPICSProducer": {"pv": "channel1"}}, "class": "Base_Class", "location": "INJ", "category": "RF", "latching": false, "filterable": true, "ondelayseconds": null, "offdelayseconds": null, "screenpath": "/", "priority": null, "pointofcontactusername": null, "rationale": null, "correctiveaction": null, "maskedby": null}
alarm2={"producer": {"org.jlab.jaws.entity.EPICSProducer": {"pv": "channel2"}}, "class": "Base_Class", "location": "INJ", "category": "RF", "latching": false, "filterable": true, "ondelayseconds": null, "offdelayseconds": null, "screenpath": "/", "priority": null, "pointofcontactusername": null, "rationale": null, "correctiveaction": null, "maskedby": null}
alarm3={"producer": {"org.jlab.jaws.entity.EPICSProducer": {"pv": "channel3"}}, "class": "Base_Class", "location": "INJ", "category": "RF", "latching": false, "filterable": true, "ondelayseconds": null, "offdelayseconds": null, "screenpath": "/", "priority": null, "pointofcontactusername": null, "rationale": null, "correctiveaction": null, "maskedby": null}
10 changes: 5 additions & 5 deletions scripts/client/list-registered.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@ def alarms_get_row(msg):
row = [key, None]
else:

if value.alarm_class in classes:
print("merging class defaults: {}".format(classes[value.alarm_class]))
RegisteredClassSerde.setClassDefaults(value, classes[value.alarm_class])
if value.alarm_class.name in classes:
RegisteredClassSerde.setClassDefaults(value, classes[value.alarm_class.name].value())

row = [key,
value.alarm_class.name,
Expand Down Expand Up @@ -172,7 +171,8 @@ def classes_initial_state(records):
global classes

if params.display == 'alarms_with_class_defaults':
classes = records
for record in records.values():
classes[record.key().alarm_class.name] = record
list_alarms()
elif params.export:
classes_export(records)
Expand All @@ -182,7 +182,7 @@ def classes_initial_state(records):

def classes_state_update(record):
if params.display == 'alarms_with_class_defaults':
classes[record.key()] = record
classes[record.key().alarm_class.name] = record
else:
row = classes_get_row(record)
print(row)
Expand Down

0 comments on commit 8b893e9

Please sign in to comment.