eva-shell 0.2.30__tar.gz → 0.2.32__tar.gz

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.
@@ -1,18 +1,26 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: eva-shell
3
- Version: 0.2.30
3
+ Version: 0.2.32
4
4
  Summary: EVA ICS v4 shell
5
5
  Home-page: https://github.com/eva-ics/eva4
6
6
  Author: Bohemia Automation / Altertech
7
7
  Author-email: div@altertech.com
8
8
  License: Apache License 2.0
9
- Platform: UNKNOWN
10
9
  Classifier: Programming Language :: Python :: 3
11
10
  Classifier: License :: OSI Approved :: MIT License
12
11
  Classifier: Topic :: Communications
13
12
  Description-Content-Type: text/markdown
14
13
  License-File: LICENSE
14
+ Requires-Dist: busrt>=0.1.0
15
+ Requires-Dist: evaics>=0.0.32
16
+ Requires-Dist: yedb[cli]>=0.2.25
17
+ Requires-Dist: argcomplete>=2.0.0
18
+ Requires-Dist: python-dateutil>=2.7.3
19
+ Requires-Dist: neotermcolor>=2.0.10
20
+ Requires-Dist: pyyaml>=6.0
21
+ Requires-Dist: pygments>=2.11.2
22
+ Requires-Dist: pytz>=2024.1
23
+ Requires-Dist: pwinput>=1.0.2
24
+ Requires-Dist: tzlocal>=5.1
15
25
 
16
26
  # EVA ICS v4 shell
17
-
18
-
@@ -1,3 +1,3 @@
1
- __version__ = '0.2.30'
1
+ __version__ = '0.2.31'
2
2
 
3
3
  DEFAULT_REPOSITORY_URL = 'https://pub.bma.ai/eva4'
@@ -1640,6 +1640,18 @@ def init_ap():
1640
1640
  action='store_true',
1641
1641
  help='create an encrypted service request')
1642
1642
 
1643
+ p = sp.add_parser('rt',
1644
+ help='Monitor services, threads and real-time parameters')
1645
+ p.add_argument('--sort',
1646
+ help='sort by column',
1647
+ choices=[
1648
+ 'point', 'svc_id', 'name', 'pid', 'state', 'cpu',
1649
+ 'cpu_usage', 'memory_usage', 'sched', 'priority'
1650
+ ])
1651
+ p.add_argument('--sort-rev',
1652
+ help='sort in reverse order',
1653
+ action='store_true')
1654
+
1643
1655
  p = sp.add_parser('edit', help='edit the configuration keys and xc files')
1644
1656
  p.add_argument(
1645
1657
  'fname',
@@ -947,18 +947,22 @@ class CLI:
947
947
  print_result(data,
948
948
  cols=[
949
949
  'name', 'svc', 'type', 'online', 'timeout',
950
- 'version', 'build'
950
+ 'ver', 'build'
951
951
  ])
952
952
  else:
953
953
  data = call_rpc('node.list', target=repl_svc)
954
+ for d in data:
955
+ if d.get('api_enabled') is False:
956
+ d['ping_interval'] = ''
957
+ d['reload_interval'] = ''
958
+ d['managed'] = ''
954
959
  print_result(data,
955
960
  cols=[
956
961
  'name', 'timeout', 'compress|n=compr',
957
- 'ping_interval|n=ping int',
958
- 'reload_interval|n=rel.int', 'static', 'enabled',
962
+ 'ping_interval|n=ping', 'reload_interval|n=rel',
963
+ 'static', 'enabled', 'api_enabled|n=api',
959
964
  'managed', 'trusted', 'online',
960
- 'link_uptime|n=link upt|f=round:0', 'version',
961
- 'build'
965
+ 'link_uptime|n=upt|f=round:0', 'ver', 'build'
962
966
  ])
963
967
 
964
968
  def node_append(self, i, repl_svc, untrusted):
@@ -2081,3 +2085,31 @@ class CLI:
2081
2085
  'trig',
2082
2086
  ]
2083
2087
  print_result(data, cols=cols)
