kaqing 2.0.101__py3-none-any.whl → 2.0.102__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 kaqing might be problematic. Click here for more details.
- adam/commands/cql/cql_utils.py +5 -8
- adam/commands/cql/cqlsh.py +5 -2
- adam/repl.py +2 -2
- adam/repl_commands.py +4 -2
- adam/utils_k8s/cassandra_clusters.py +4 -4
- adam/utils_k8s/cassandra_nodes.py +2 -2
- adam/utils_k8s/pods.py +10 -4
- adam/utils_k8s/statefulsets.py +2 -2
- adam/version.py +1 -1
- {kaqing-2.0.101.dist-info → kaqing-2.0.102.dist-info}/METADATA +1 -1
- {kaqing-2.0.101.dist-info → kaqing-2.0.102.dist-info}/RECORD +14 -14
- {kaqing-2.0.101.dist-info → kaqing-2.0.102.dist-info}/WHEEL +0 -0
- {kaqing-2.0.101.dist-info → kaqing-2.0.102.dist-info}/entry_points.txt +0 -0
- {kaqing-2.0.101.dist-info → kaqing-2.0.102.dist-info}/top_level.txt +0 -0
adam/commands/cql/cql_utils.py
CHANGED
|
@@ -27,28 +27,25 @@ def table_names(state: ReplState):
|
|
|
27
27
|
return [f'{k}.{t}' for k, ts in tables(state, on_any=True).items() for t in ts]
|
|
28
28
|
|
|
29
29
|
@functools.lru_cache()
|
|
30
|
-
def tables(state: ReplState, on_any=False):
|
|
30
|
+
def tables(state: ReplState, on_any=False) -> dict[str, list[str]]:
|
|
31
31
|
r: list[PodExecResult] = run_cql(state, 'describe tables', show_out=False, on_any=on_any)
|
|
32
32
|
if not r:
|
|
33
33
|
log2('No pod is available')
|
|
34
|
-
return
|
|
34
|
+
return {}
|
|
35
35
|
|
|
36
36
|
return parse_cql_desc_tables(r.stdout if state.pod else r[0].stdout)
|
|
37
37
|
|
|
38
|
-
def run_cql(state: ReplState, cql: str, opts: list = [], show_out = False, use_single_quotes = False, on_any = False):
|
|
38
|
+
def run_cql(state: ReplState, cql: str, opts: list = [], show_out = False, use_single_quotes = False, on_any = False, background=False):
|
|
39
39
|
user, pw = Secrets.get_user_pass(state.sts if state.sts else state.pod, state.namespace, secret_path='cql.secret')
|
|
40
40
|
if use_single_quotes:
|
|
41
41
|
command = f"cqlsh -u {user} -p {pw} {' '.join(opts)} -e '{cql}'"
|
|
42
42
|
else:
|
|
43
43
|
command = f'cqlsh -u {user} -p {pw} {" ".join(opts)} -e "{cql}"'
|
|
44
44
|
|
|
45
|
-
if not on_any:
|
|
46
|
-
command = f'{command} &'
|
|
47
|
-
|
|
48
45
|
if state.pod:
|
|
49
|
-
return CassandraNodes.exec(state.pod, state.namespace, command, show_out=show_out)
|
|
46
|
+
return CassandraNodes.exec(state.pod, state.namespace, command, show_out=show_out, background=background)
|
|
50
47
|
else:
|
|
51
|
-
return CassandraClusters.exec(state.sts, state.namespace, command, show_out=show_out, action='cql', on_any=on_any)
|
|
48
|
+
return CassandraClusters.exec(state.sts, state.namespace, command, show_out=show_out, action='cql', on_any=on_any, background=background)
|
|
52
49
|
|
|
53
50
|
def parse_cql_desc_tables(out: str):
|
|
54
51
|
# Keyspace data_endpoint_auth
|
adam/commands/cql/cqlsh.py
CHANGED
|
@@ -33,11 +33,14 @@ class Cqlsh(Command):
|
|
|
33
33
|
if not self.validate_state(state):
|
|
34
34
|
return state
|
|
35
35
|
|
|
36
|
+
background = False
|
|
36
37
|
opts = []
|
|
37
38
|
cqls = []
|
|
38
|
-
for arg in args:
|
|
39
|
+
for index, arg in enumerate(args):
|
|
39
40
|
if arg.startswith('--'):
|
|
40
41
|
opts.append(arg)
|
|
42
|
+
elif index == len(args) -1 and arg == '&':
|
|
43
|
+
background = True
|
|
41
44
|
elif arg != '-e':
|
|
42
45
|
cqls.append(arg)
|
|
43
46
|
if not cqls:
|
|
@@ -51,7 +54,7 @@ class Cqlsh(Command):
|
|
|
51
54
|
return 'no-cql'
|
|
52
55
|
|
|
53
56
|
cql = ' '.join(cqls)
|
|
54
|
-
return run_cql(state, cql, opts, show_out=True)
|
|
57
|
+
return run_cql(state, cql, opts, show_out=True, background=background)
|
|
55
58
|
|
|
56
59
|
def completion(self, state: ReplState) -> dict[str, any]:
|
|
57
60
|
if state.device != state.C:
|
adam/repl.py
CHANGED
|
@@ -141,7 +141,7 @@ def enter_repl(state: ReplState):
|
|
|
141
141
|
cmd = f'bash {cmd}'
|
|
142
142
|
|
|
143
143
|
if cmd and cmd.strip(' ') and not cmds.run(cmd, state):
|
|
144
|
-
try_device_default_action(state, cmds, cmd_list)
|
|
144
|
+
try_device_default_action(state, cmds, cmd_list, cmd)
|
|
145
145
|
# not served by any command in the chain; try SQL query or C3 action
|
|
146
146
|
# c_sql_tried = False
|
|
147
147
|
# if state.device == ReplState.P:
|
|
@@ -186,7 +186,7 @@ def enter_repl(state: ReplState):
|
|
|
186
186
|
if cmd and (state.device != ReplState.L or Config().get('audit.log-audit-queries', False)):
|
|
187
187
|
executor.submit(audit_log, cmd, state)
|
|
188
188
|
|
|
189
|
-
def try_device_default_action(state: ReplState, cmds: Command, cmd_list: list[Command]):
|
|
189
|
+
def try_device_default_action(state: ReplState, cmds: Command, cmd_list: list[Command], cmd: str):
|
|
190
190
|
c_sql_tried = False
|
|
191
191
|
if state.device == ReplState.P:
|
|
192
192
|
pg = PostgresSession(state.namespace, state.pg_path)
|
adam/repl_commands.py
CHANGED
|
@@ -58,7 +58,8 @@ class ReplCommands:
|
|
|
58
58
|
cmds: list[Command] = ReplCommands.navigation() + ReplCommands.cassandra_check() + ReplCommands.cassandra_ops() + \
|
|
59
59
|
ReplCommands.tools() + ReplCommands.app() + ReplCommands.exit()
|
|
60
60
|
|
|
61
|
-
intermediate_cmds: list[Command] = [App(), Reaper(), Repair(), Deploy(),
|
|
61
|
+
intermediate_cmds: list[Command] = [App(), Reaper(), Repair(), Deploy(), Show(), Undeploy()]
|
|
62
|
+
# intermediate_cmds: list[Command] = [App(), Reaper(), Repair(), Deploy(), Describe(), Show(), Undeploy()]
|
|
62
63
|
ic = [c.command() for c in intermediate_cmds]
|
|
63
64
|
# 1. dedup commands
|
|
64
65
|
deduped = []
|
|
@@ -79,7 +80,8 @@ class ReplCommands:
|
|
|
79
80
|
GetParam(), SetParam(), ShowParams(), ShowKubectlCommands(), ShowLogin(), ShowAdam(), ShowHost()]
|
|
80
81
|
|
|
81
82
|
def cassandra_check() -> list[Command]:
|
|
82
|
-
return Describe.cmd_list() + [ShowCassandraStatus(),
|
|
83
|
+
# return Describe.cmd_list() + [ShowCassandraStatus(),
|
|
84
|
+
return [ShowCassandraStatus(),
|
|
83
85
|
ShowCassandraVersion(), ShowRepairs(), ShowStorage(), ShowProcesses(), Check(), Issues(), NodeTool(), Report()]
|
|
84
86
|
|
|
85
87
|
def cassandra_ops() -> list[Command]:
|
|
@@ -14,12 +14,12 @@ T = TypeVar('T')
|
|
|
14
14
|
# utility collection on cassandra clusters; methods are all static
|
|
15
15
|
class CassandraClusters:
|
|
16
16
|
def exec(statefulset: str, namespace: str, command: str, action: str = 'action',
|
|
17
|
-
max_workers=0, show_out=True, on_any = False, shell = '/bin/sh') -> list[PodExecResult]:
|
|
17
|
+
max_workers=0, show_out=True, on_any = False, shell = '/bin/sh', background = False) -> list[PodExecResult]:
|
|
18
18
|
def body(executor: ThreadPoolExecutor, pod: str, namespace: str, show_out: bool):
|
|
19
19
|
if executor:
|
|
20
|
-
return executor.submit(CassandraNodes.exec, pod, namespace, command, False, False, shell)
|
|
20
|
+
return executor.submit(CassandraNodes.exec, pod, namespace, command, False, False, shell, background)
|
|
21
21
|
|
|
22
|
-
return CassandraNodes.exec(pod, namespace, command, show_out=show_out)
|
|
22
|
+
return CassandraNodes.exec(pod, namespace, command, show_out=show_out, background=background)
|
|
23
23
|
|
|
24
24
|
def post(result, show_out: bool):
|
|
25
25
|
if KubeContext.show_out(show_out):
|
|
@@ -31,4 +31,4 @@ class CassandraClusters:
|
|
|
31
31
|
|
|
32
32
|
return result
|
|
33
33
|
|
|
34
|
-
return StatefulSets.on_cluster(statefulset, namespace, body, post=post, action=action, max_workers=max_workers, show_out=show_out, on_any=on_any)
|
|
34
|
+
return StatefulSets.on_cluster(statefulset, namespace, body, post=post, action=action, max_workers=max_workers, show_out=show_out, on_any=on_any, background=background)
|
|
@@ -6,8 +6,8 @@ from adam.repl_session import ReplSession
|
|
|
6
6
|
|
|
7
7
|
# utility collection on cassandra nodes; methods are all static
|
|
8
8
|
class CassandraNodes:
|
|
9
|
-
def exec(pod_name: str, namespace: str, command: str, show_out = True, throw_err = False, shell = '/bin/sh') -> PodExecResult:
|
|
10
|
-
r = Pods.exec(pod_name, "cassandra", namespace, command, show_out = show_out, throw_err = throw_err, shell = shell)
|
|
9
|
+
def exec(pod_name: str, namespace: str, command: str, show_out = True, throw_err = False, shell = '/bin/sh', background = False) -> PodExecResult:
|
|
10
|
+
r = Pods.exec(pod_name, "cassandra", namespace, command, show_out = show_out, throw_err = throw_err, shell = shell, background = background)
|
|
11
11
|
|
|
12
12
|
if r and Config().get('repl.history.push-cat-remote-log-file', True):
|
|
13
13
|
if r.log_file:
|
adam/utils_k8s/pods.py
CHANGED
|
@@ -43,7 +43,11 @@ class Pods:
|
|
|
43
43
|
namespace: str,
|
|
44
44
|
body: Callable[[ThreadPoolExecutor, str, str, bool], T],
|
|
45
45
|
post: Callable[[T], T] = None,
|
|
46
|
-
action: str = 'action',
|
|
46
|
+
action: str = 'action',
|
|
47
|
+
max_workers=0,
|
|
48
|
+
show_out=True,
|
|
49
|
+
on_any = False,
|
|
50
|
+
background = False) -> list[T]:
|
|
47
51
|
show_out = KubeContext.show_out(show_out)
|
|
48
52
|
|
|
49
53
|
if not max_workers:
|
|
@@ -94,7 +98,9 @@ class Pods:
|
|
|
94
98
|
|
|
95
99
|
return results
|
|
96
100
|
|
|
97
|
-
def exec(pod_name: str, container: str, namespace: str, command: str,
|
|
101
|
+
def exec(pod_name: str, container: str, namespace: str, command: str,
|
|
102
|
+
show_out = True, throw_err = False, shell = '/bin/sh',
|
|
103
|
+
background = False,
|
|
98
104
|
interaction: Callable[[any, list[str]], any] = None):
|
|
99
105
|
if _TEST_POD_EXEC_OUTS:
|
|
100
106
|
return _TEST_POD_EXEC_OUTS
|
|
@@ -106,8 +112,8 @@ class Pods:
|
|
|
106
112
|
log_file = None
|
|
107
113
|
tty = True
|
|
108
114
|
exec_command = [shell, '-c', command]
|
|
109
|
-
if command.endswith(' &'):
|
|
110
|
-
# should be false for starting a
|
|
115
|
+
if background or command.endswith(' &'):
|
|
116
|
+
# should be false for starting a background process
|
|
111
117
|
tty = False
|
|
112
118
|
|
|
113
119
|
if Config().get('repl.background-process.auto-nohup', True):
|
adam/utils_k8s/statefulsets.py
CHANGED
|
@@ -62,10 +62,10 @@ class StatefulSets:
|
|
|
62
62
|
namespace: str,
|
|
63
63
|
body: Callable[[ThreadPoolExecutor, str, str, bool], T],
|
|
64
64
|
post: Callable[[T], T] = None,
|
|
65
|
-
action: str = 'action', max_workers=0, show_out=True, on_any = False) -> list[T]:
|
|
65
|
+
action: str = 'action', max_workers=0, show_out=True, on_any = False, background = False) -> list[T]:
|
|
66
66
|
pods = StatefulSets.pod_names(statefulset, namespace)
|
|
67
67
|
|
|
68
|
-
return Pods.on_pods(pods, namespace, body, post=post, action=action, max_workers=max_workers, show_out=show_out, on_any=on_any)
|
|
68
|
+
return Pods.on_pods(pods, namespace, body, post=post, action=action, max_workers=max_workers, show_out=show_out, on_any=on_any, background=background)
|
|
69
69
|
|
|
70
70
|
@functools.lru_cache()
|
|
71
71
|
def pod_names(ss: str, ns: str):
|
adam/version.py
CHANGED
|
@@ -9,14 +9,14 @@ adam/embedded_apps.py,sha256=lKPx63mKzJbNmwz0rgL4gF76M9fDGxraYTtNAIGnZ_s,419
|
|
|
9
9
|
adam/embedded_params.py,sha256=7HLYppBdHk_HdV0afngj-NTu83Q3FbiT44WJySRUBHk,5009
|
|
10
10
|
adam/log.py,sha256=gg5DK52wLPc9cjykeh0WFHyAk1qI3HEpGaAK8W2dzXY,1146
|
|
11
11
|
adam/pod_exec_result.py,sha256=WBXJSvxzXp9TfsfXeHtIvgz8GvfMAAcH5M03GISLqzw,1046
|
|
12
|
-
adam/repl.py,sha256=
|
|
13
|
-
adam/repl_commands.py,sha256=
|
|
12
|
+
adam/repl.py,sha256=O6-1CxDwxczl7AS9-5lexY4OH0N6INVlfvqNRMgK94Q,10858
|
|
13
|
+
adam/repl_commands.py,sha256=Vpc-y3S0TNFJ-q9cg9JlXrCN89wYaN96reHLiNAPiPg,4835
|
|
14
14
|
adam/repl_session.py,sha256=uIogcvWBh7wd8QQ-p_JgLsyJ8YJgINw5vOd6JIsd7Vo,472
|
|
15
15
|
adam/repl_state.py,sha256=VlQpV19Sg5vL8H3o8lQxZB5atyuTuN5iEQsd6xpSkQQ,8774
|
|
16
16
|
adam/utils.py,sha256=sbsNZP3qGJtb6fXCa4dDXHry5ay9ev583cCZIQzy07s,7382
|
|
17
17
|
adam/utils_athena.py,sha256=6OYed6dQ4dg2GZ3MPYt7fArWweEwyMpx2SUky0lb8Pc,3314
|
|
18
18
|
adam/utils_net.py,sha256=65fhBnWMCkhGtyHqz95qcHaCo35q-WX1RBkkXG8dKpI,416
|
|
19
|
-
adam/version.py,sha256=
|
|
19
|
+
adam/version.py,sha256=qusgCASINNdlBwMjrMDDxXyFjk_rbY5C64ux1-leykQ,140
|
|
20
20
|
adam/checks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
21
21
|
adam/checks/check.py,sha256=Qopr3huYcMu2bzQgb99dEUYjFzkjKHRI76S6KA9b9Rk,702
|
|
22
22
|
adam/checks/check_context.py,sha256=FEHkQ32jY1EDopQ2uYWqy9v7aEEX1orLpJWhopwAlh4,402
|
|
@@ -85,8 +85,8 @@ adam/commands/audit/audit_table_completer.py,sha256=6xqPhAicic_-04dckaMn1v6a8utL
|
|
|
85
85
|
adam/commands/cql/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
86
86
|
adam/commands/cql/cql_completions.py,sha256=PxARSyVnNHNfpC-6-8sfgChdUI5KGxs64U5EMgU6lvQ,616
|
|
87
87
|
adam/commands/cql/cql_table_completer.py,sha256=Tth6lmZ1eCEbJeAVZojTx594ttQeeVf-OjhhkSLyRnI,312
|
|
88
|
-
adam/commands/cql/cql_utils.py,sha256=
|
|
89
|
-
adam/commands/cql/cqlsh.py,sha256=
|
|
88
|
+
adam/commands/cql/cql_utils.py,sha256=FdsKdCPpr7P6Ior3C74kGNE6FgbAbdfJ6Ew3W_13hwE,4093
|
|
89
|
+
adam/commands/cql/cqlsh.py,sha256=ZQ8Skdqyl13X7AOyCKfpS0ivD_3xVEBbgktXxOo_82o,2818
|
|
90
90
|
adam/commands/deploy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
91
91
|
adam/commands/deploy/code_start.py,sha256=-iH8HThTNM83IfBxT_LqTByuHVatV9d-Il4OYOfrwLI,1370
|
|
92
92
|
adam/commands/deploy/code_stop.py,sha256=ch7ZMgosvTHsGaIcDwQY5XYh_5HYrUjBkZFOI-d2gOU,1696
|
|
@@ -171,22 +171,22 @@ adam/sso/idp_login.py,sha256=QAtCUeDTVWliJy40RK_oac8Vgybr13xH8wzeBoxPaa8,1754
|
|
|
171
171
|
adam/sso/idp_session.py,sha256=9BUHNRf70u4rVKrVY1HKPOEmOviXvkjam8WJxmXSKIM,1735
|
|
172
172
|
adam/sso/sso_config.py,sha256=5N8WZgIJQBtHUy585XLRWKjpU87_v6QluyNK9E27D5s,2459
|
|
173
173
|
adam/utils_k8s/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
174
|
-
adam/utils_k8s/cassandra_clusters.py,sha256=
|
|
175
|
-
adam/utils_k8s/cassandra_nodes.py,sha256=
|
|
174
|
+
adam/utils_k8s/cassandra_clusters.py,sha256=G-gFLjQHCnwfCkpz0mwUoPj6OS6LbB4Fr3boB2iKz_c,1478
|
|
175
|
+
adam/utils_k8s/cassandra_nodes.py,sha256=GeI8w-CwplC6O4UCGDcWs7b7l70Y0gxk-p7CuTY5qE0,1485
|
|
176
176
|
adam/utils_k8s/config_maps.py,sha256=vc9A-2D1-1mindCMFL1wuysDOXb0RCl4BdjC6B6usXI,1194
|
|
177
177
|
adam/utils_k8s/custom_resources.py,sha256=cIeaZRQET2DelTGU2f5QsMckh7TddPpWZDFeNK3txeQ,7647
|
|
178
178
|
adam/utils_k8s/deployment.py,sha256=SLhnMm5GMXwEldj2OupSFBUsvNjynwSNrv5tIDvLMrc,2921
|
|
179
179
|
adam/utils_k8s/ingresses.py,sha256=ul3Z6fDGc_Cxcn-ExP0vXhZatoShCUZFtpwtCY4Qx7o,3460
|
|
180
180
|
adam/utils_k8s/jobs.py,sha256=gJpBpjcZ_FlkWJJIlavbHC_bqdmvv-GMVo8UZVh0sOQ,2610
|
|
181
181
|
adam/utils_k8s/kube_context.py,sha256=xJF_72vUJu-X9MpIYzOIfnj7KEWU7a_sLBR-H3994Y0,3311
|
|
182
|
-
adam/utils_k8s/pods.py,sha256=
|
|
182
|
+
adam/utils_k8s/pods.py,sha256=25XzE95hxUMlKLw-LMszKDC-oH_5po5-KiRzcq-0RJQ,11464
|
|
183
183
|
adam/utils_k8s/secrets.py,sha256=tBSKLknHlwdwyTzqvtJ2YS-y9x4gvW57Ug9sOkK_U50,2413
|
|
184
184
|
adam/utils_k8s/service_accounts.py,sha256=v2oQSqCrNvt2uRnKlNwR3fjtpUG7oF5nqgzEB7NnT-U,6349
|
|
185
185
|
adam/utils_k8s/services.py,sha256=EOJJGACVbbRvu5T3rMKqIJqgYic1_MSJ17EA0TJ6UOk,3156
|
|
186
|
-
adam/utils_k8s/statefulsets.py,sha256=
|
|
186
|
+
adam/utils_k8s/statefulsets.py,sha256=0J_cYRqH96PCcq3tdsRrs4Q4ewv5dT_FMBR0HGAJ3d8,4710
|
|
187
187
|
adam/utils_k8s/volumes.py,sha256=RIBmlOSWM3V3QVXLCFT0owVOyh4rGG1ETp521a-6ndo,1137
|
|
188
|
-
kaqing-2.0.
|
|
189
|
-
kaqing-2.0.
|
|
190
|
-
kaqing-2.0.
|
|
191
|
-
kaqing-2.0.
|
|
192
|
-
kaqing-2.0.
|
|
188
|
+
kaqing-2.0.102.dist-info/METADATA,sha256=YGkAA-w6ZHzGCzTgvvkN602wei_1Zqr1oOl_iGEkR7Q,133
|
|
189
|
+
kaqing-2.0.102.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
|
190
|
+
kaqing-2.0.102.dist-info/entry_points.txt,sha256=SkzhuQJUWsXOzHeZ5TgQ2c3_g53UGK23zzJU_JTZOZI,39
|
|
191
|
+
kaqing-2.0.102.dist-info/top_level.txt,sha256=8_2PZkwBb-xDcnc8a2rAbQeJhXKXskc7zTP7pSPa1fw,5
|
|
192
|
+
kaqing-2.0.102.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|