cgse-core 2024.1.0__py3-none-any.whl → 2024.1.3__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.
- {cgse_core-2024.1.0.dist-info → cgse_core-2024.1.3.dist-info}/METADATA +2 -1
- {cgse_core-2024.1.0.dist-info → cgse_core-2024.1.3.dist-info}/RECORD +5 -4
- scripts/cgse.py +179 -0
- {cgse_core-2024.1.0.dist-info → cgse_core-2024.1.3.dist-info}/WHEEL +0 -0
- {cgse_core-2024.1.0.dist-info → cgse_core-2024.1.3.dist-info}/entry_points.txt +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cgse-core
|
|
3
|
-
Version: 2024.1.
|
|
3
|
+
Version: 2024.1.3
|
|
4
|
+
Summary: Core services for the CGSE framework
|
|
4
5
|
Author-email: Rik Huygen <rik.huygen@kuleuven.be>, Sara Regibo <sara.regibo@kuleuven.be>
|
|
5
6
|
License-Expression: MIT
|
|
6
7
|
Keywords: CGSE,Common-EGSE,hardware testing,software framework
|
|
@@ -13,7 +13,8 @@ egse/storage/__main__.py,sha256=LI9fxlsFWmEd5LcWUB0xA8i7Yt6UHgnblB4G0aTi3pI,28
|
|
|
13
13
|
egse/storage/persistence.py,sha256=e4kMTszUXQxqPWBfnA_3elRHaKQmXJvKri7LwXQZXdk,18246
|
|
14
14
|
egse/storage/storage.yaml,sha256=zTRtRFbuMLBILsnlIphG6iWjI1Nav6tW7uOm4cUvFuk,2593
|
|
15
15
|
egse/storage/storage_cs.py,sha256=tF1BBDbj7sWNXAw6arSHTOnDEbi8-4tEfOhI0Jf-tnk,5506
|
|
16
|
-
|
|
17
|
-
cgse_core-2024.1.
|
|
18
|
-
cgse_core-2024.1.
|
|
19
|
-
cgse_core-2024.1.
|
|
16
|
+
scripts/cgse.py,sha256=euz9Lw3Lh0X-DZct7jywTX6JQJPiBua_zIRhsERI-64,5182
|
|
17
|
+
cgse_core-2024.1.3.dist-info/METADATA,sha256=t2ZZgGBxZ60gF66B2KWYLnnbS3MBFLgjRh8LF7OnRLk,751
|
|
18
|
+
cgse_core-2024.1.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
19
|
+
cgse_core-2024.1.3.dist-info/entry_points.txt,sha256=gcg5ck-Lh7byq1S88agmzwxFG5OJBsIDH439gaUPkHE,215
|
|
20
|
+
cgse_core-2024.1.3.dist-info/RECORD,,
|
scripts/cgse.py
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This script is as an administration script for the CGSE. The script provides commands to start, stop, and
|
|
3
|
+
get the status of the core services and any other service that is registered as a plugin.
|
|
4
|
+
|
|
5
|
+
The following main commands have been implemented:
|
|
6
|
+
|
|
7
|
+
$ cgse version
|
|
8
|
+
|
|
9
|
+
Prints the installed version of the cgse-core and any other package that is registered under
|
|
10
|
+
the entry points group 'cgse.version'.
|
|
11
|
+
|
|
12
|
+
$ cgse {start,stop} {core,service} NAME ARGS
|
|
13
|
+
|
|
14
|
+
Starts, stops the core services or any service that is registered under the entry points
|
|
15
|
+
group 'cgse.service.plugins'.
|
|
16
|
+
|
|
17
|
+
$ cgse status {core,service} NAME ARGS
|
|
18
|
+
|
|
19
|
+
Prints the status of the core services or any service that is registered under the entry
|
|
20
|
+
points group 'cgse.service.plugins'.
|
|
21
|
+
|
|
22
|
+
Other main commands can be added from external packages when they are provided as entry points with
|
|
23
|
+
the group name 'cgse.plugins'. The entry point needs to be a Click command.
|
|
24
|
+
|
|
25
|
+
"""
|
|
26
|
+
import subprocess
|
|
27
|
+
|
|
28
|
+
import click
|
|
29
|
+
import rich
|
|
30
|
+
|
|
31
|
+
from egse.plugin import entry_points
|
|
32
|
+
from egse.plugin import handle_click_plugins
|
|
33
|
+
from egse.process import SubProcess
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@handle_click_plugins(entry_points("cgse.plugins"))
|
|
37
|
+
@click.group()
|
|
38
|
+
def cli():
|
|
39
|
+
pass
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
@cli.command()
|
|
43
|
+
def version():
|
|
44
|
+
"""Prints the version of the cgse-core and other registered packages."""
|
|
45
|
+
from egse.version import get_version_installed
|
|
46
|
+
|
|
47
|
+
# if installed_version := get_version_installed("cgse-core"):
|
|
48
|
+
# rich.print(f"CGSE-CORE installed version = [bold default]{installed_version}[/]")
|
|
49
|
+
|
|
50
|
+
for ep in sorted(entry_points("cgse.version"), key=lambda x: x.name):
|
|
51
|
+
if installed_version := get_version_installed(ep.name):
|
|
52
|
+
rich.print(f"{ep.name.upper()} installed version = [bold default]{installed_version}[/]")
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
@cli.group()
|
|
56
|
+
@click.pass_context
|
|
57
|
+
def start(ctx):
|
|
58
|
+
"""Start the service"""
|
|
59
|
+
ctx.ensure_object(dict)
|
|
60
|
+
|
|
61
|
+
ctx.obj['action'] = 'start'
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
@cli.group()
|
|
65
|
+
@click.pass_context
|
|
66
|
+
def stop(ctx):
|
|
67
|
+
"""Stop the service"""
|
|
68
|
+
ctx.ensure_object(dict)
|
|
69
|
+
|
|
70
|
+
ctx.obj['action'] = 'stop'
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
@cli.group()
|
|
74
|
+
@click.pass_context
|
|
75
|
+
def status(ctx):
|
|
76
|
+
"""Provide the status of the service"""
|
|
77
|
+
ctx.ensure_object(dict)
|
|
78
|
+
|
|
79
|
+
ctx.obj['action'] = 'status'
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
@start.command()
|
|
83
|
+
@click.pass_context
|
|
84
|
+
def core(ctx):
|
|
85
|
+
print(f"executing: cgse {ctx.obj['action']} core")
|
|
86
|
+
ctx.invoke(log_cs)
|
|
87
|
+
ctx.invoke(sm_cs)
|
|
88
|
+
ctx.invoke(cm_cs)
|
|
89
|
+
ctx.invoke(pm_cs)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
@handle_click_plugins(entry_points("cgse.service.plugins"))
|
|
93
|
+
@start.group()
|
|
94
|
+
@click.pass_context
|
|
95
|
+
def service(ctx):
|
|
96
|
+
pass
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
stop.add_command(core)
|
|
100
|
+
stop.add_command(service)
|
|
101
|
+
|
|
102
|
+
status.add_command(core)
|
|
103
|
+
status.add_command(service)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
@service.command()
|
|
107
|
+
@click.pass_context
|
|
108
|
+
def log_cs(ctx):
|
|
109
|
+
print(f"executing: log_cs {ctx.obj['action']}")
|
|
110
|
+
if ctx.obj['action'] == 'start':
|
|
111
|
+
proc = SubProcess("log_cs", ["log_cs", "start"])
|
|
112
|
+
proc.execute()
|
|
113
|
+
elif ctx.obj['action'] == 'stop':
|
|
114
|
+
proc = SubProcess("log_cs", ["log_cs", "stop"])
|
|
115
|
+
proc.execute()
|
|
116
|
+
elif ctx.obj['action'] == 'status':
|
|
117
|
+
proc = SubProcess("log_cs", ["log_cs", "status"], stdout=subprocess.PIPE)
|
|
118
|
+
proc.execute()
|
|
119
|
+
output, _ = proc.communicate()
|
|
120
|
+
rich.print(output, end='')
|
|
121
|
+
else:
|
|
122
|
+
rich.print(f"[red]ERROR: Unknown action '{ctx.obj['action']}'[/]")
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
@service.command()
|
|
126
|
+
@click.pass_context
|
|
127
|
+
def sm_cs(ctx):
|
|
128
|
+
print(f"executing: sm_cs {ctx.obj['action']}")
|
|
129
|
+
if ctx.obj['action'] == 'start':
|
|
130
|
+
proc = SubProcess("sm_cs", ["sm_cs", "start"])
|
|
131
|
+
proc.execute()
|
|
132
|
+
elif ctx.obj['action'] == 'stop':
|
|
133
|
+
proc = SubProcess("sm_cs", ["sm_cs", "stop"])
|
|
134
|
+
proc.execute()
|
|
135
|
+
elif ctx.obj['action'] == 'status':
|
|
136
|
+
proc = SubProcess("sm_cs", ["sm_cs", "status"], stdout=subprocess.PIPE)
|
|
137
|
+
proc.execute()
|
|
138
|
+
output, _ = proc.communicate()
|
|
139
|
+
rich.print(output, end='')
|
|
140
|
+
else:
|
|
141
|
+
rich.print(f"[red]ERROR: Unknown action '{ctx.obj['action']}'[/]")
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
@service.command()
|
|
145
|
+
@click.pass_context
|
|
146
|
+
def cm_cs(ctx):
|
|
147
|
+
print(f"executing: cm_cs {ctx.obj['action']}")
|
|
148
|
+
if ctx.obj['action'] == 'start':
|
|
149
|
+
proc = SubProcess("cm_cs", ["cm_cs", "start"])
|
|
150
|
+
proc.execute()
|
|
151
|
+
elif ctx.obj['action'] == 'stop':
|
|
152
|
+
proc = SubProcess("cm_cs", ["cm_cs", "stop"])
|
|
153
|
+
proc.execute()
|
|
154
|
+
elif ctx.obj['action'] == 'status':
|
|
155
|
+
proc = SubProcess("cm_cs", ["cm_cs", "status"], stdout=subprocess.PIPE)
|
|
156
|
+
proc.execute()
|
|
157
|
+
output, _ = proc.communicate()
|
|
158
|
+
rich.print(output, end='')
|
|
159
|
+
else:
|
|
160
|
+
rich.print(f"[red]ERROR: Unknown action '{ctx.obj['action']}'[/]")
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
@service.command()
|
|
164
|
+
@click.pass_context
|
|
165
|
+
def pm_cs(ctx):
|
|
166
|
+
print(f"executing: pm_cs {ctx.obj['action']}")
|
|
167
|
+
if ctx.obj['action'] == 'start':
|
|
168
|
+
proc = SubProcess("pm_cs", ["pm_cs", "start"])
|
|
169
|
+
proc.execute()
|
|
170
|
+
elif ctx.obj['action'] == 'stop':
|
|
171
|
+
proc = SubProcess("pm_cs", ["pm_cs", "stop"])
|
|
172
|
+
proc.execute()
|
|
173
|
+
elif ctx.obj['action'] == 'status':
|
|
174
|
+
proc = SubProcess("pm_cs", ["pm_cs", "status"], stdout=subprocess.PIPE)
|
|
175
|
+
proc.execute()
|
|
176
|
+
output, _ = proc.communicate()
|
|
177
|
+
rich.print(output, end='')
|
|
178
|
+
else:
|
|
179
|
+
rich.print(f"[red]ERROR: Unknown action '{ctx.obj['action']}'[/]")
|
|
File without changes
|
|
File without changes
|