-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4eca423
commit be4a4d9
Showing
9 changed files
with
225 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"type": "record", | ||
"name": "AlarmViewpoint", | ||
"namespace": "org.jlab.jaws.entity", | ||
"doc": "Value of a named viewpoint", | ||
"fields": [ | ||
{ | ||
"name": "location", | ||
"type": { | ||
"type": "array", | ||
"items" : "string", | ||
"default": [] | ||
}, | ||
"doc": "The location names" | ||
}, | ||
{ | ||
"name": "category", | ||
"type": { | ||
"type": "array", | ||
"items" : "string", | ||
"default": [] | ||
}, | ||
"doc": "The category names" | ||
}, | ||
{ | ||
"name": "alarmclass", | ||
"type": { | ||
"type": "array", | ||
"items" : "string", | ||
"default": [] | ||
}, | ||
"doc": "The alarmclass names" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env python3 | ||
|
||
""" | ||
Lists the alarm viewpoints. | ||
""" | ||
|
||
import click | ||
from ...console import ViewpointConsoleConsumer | ||
|
||
|
||
# pylint: disable=missing-function-docstring,no-value-for-parameter | ||
@click.command() | ||
@click.option('--monitor', is_flag=True, help="Monitor indefinitely") | ||
@click.option('--nometa', is_flag=True, help="Exclude audit headers and timestamp") | ||
@click.option('--export', is_flag=True, help="Dump records in AVRO JSON format") | ||
def list_viewpoints(monitor, nometa, export) -> None: | ||
consumer = ViewpointConsoleConsumer('list_viewpoints.py') | ||
|
||
consumer.consume_then_done(monitor, nometa, export) | ||
|
||
|
||
def click_main() -> None: | ||
list_viewpoints() | ||
|
||
|
||
if __name__ == "__main__": | ||
click_main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env python3 | ||
|
||
""" | ||
Set alarm viewpoint. | ||
""" | ||
|
||
import click | ||
|
||
from ...clients import ViewpointProducer | ||
from ...entities import AlarmViewpoint | ||
|
||
|
||
# pylint: disable=missing-function-docstring,no-value-for-parameter | ||
@click.command() | ||
@click.option('--file', is_flag=True, | ||
help="Imports a file of key=value pairs (one per line) where the key is viewpoint name and value is " | ||
"AlarmViewpoint JSON") | ||
@click.option('--unset', is_flag=True, help="Remove the viewpoint") | ||
@click.argument('name') | ||
@click.option('--location', '-l', help="Name of location", multiple=True) | ||
def set_viewpoint(file, unset, name, location, category, alarmclass) -> None: | ||
producer = ViewpointProducer('set_viewpoint.py') | ||
|
||
key = name | ||
|
||
if file: | ||
producer.import_records(name) | ||
else: | ||
if unset: | ||
value = None | ||
else: | ||
value = AlarmViewpoint(location, category, alarmclass) | ||
|
||
producer.send(key, value) | ||
|
||
|
||
def click_main() -> None: | ||
set_viewpoint() | ||
|
||
|
||
if __name__ == "__main__": | ||
click_main() |