iris-pex-embedded-python 3.2.1b2__py3-none-any.whl → 3.2.1b3__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.
Potentially problematic release.
This version of iris-pex-embedded-python might be problematic. Click here for more details.
- iop/_cli.py +159 -104
- {iris_pex_embedded_python-3.2.1b2.dist-info → iris_pex_embedded_python-3.2.1b3.dist-info}/METADATA +1 -1
- {iris_pex_embedded_python-3.2.1b2.dist-info → iris_pex_embedded_python-3.2.1b3.dist-info}/RECORD +7 -7
- {iris_pex_embedded_python-3.2.1b2.dist-info → iris_pex_embedded_python-3.2.1b3.dist-info}/LICENSE +0 -0
- {iris_pex_embedded_python-3.2.1b2.dist-info → iris_pex_embedded_python-3.2.1b3.dist-info}/WHEEL +0 -0
- {iris_pex_embedded_python-3.2.1b2.dist-info → iris_pex_embedded_python-3.2.1b3.dist-info}/entry_points.txt +0 -0
- {iris_pex_embedded_python-3.2.1b2.dist-info → iris_pex_embedded_python-3.2.1b3.dist-info}/top_level.txt +0 -0
iop/_cli.py
CHANGED
|
@@ -1,141 +1,196 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
1
2
|
import argparse
|
|
2
3
|
import json
|
|
3
4
|
import os
|
|
5
|
+
from dataclasses import dataclass
|
|
6
|
+
from enum import Enum, auto
|
|
7
|
+
import sys
|
|
8
|
+
from typing import Optional, Callable
|
|
4
9
|
from importlib.metadata import version
|
|
5
10
|
|
|
6
11
|
from iop._director import _Director
|
|
7
12
|
from iop._utils import _Utils
|
|
8
13
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
14
|
+
class CommandType(Enum):
|
|
15
|
+
DEFAULT = auto()
|
|
16
|
+
LIST = auto()
|
|
17
|
+
START = auto()
|
|
18
|
+
STOP = auto()
|
|
19
|
+
KILL = auto()
|
|
20
|
+
RESTART = auto()
|
|
21
|
+
STATUS = auto()
|
|
22
|
+
TEST = auto()
|
|
23
|
+
VERSION = auto()
|
|
24
|
+
EXPORT = auto()
|
|
25
|
+
MIGRATE = auto()
|
|
26
|
+
LOG = auto()
|
|
27
|
+
INIT = auto()
|
|
28
|
+
HELP = auto()
|
|
29
|
+
|
|
30
|
+
@dataclass
|
|
31
|
+
class CommandArgs:
|
|
32
|
+
"""Container for parsed command arguments"""
|
|
33
|
+
default: Optional[str] = None
|
|
34
|
+
list: bool = False
|
|
35
|
+
start: Optional[str] = None
|
|
36
|
+
detach: bool = False
|
|
37
|
+
stop: bool = False
|
|
38
|
+
kill: bool = False
|
|
39
|
+
restart: bool = False
|
|
40
|
+
status: bool = False
|
|
41
|
+
migrate: Optional[str] = None
|
|
42
|
+
export: Optional[str] = None
|
|
43
|
+
version: bool = False
|
|
44
|
+
log: Optional[str] = None
|
|
45
|
+
init: Optional[str] = None
|
|
46
|
+
test: Optional[str] = None
|
|
47
|
+
classname: Optional[str] = None
|
|
48
|
+
body: Optional[str] = None
|
|
49
|
+
|
|
50
|
+
class Command:
|
|
51
|
+
def __init__(self, args: CommandArgs):
|
|
52
|
+
self.args = args
|
|
53
|
+
|
|
54
|
+
def execute(self) -> None:
|
|
55
|
+
command_type = self._determine_command_type()
|
|
56
|
+
command_handlers = {
|
|
57
|
+
CommandType.DEFAULT: self._handle_default,
|
|
58
|
+
CommandType.LIST: self._handle_list,
|
|
59
|
+
CommandType.START: self._handle_start,
|
|
60
|
+
CommandType.STOP: self._handle_stop,
|
|
61
|
+
CommandType.KILL: self._handle_kill,
|
|
62
|
+
CommandType.RESTART: self._handle_restart,
|
|
63
|
+
CommandType.STATUS: self._handle_status,
|
|
64
|
+
CommandType.TEST: self._handle_test,
|
|
65
|
+
CommandType.VERSION: self._handle_version,
|
|
66
|
+
CommandType.EXPORT: self._handle_export,
|
|
67
|
+
CommandType.MIGRATE: self._handle_migrate,
|
|
68
|
+
CommandType.LOG: self._handle_log,
|
|
69
|
+
CommandType.INIT: self._handle_init,
|
|
70
|
+
CommandType.HELP: self._handle_help
|
|
71
|
+
}
|
|
72
|
+
handler = command_handlers.get(command_type)
|
|
73
|
+
if handler:
|
|
74
|
+
handler()
|
|
75
|
+
|
|
76
|
+
def _determine_command_type(self) -> CommandType:
|
|
77
|
+
if self.args.default: return CommandType.DEFAULT
|
|
78
|
+
if self.args.list: return CommandType.LIST
|
|
79
|
+
if self.args.start: return CommandType.START
|
|
80
|
+
if self.args.stop: return CommandType.STOP
|
|
81
|
+
if self.args.kill: return CommandType.KILL
|
|
82
|
+
if self.args.restart: return CommandType.RESTART
|
|
83
|
+
if self.args.status: return CommandType.STATUS
|
|
84
|
+
if self.args.test: return CommandType.TEST
|
|
85
|
+
if self.args.version: return CommandType.VERSION
|
|
86
|
+
if self.args.export: return CommandType.EXPORT
|
|
87
|
+
if self.args.migrate: return CommandType.MIGRATE
|
|
88
|
+
if self.args.log: return CommandType.LOG
|
|
89
|
+
if self.args.init: return CommandType.INIT
|
|
90
|
+
return CommandType.HELP
|
|
91
|
+
|
|
92
|
+
def _handle_default(self) -> None:
|
|
93
|
+
if self.args.default == 'not_set':
|
|
44
94
|
print(_Director.get_default_production())
|
|
45
95
|
else:
|
|
46
|
-
_Director.set_default_production(args.default)
|
|
96
|
+
_Director.set_default_production(self.args.default)
|
|
47
97
|
|
|
48
|
-
|
|
49
|
-
# display list of productions
|
|
98
|
+
def _handle_list(self) -> None:
|
|
50
99
|
dikt = _Director.list_productions()
|
|
51
100
|
print(json.dumps(dikt, indent=4))
|
|
52
101
|
|
|
53
|
-
|
|
54
|
-
production_name =
|
|
55
|
-
if args.
|
|
56
|
-
# start default production
|
|
57
|
-
production_name = _Director.get_default_production()
|
|
58
|
-
else:
|
|
59
|
-
# start production with name
|
|
60
|
-
production_name = args.start
|
|
61
|
-
if args.detach:
|
|
62
|
-
# start production in detach mode
|
|
102
|
+
def _handle_start(self) -> None:
|
|
103
|
+
production_name = self.args.start if self.args.start != 'not_set' else _Director.get_default_production()
|
|
104
|
+
if self.args.detach:
|
|
63
105
|
_Director.start_production(production_name)
|
|
64
106
|
print(f"Production {production_name} started")
|
|
65
107
|
else:
|
|
66
108
|
_Director.start_production_with_log(production_name)
|
|
67
109
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
args.init = None
|
|
72
|
-
_Utils.setup(args.start)
|
|
110
|
+
def _handle_stop(self) -> None:
|
|
111
|
+
_Director.stop_production()
|
|
112
|
+
print(f"Production {_Director.get_default_production()} stopped")
|
|
73
113
|
|
|
74
|
-
|
|
75
|
-
# kill a production
|
|
114
|
+
def _handle_kill(self) -> None:
|
|
76
115
|
_Director.shutdown_production()
|
|
77
116
|
|
|
78
|
-
|
|
79
|
-
# restart a production
|
|
117
|
+
def _handle_restart(self) -> None:
|
|
80
118
|
_Director.restart_production()
|
|
81
119
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
120
|
+
def _handle_status(self) -> None:
|
|
121
|
+
print(json.dumps(_Director.status_production(), indent=4))
|
|
122
|
+
|
|
123
|
+
def _handle_test(self) -> None:
|
|
124
|
+
test_name = None if self.args.test == 'not_set' else self.args.test
|
|
125
|
+
response = _Director.test_component(
|
|
126
|
+
test_name,
|
|
127
|
+
classname=self.args.classname if self.args.classname != 'not_set' else None,
|
|
128
|
+
body=self.args.body if self.args.body != 'not_set' else None
|
|
129
|
+
)
|
|
130
|
+
print(response)
|
|
90
131
|
|
|
91
|
-
|
|
92
|
-
# display version
|
|
132
|
+
def _handle_version(self) -> None:
|
|
93
133
|
print(version('iris-pex-embedded-python'))
|
|
94
134
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
# display default production log
|
|
99
|
-
_Director.log_production()
|
|
100
|
-
else:
|
|
101
|
-
_Director.log_production_top(args.log)
|
|
135
|
+
def _handle_export(self) -> None:
|
|
136
|
+
export_name = _Director.get_default_production() if self.args.export == 'not_set' else self.args.export
|
|
137
|
+
print(json.dumps(_Utils.export_production(export_name), indent=4))
|
|
102
138
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
139
|
+
def _handle_migrate(self) -> None:
|
|
140
|
+
migrate_path = self.args.migrate
|
|
141
|
+
if not os.path.isabs(migrate_path):
|
|
142
|
+
migrate_path = os.path.join(os.getcwd(), migrate_path)
|
|
143
|
+
_Utils.migrate(migrate_path)
|
|
107
144
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
print(
|
|
145
|
+
def _handle_log(self) -> None:
|
|
146
|
+
log_name = _Director.get_default_production() if self.args.log == 'not_set' else self.args.log
|
|
147
|
+
print(_Director.get_production_log(log_name))
|
|
111
148
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
body = None
|
|
115
|
-
if args.test == 'not_set':
|
|
116
|
-
# set arg to None
|
|
117
|
-
args.test = None
|
|
118
|
-
if args.classname:
|
|
119
|
-
classname = args.classname
|
|
120
|
-
if args.body:
|
|
121
|
-
body = args.body
|
|
122
|
-
response = _Director.test_component(args.test, classname=classname, body=body)
|
|
123
|
-
print(response)
|
|
149
|
+
def _handle_init(self) -> None:
|
|
150
|
+
_Utils.setup(None)
|
|
124
151
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
args.export=_Director.get_default_production()
|
|
152
|
+
def _handle_help(self) -> None:
|
|
153
|
+
create_parser().print_help()
|
|
154
|
+
print(f"\nDefault production: {_Director.get_default_production()}")
|
|
129
155
|
|
|
130
|
-
|
|
131
|
-
|
|
156
|
+
def create_parser() -> argparse.ArgumentParser:
|
|
157
|
+
"""Create and configure argument parser"""
|
|
158
|
+
main_parser = argparse.ArgumentParser()
|
|
159
|
+
parser = main_parser.add_mutually_exclusive_group()
|
|
160
|
+
|
|
161
|
+
# Main commands
|
|
162
|
+
parser.add_argument('-d', '--default', help='set the default production', nargs='?', const='not_set')
|
|
163
|
+
parser.add_argument('-l', '--list', help='list productions', action='store_true')
|
|
164
|
+
parser.add_argument('-s', '--start', help='start a production', nargs='?', const='not_set')
|
|
165
|
+
parser.add_argument('-S', '--stop', help='stop a production', action='store_true')
|
|
166
|
+
parser.add_argument('-k', '--kill', help='kill a production', action='store_true')
|
|
167
|
+
parser.add_argument('-r', '--restart', help='restart a production', action='store_true')
|
|
168
|
+
parser.add_argument('-x', '--status', help='status a production', action='store_true')
|
|
169
|
+
parser.add_argument('-m', '-M', '--migrate', help='migrate production and classes with settings file')
|
|
170
|
+
parser.add_argument('-e', '--export', help='export a production', nargs='?', const='not_set')
|
|
171
|
+
parser.add_argument('-v', '--version', help='display version', action='store_true')
|
|
172
|
+
parser.add_argument('-L', '--log', help='display log', nargs='?', const='not_set')
|
|
173
|
+
parser.add_argument('-i', '--init', help='init the pex module in iris', nargs='?', const='not_set')
|
|
174
|
+
parser.add_argument('-t', '--test', help='test the pex module in iris', nargs='?', const='not_set')
|
|
132
175
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
176
|
+
# Command groups
|
|
177
|
+
start = main_parser.add_argument_group('start arguments')
|
|
178
|
+
start.add_argument('-D', '--detach', help='start a production in detach mode', action='store_true')
|
|
179
|
+
|
|
180
|
+
test = main_parser.add_argument_group('test arguments')
|
|
181
|
+
test.add_argument('-C', '--classname', help='test classname', nargs='?', const='not_set')
|
|
182
|
+
test.add_argument('-B', '--body', help='test body', nargs='?', const='not_set')
|
|
183
|
+
|
|
184
|
+
return main_parser
|
|
138
185
|
|
|
186
|
+
def main(argv=None) -> None:
|
|
187
|
+
parser = create_parser()
|
|
188
|
+
args = parser.parse_args(argv)
|
|
189
|
+
cmd_args = CommandArgs(**vars(args))
|
|
190
|
+
|
|
191
|
+
command = Command(cmd_args)
|
|
192
|
+
command.execute()
|
|
193
|
+
sys.exit(0)
|
|
139
194
|
|
|
140
195
|
if __name__ == '__main__':
|
|
141
196
|
main()
|
{iris_pex_embedded_python-3.2.1b2.dist-info → iris_pex_embedded_python-3.2.1b3.dist-info}/RECORD
RENAMED
|
@@ -96,7 +96,7 @@ iop/_business_host.py,sha256=7oXdGPpVSRl8lYWd0M_6VLebnMU-kayShcvzUU0BR1k,26363
|
|
|
96
96
|
iop/_business_operation.py,sha256=Fc0bSXpbmLpt2_fCNBOh0Wh1O4ue7y85Jkv_nP6Kzv0,2901
|
|
97
97
|
iop/_business_process.py,sha256=QPb3HM2Oz7gJMbI3uFgILH5ivOiQ6NVB37P9C_gmpNQ,8465
|
|
98
98
|
iop/_business_service.py,sha256=8dYTr4z3RE0WupT7_DeDvYjyhVqZtdDj0jA52ZSKCQ0,3771
|
|
99
|
-
iop/_cli.py,sha256=
|
|
99
|
+
iop/_cli.py,sha256=TRn1yCAf3E3e3fdLprxXLeti1LSg22IjTmIHV_LaLyI,7546
|
|
100
100
|
iop/_common.py,sha256=3zX4Ua2rZuc5CBMjVTZbdUT1fv_mQTzAWdFFtDEzfn8,14050
|
|
101
101
|
iop/_director.py,sha256=snFuj4NyvNdUClbajLee5phJFrS5fZO-YVYziW1WSe8,11586
|
|
102
102
|
iop/_inbound_adapter.py,sha256=PS5ToqhrYcXq9ZdLbCBqAfVp8kCeRACm_KF66pwBO9U,1652
|
|
@@ -131,9 +131,9 @@ iop/cls/IOP/Service/WSGI.cls,sha256=VLNCXEwmHW9dBnE51uGE1nvGX6T4HjhqePT3LVhsjAE,
|
|
|
131
131
|
iop/wsgi/handlers.py,sha256=NrFLo_YbAh-x_PlWhAiWkQnUUN2Ss9HoEm63dDWCBpQ,2947
|
|
132
132
|
irisnative/_IRISNative.py,sha256=HQ4nBhc8t8_5OtxdMG-kx1aa-T1znf2I8obZOPLOPzg,665
|
|
133
133
|
irisnative/__init__.py,sha256=6YmvBLQSURsCPKaNg7LK-xpo4ipDjrlhKuwdfdNb3Kg,341
|
|
134
|
-
iris_pex_embedded_python-3.2.
|
|
135
|
-
iris_pex_embedded_python-3.2.
|
|
136
|
-
iris_pex_embedded_python-3.2.
|
|
137
|
-
iris_pex_embedded_python-3.2.
|
|
138
|
-
iris_pex_embedded_python-3.2.
|
|
139
|
-
iris_pex_embedded_python-3.2.
|
|
134
|
+
iris_pex_embedded_python-3.2.1b3.dist-info/LICENSE,sha256=rZSiBFId_sfbJ6RL0GjjPX-InNLkNS9ou7eQsikciI8,1089
|
|
135
|
+
iris_pex_embedded_python-3.2.1b3.dist-info/METADATA,sha256=6SdwtY4FY9nVc6SwKC1WWeIPwL5hkrQgOL-9LUgRdA4,4427
|
|
136
|
+
iris_pex_embedded_python-3.2.1b3.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
137
|
+
iris_pex_embedded_python-3.2.1b3.dist-info/entry_points.txt,sha256=pj-i4LSDyiSP6xpHlVjMCbg1Pik7dC3_sdGY3Yp9Vhk,38
|
|
138
|
+
iris_pex_embedded_python-3.2.1b3.dist-info/top_level.txt,sha256=VWDlX4YF4qFVRGrG3-Gs0kgREol02i8gIpsHNbhfFPw,42
|
|
139
|
+
iris_pex_embedded_python-3.2.1b3.dist-info/RECORD,,
|
{iris_pex_embedded_python-3.2.1b2.dist-info → iris_pex_embedded_python-3.2.1b3.dist-info}/LICENSE
RENAMED
|
File without changes
|
{iris_pex_embedded_python-3.2.1b2.dist-info → iris_pex_embedded_python-3.2.1b3.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|