2088
+
2089
+ def rt(self, sort=None, sort_rev=None):
2090
+ data = call_rpc('task.list', None, target='eva.svc.rtmon')
2091
+ if isinstance(data, list):
2092
+ if sort is not None:
2093
+ data.sort(key=lambda x: x[sort])
2094
+ if sort_rev:
2095
+ data.reverse()
2096
+ data = [format_rt_line(d) for d in data]
2097
+ print_result(data,
2098
+ cols=[
2099
+ 'point',
2100
+ 'svc_id',
2101
+ 'name',
2102
+ 'pid',
2103
+ 'state',
2104
+ 'cpu',
2105
+ 'cpu_usage|n=cpu%',
2106
+ 'memory_usage|n=memMB',
2107
+ 'sched',
2108
+ 'priority|n=prio',
2109
+ ])
2110
+
2111
+
2112
+ def format_rt_line(d):
2113
+ d['cpu_usage'] = f'{d["cpu_usage"]:.2f}'
2114
+ d['memory_usage'] = f'{int(d["memory_usage"] / 1024 / 1024)}'
2115
+ return d
@@ -1,4 +1,5 @@
1
1
  import sys
2
+ import signal
2
3
  import os
3
4
  from neotermcolor import colored
4
5
 
@@ -32,8 +33,7 @@ def launch():
32
33
  raise RuntimeError(
33
34
  f'EVA ICS directory not found. Consider installing EVA ICS either '
34
35
  f'in {dir_eva_default} or specifying EVA_DIR env variable. '
35
- f'For For a remote host, set EVA_BUS=HOST:PORT env variable'
36
- )
36
+ f'For For a remote host, set EVA_BUS=HOST:PORT env variable')
37
37
  common.bus_path = f'{common.dir_eva}/var/bus.ipc'
38
38
  common.bus_name = f'eva-shell.{os.getpid()}'
39
39
 
@@ -62,5 +62,19 @@ def launch():
62
62
  print()
63
63
  common.cli.version()
64
64
  common.interactive = True
65
+
66
+ def handle_signal(signum, frame):
67
+ import readline
68
+ if ap.interactive_history_file:
69
+ try:
70
+ readline.write_history_file(
71
+ os.path.expanduser(ap.interactive_history_file))
72
+ except:
73
+ pass
74
+ sys.exit(0)
75
+
76
+ signal.signal(signal.SIGTERM, handle_signal)
77
+ signal.signal(signal.SIGHUP, handle_signal)
78
+
65
79
  ap.interactive()
66
80
  print('Bye')
@@ -1,18 +1,26 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: eva-shell
3
- Version: 0.2.30
3
+ Version: 0.2.32
4
4
  Summary: EVA ICS v4 shell
5
5
  Home-page: https://github.com/eva-ics/eva4
6
6
  Author: Bohemia Automation / Altertech
7
7
  Author-email: div@altertech.com
8
8
  License: Apache License 2.0
9
- Platform: UNKNOWN
10
9
  Classifier: Programming Language :: Python :: 3
11
10
  Classifier: License :: OSI Approved :: MIT License
12
11
  Classifier: Topic :: Communications
13
12
  Description-Content-Type: text/markdown
14
13
  License-File: LICENSE
14
+ Requires-Dist: busrt>=0.1.0
15
+ Requires-Dist: evaics>=0.0.32
16
+ Requires-Dist: yedb[cli]>=0.2.25
17
+ Requires-Dist: argcomplete>=2.0.0
18
+ Requires-Dist: python-dateutil>=2.7.3
19
+ Requires-Dist: neotermcolor>=2.0.10
20
+ Requires-Dist: pyyaml>=6.0
21
+ Requires-Dist: pygments>=2.11.2
22
+ Requires-Dist: pytz>=2024.1
23
+ Requires-Dist: pwinput>=1.0.2
24
+ Requires-Dist: tzlocal>=5.1
15
25
 
16
26
  # EVA ICS v4 shell
17
-
18
-
@@ -1,4 +1,4 @@
1
- __version__ = '0.2.30'
1
+ __version__ = '0.2.32'
2
2
 
3
3
  import setuptools
4
4
 
File without changes
File without changes
File without changes
@@ -1,11 +1,11 @@
1
- argcomplete>=2.0.0
2
1
  busrt>=0.1.0
3
2
  evaics>=0.0.32
3
+ yedb[cli]>=0.2.25
4
+ argcomplete>=2.0.0
5
+ python-dateutil>=2.7.3
4
6
  neotermcolor>=2.0.10
5
- pwinput>=1.0.2
7
+ pyyaml>=6.0
6
8
  pygments>=2.11.2
7
- python-dateutil>=2.7.3
8
9
  pytz>=2024.1
9
- pyyaml>=6.0
10
+ pwinput>=1.0.2
10
11
  tzlocal>=5.1
11
- yedb[cli]>=0.2.25
File without changes