yamcs-cli 1.4.15__py3-none-any.whl → 1.4.16__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- yamcs/cli/alarms.py +108 -17
- yamcs/cli/dbshell.py +6 -3
- yamcs/cli/events.py +1 -1
- yamcs/cli/parameters.py +1 -1
- {yamcs_cli-1.4.15.dist-info → yamcs_cli-1.4.16.dist-info}/METADATA +2 -1
- {yamcs_cli-1.4.15.dist-info → yamcs_cli-1.4.16.dist-info}/RECORD +10 -10
- {yamcs_cli-1.4.15.dist-info → yamcs_cli-1.4.16.dist-info}/WHEEL +0 -0
- {yamcs_cli-1.4.15.dist-info → yamcs_cli-1.4.16.dist-info}/entry_points.txt +0 -0
- {yamcs_cli-1.4.15.dist-info → yamcs_cli-1.4.16.dist-info}/licenses/LICENSE +0 -0
- {yamcs_cli-1.4.15.dist-info → yamcs_cli-1.4.16.dist-info}/top_level.txt +0 -0
yamcs/cli/alarms.py
CHANGED
|
@@ -1,12 +1,39 @@
|
|
|
1
|
+
import binascii
|
|
1
2
|
from itertools import islice
|
|
2
3
|
from typing import Any, List
|
|
3
4
|
|
|
4
|
-
from yamcs.client import YamcsClient
|
|
5
|
+
from yamcs.client import EventAlarm, ParameterAlarm, YamcsClient
|
|
5
6
|
|
|
6
7
|
from yamcs.cli import utils
|
|
7
8
|
from yamcs.cli.completers import ProcessorCompleter
|
|
8
9
|
|
|
9
10
|
|
|
11
|
+
def format_parameter_trip_value(alarm: ParameterAlarm):
|
|
12
|
+
# Complicated condition to workaround a seen use case
|
|
13
|
+
# where the alarm table contains no trigger value
|
|
14
|
+
# (which should really not occur)
|
|
15
|
+
if alarm._proto.parameterDetail.HasField("triggerValue"):
|
|
16
|
+
val = alarm.trigger_value.eng_value
|
|
17
|
+
if isinstance(val, bool):
|
|
18
|
+
return str(val).lower()
|
|
19
|
+
elif isinstance(val, (bytes, bytearray)):
|
|
20
|
+
return str(binascii.hexlify(val), "ascii")
|
|
21
|
+
else:
|
|
22
|
+
return str(alarm.trigger_value.eng_value)
|
|
23
|
+
else:
|
|
24
|
+
return None
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def format_event_trip_value(alarm: EventAlarm):
|
|
28
|
+
# Complicated condition to workaround a seen use case
|
|
29
|
+
# where the alarm table contains no trigger value
|
|
30
|
+
# (which should really not occur)
|
|
31
|
+
if alarm._proto.eventDetail.HasField("triggerEvent"):
|
|
32
|
+
return alarm.trigger_event.message
|
|
33
|
+
else:
|
|
34
|
+
return None
|
|
35
|
+
|
|
36
|
+
|
|
10
37
|
class AlarmsCommand(utils.Command):
|
|
11
38
|
def __init__(self, parent):
|
|
12
39
|
super(AlarmsCommand, self).__init__(parent, "alarms", "Manage alarms")
|
|
@@ -114,15 +141,43 @@ class AlarmsCommand(utils.Command):
|
|
|
114
141
|
instance = opts.require_instance()
|
|
115
142
|
processor = client.get_processor(instance, args.processor)
|
|
116
143
|
|
|
117
|
-
rows: List[List[Any]] = [
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
144
|
+
rows: List[List[Any]] = [
|
|
145
|
+
[
|
|
146
|
+
"TIME",
|
|
147
|
+
"TYPE",
|
|
148
|
+
"SUBJECT",
|
|
149
|
+
"SEQNO",
|
|
150
|
+
"SEVERITY",
|
|
151
|
+
"TRIP VALUE",
|
|
152
|
+
"SAMPLE COUNT",
|
|
153
|
+
"VIOLATION COUNT",
|
|
124
154
|
]
|
|
125
|
-
|
|
155
|
+
]
|
|
156
|
+
for alarm in processor.list_alarms():
|
|
157
|
+
if isinstance(alarm, ParameterAlarm):
|
|
158
|
+
row = [
|
|
159
|
+
alarm.trigger_time,
|
|
160
|
+
"PARAMETER",
|
|
161
|
+
alarm.name,
|
|
162
|
+
alarm.sequence_number,
|
|
163
|
+
alarm.severity,
|
|
164
|
+
format_parameter_trip_value(alarm),
|
|
165
|
+
alarm.count,
|
|
166
|
+
alarm.violation_count,
|
|
167
|
+
]
|
|
168
|
+
rows.append(row)
|
|
169
|
+
elif isinstance(alarm, EventAlarm):
|
|
170
|
+
row = [
|
|
171
|
+
alarm.trigger_time,
|
|
172
|
+
"EVENT",
|
|
173
|
+
alarm.name,
|
|
174
|
+
alarm.sequence_number,
|
|
175
|
+
alarm.severity,
|
|
176
|
+
format_event_trip_value(alarm),
|
|
177
|
+
alarm.count,
|
|
178
|
+
alarm.violation_count,
|
|
179
|
+
]
|
|
180
|
+
rows.append(row)
|
|
126
181
|
utils.print_table(rows)
|
|
127
182
|
|
|
128
183
|
def log(self, args):
|
|
@@ -151,15 +206,51 @@ class AlarmsCommand(utils.Command):
|
|
|
151
206
|
if most_recent_only:
|
|
152
207
|
iterator = reversed(list(islice(iterator, 0, int(args.lines))))
|
|
153
208
|
|
|
154
|
-
rows: List[List[Any]] = [
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
209
|
+
rows: List[List[Any]] = [
|
|
210
|
+
[
|
|
211
|
+
"TIME",
|
|
212
|
+
"TYPE",
|
|
213
|
+
"SUBJECT",
|
|
214
|
+
"SEQNO",
|
|
215
|
+
"SEVERITY",
|
|
216
|
+
"TRIP VALUE",
|
|
217
|
+
"SAMPLE COUNT",
|
|
218
|
+
"VIOLATION COUNT",
|
|
161
219
|
]
|
|
162
|
-
|
|
220
|
+
]
|
|
221
|
+
for alarm in iterator:
|
|
222
|
+
|
|
223
|
+
# Avoid defaulting to WATCH severity if severity is not set.
|
|
224
|
+
# It 'should' always be set, however it has been seen missing
|
|
225
|
+
# for unknown reason.
|
|
226
|
+
severity = alarm.severity if alarm._proto.HasField("severity") else None
|
|
227
|
+
|
|
228
|
+
if isinstance(alarm, ParameterAlarm):
|
|
229
|
+
trip_value = format_parameter_trip_value(alarm)
|
|
230
|
+
row = [
|
|
231
|
+
alarm.trigger_time,
|
|
232
|
+
"PARAMETER",
|
|
233
|
+
alarm.name,
|
|
234
|
+
alarm.sequence_number,
|
|
235
|
+
"-" if severity is None else severity,
|
|
236
|
+
"-" if trip_value is None else trip_value,
|
|
237
|
+
alarm.count,
|
|
238
|
+
alarm.violation_count,
|
|
239
|
+
]
|
|
240
|
+
rows.append(row)
|
|
241
|
+
elif isinstance(alarm, EventAlarm):
|
|
242
|
+
trip_value = format_event_trip_value(alarm)
|
|
243
|
+
row = [
|
|
244
|
+
alarm.trigger_time,
|
|
245
|
+
"EVENT",
|
|
246
|
+
alarm.name,
|
|
247
|
+
alarm.sequence_number,
|
|
248
|
+
"-" if severity is None else severity,
|
|
249
|
+
"-" if trip_value is None else trip_value,
|
|
250
|
+
alarm.count,
|
|
251
|
+
alarm.violation_count,
|
|
252
|
+
]
|
|
253
|
+
rows.append(row)
|
|
163
254
|
utils.print_table(rows)
|
|
164
255
|
|
|
165
256
|
def acknowledge(self, args):
|
yamcs/cli/dbshell.py
CHANGED
|
@@ -44,9 +44,11 @@ class DbShellOptions:
|
|
|
44
44
|
self.column_names = not args.skip_column_names
|
|
45
45
|
self.binary_as_hex = not args.batch or args.binary_as_hex
|
|
46
46
|
self.histfile = os.path.join(utils.CONFIG_DIR, "history")
|
|
47
|
+
self.exit_on_error = False
|
|
47
48
|
|
|
48
49
|
if args.batch or args.command:
|
|
49
50
|
self.histfile = None
|
|
51
|
+
self.exit_on_error = True
|
|
50
52
|
|
|
51
53
|
|
|
52
54
|
class DbShellCommand(utils.Command):
|
|
@@ -250,7 +252,7 @@ class DbShell(cmd.Cmd):
|
|
|
250
252
|
print()
|
|
251
253
|
|
|
252
254
|
def emptyline(self):
|
|
253
|
-
|
|
255
|
+
return False # Override default behaviour of repeating the last command
|
|
254
256
|
|
|
255
257
|
def do_delimiter(self, args):
|
|
256
258
|
"""(\\d) Set statement delimiter."""
|
|
@@ -301,8 +303,9 @@ class DbShell(cmd.Cmd):
|
|
|
301
303
|
results = archive.execute_sql(statement)
|
|
302
304
|
self.paginate(results)
|
|
303
305
|
except YamcsError as e:
|
|
304
|
-
eprint(e)
|
|
305
|
-
|
|
306
|
+
eprint("\n".join("*** " + line for line in str(e).splitlines()))
|
|
307
|
+
if self.opts.exit_on_error:
|
|
308
|
+
sys.exit(1)
|
|
306
309
|
|
|
307
310
|
def run_command(self, command):
|
|
308
311
|
if command == "\\":
|
yamcs/cli/events.py
CHANGED
|
@@ -20,7 +20,7 @@ class EventsCommand(utils.Command):
|
|
|
20
20
|
"-m", "--message", metavar="MESSAGE", type=str, help="event message"
|
|
21
21
|
)
|
|
22
22
|
subparser.add_argument(
|
|
23
|
-
"--date", metavar="DATE", type=str, help="
|
|
23
|
+
"--date", metavar="DATE", type=str, help="Set an explicit event time"
|
|
24
24
|
)
|
|
25
25
|
subparser.add_argument(
|
|
26
26
|
"--sequence-number",
|
yamcs/cli/parameters.py
CHANGED
|
@@ -50,7 +50,7 @@ class ParametersCommand(utils.Command):
|
|
|
50
50
|
"--processor", type=str, help="name of the processor", default="realtime"
|
|
51
51
|
).completer = ProcessorCompleter
|
|
52
52
|
subparser.add_argument(
|
|
53
|
-
"--date", metavar="DATE", type=str, help="
|
|
53
|
+
"--date", metavar="DATE", type=str, help="Set an explicit generation time"
|
|
54
54
|
)
|
|
55
55
|
subparser.add_argument(
|
|
56
56
|
"parameter", metavar="PARAMETER", type=str, help="name of the parameter"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: yamcs-cli
|
|
3
|
-
Version: 1.4.
|
|
3
|
+
Version: 1.4.16
|
|
4
4
|
Summary: Yamcs Command-Line Tools
|
|
5
5
|
Home-page: https://github.com/yamcs/yamcs-cli
|
|
6
6
|
Author: Space Applications Services
|
|
@@ -20,6 +20,7 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
20
20
|
Classifier: Programming Language :: Python :: 3.11
|
|
21
21
|
Classifier: Programming Language :: Python :: 3.12
|
|
22
22
|
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
23
24
|
Classifier: Operating System :: OS Independent
|
|
24
25
|
Requires-Python: >=3.8
|
|
25
26
|
Description-Content-Type: text/markdown
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
yamcs/cli/__main__.py,sha256=GiDQy_LTHUdc6sNoWNDw90jS8qCjPCWr2Aq5hPDS3_E,4356
|
|
2
|
-
yamcs/cli/alarms.py,sha256=
|
|
2
|
+
yamcs/cli/alarms.py,sha256=Y9rw5nJqRcS-_DqRr8SIBwCuo9xb2QkjUOhS99K0Im0,10342
|
|
3
3
|
yamcs/cli/algorithms.py,sha256=Oqw0tiIv_mmK7smPYIdI00uUfM2KxHMbrySGi8Ywlcc,1622
|
|
4
4
|
yamcs/cli/bash_completion.sh,sha256=sQOPhbykD68uMYkcWudqJNJKuSQh2Blzozt2kkawRo4,1032
|
|
5
5
|
yamcs/cli/commands.py,sha256=ANOyAIeMDhJkk7hNyYAkwqjWDfFIpKpfR-fLkSxmEj0,6465
|
|
6
6
|
yamcs/cli/completers.py,sha256=tteufAU2XeS2rATY8jQ5L4fxlUtbPq1Lj2NSxZvQgU4,4445
|
|
7
7
|
yamcs/cli/config.py,sha256=WeuE6rfRSGt7f5nuD2tJmH_gXl5RSPlLRvufnWj4IGM,2996
|
|
8
8
|
yamcs/cli/containers.py,sha256=vjFoqeAd8Qzw-jp0XxO_HVi2852OEUz3mmtdrBAVqHE,1621
|
|
9
|
-
yamcs/cli/dbshell.py,sha256=
|
|
10
|
-
yamcs/cli/events.py,sha256=
|
|
9
|
+
yamcs/cli/dbshell.py,sha256=v8-CNT3dht48cttDJRcm4PZxrxW123cRznUOQFBH_vw,16899
|
|
10
|
+
yamcs/cli/events.py,sha256=jKLSUlO6W34kytyXDeiZMjQA8q98MTrFZ0p9XzaxgvY,5620
|
|
11
11
|
yamcs/cli/exceptions.py,sha256=0RcpLLR_jubALmuSlZ1DQ0KUcfKadOl-1VRPi0LxHSw,238
|
|
12
12
|
yamcs/cli/instances.py,sha256=RBfHQUGZB4hU_MGdhPmZgzO_WkA2Sj54KpxT7BSyLeQ,2119
|
|
13
13
|
yamcs/cli/links.py,sha256=RmdeYLqC1agtORso2T8MUcgp3f-zJKIfeb0UsupsXzc,3330
|
|
@@ -15,7 +15,7 @@ yamcs/cli/login.py,sha256=VAIE--YGiCTwf8D79L3dHKKtTlmdSFcgkUcR37CwVzY,4969
|
|
|
15
15
|
yamcs/cli/logout.py,sha256=XgIdxuAUHQ5VbPP6sZwN88cAvWQEm7GBPfvYj6vn9Rg,562
|
|
16
16
|
yamcs/cli/packets.py,sha256=am8CZxJWpqsWtA3wqSBuD3xck8uv0dYkAYfdwnfimOM,4860
|
|
17
17
|
yamcs/cli/parameter_archive.py,sha256=KWdrtHXygGJNPhbAyHK5itxBAl1YqAwgQnkoDsd_5c4,3999
|
|
18
|
-
yamcs/cli/parameters.py,sha256=
|
|
18
|
+
yamcs/cli/parameters.py,sha256=nalEjz0hSM1lfa8cGYg_fx-NgV2r17vaOP2WG806BVo,6020
|
|
19
19
|
yamcs/cli/processors.py,sha256=9BJlQywmq6x_ea3tWT66dB2wBry9divqWhG3VWKM6Nw,1988
|
|
20
20
|
yamcs/cli/rocksdb.py,sha256=28VjE9ldHUrGCxMeNNOn8FhnvdRJbiMlKjnjErgrl1k,1947
|
|
21
21
|
yamcs/cli/services.py,sha256=4sE7vOB977EmNfA4X9YJSyi3bSmhfqOj3cScGYGR4Lc,2171
|
|
@@ -31,9 +31,9 @@ yamcs/cli/protobuf/replication_pb2.py,sha256=0YzH8bVPi2DNmHcgxyv9m_XuhYnH83U0O6k
|
|
|
31
31
|
yamcs/cli/protobuf/security_pb2.py,sha256=SbVHS7ghG_JDbZ_35p8GwVnV-3HuwNOGAWRVhFoWbPE,21569
|
|
32
32
|
yamcs/cli/protobuf/tablespace_pb2.py,sha256=DLYPDKOgLm1xeZAT5F7WMLaGQJM_npeYfpZAFMSM6OU,37008
|
|
33
33
|
yamcs/cli/protobuf/timeline_pb2.py,sha256=JUl7sGOYMS8IP6h0hCOCrQz8BaBtvxjf6lY7cpDYcfg,5004
|
|
34
|
-
yamcs_cli-1.4.
|
|
35
|
-
yamcs_cli-1.4.
|
|
36
|
-
yamcs_cli-1.4.
|
|
37
|
-
yamcs_cli-1.4.
|
|
38
|
-
yamcs_cli-1.4.
|
|
39
|
-
yamcs_cli-1.4.
|
|
34
|
+
yamcs_cli-1.4.16.dist-info/licenses/LICENSE,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
|
|
35
|
+
yamcs_cli-1.4.16.dist-info/METADATA,sha256=GeIgyg7eFjG9MjQYBLwvJOaEfOYP44oCkTXeqHKjV8Q,1746
|
|
36
|
+
yamcs_cli-1.4.16.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
37
|
+
yamcs_cli-1.4.16.dist-info/entry_points.txt,sha256=M6Juk3MbdDMR1v3htR2aHEebitGHW-E3ujHmYQLwEas,50
|
|
38
|
+
yamcs_cli-1.4.16.dist-info/top_level.txt,sha256=EsFTpWxnHBl6f_5Wf-CrENGPSoY7xP4T-JpgBMwsk8Q,6
|
|
39
|
+
yamcs_cli-1.4.16.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|