kaqing 2.0.188__py3-none-any.whl → 2.0.211__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/batch.py +7 -7
- adam/commands/app/utils_app.py +1 -1
- adam/commands/bash/bash.py +1 -1
- adam/commands/bash/utils_bash.py +1 -1
- adam/commands/cassandra/__init__.py +0 -0
- adam/commands/command.py +1 -1
- adam/commands/commands_utils.py +8 -13
- adam/commands/{alter_tables.py → cql/alter_tables.py} +1 -1
- adam/commands/cql/completions_c.py +1 -0
- adam/commands/cql/utils_cql.py +14 -13
- adam/commands/debug/__init__.py +0 -0
- adam/commands/debug/debug.py +22 -0
- adam/commands/debug/debug_completes.py +35 -0
- adam/commands/debug/debug_timings.py +35 -0
- adam/commands/devices/device.py +1 -1
- adam/commands/devices/devices.py +1 -1
- adam/commands/download_cassandra_log.py +45 -0
- adam/commands/export/export_databases.py +13 -8
- adam/commands/export/export_sessions.py +12 -11
- adam/commands/export/exporter.py +140 -53
- adam/commands/export/import_session.py +0 -4
- adam/commands/export/importer.py +11 -11
- adam/commands/export/importer_athena.py +15 -6
- adam/commands/export/importer_sqlite.py +19 -8
- adam/commands/export/utils_export.py +37 -15
- adam/commands/generate_report.py +52 -0
- adam/commands/medusa/medusa_restore.py +0 -16
- adam/commands/nodetool.py +1 -1
- adam/commands/os/__init__.py +0 -0
- adam/commands/postgres/postgres_databases.py +2 -3
- adam/commands/postgres/postgres_ls.py +1 -1
- adam/commands/postgres/utils_postgres.py +2 -1
- adam/commands/preview_table.py +1 -1
- adam/commands/restart_cluster.py +47 -0
- adam/commands/restart_node.py +51 -0
- adam/commands/restart_nodes.py +47 -0
- adam/commands/show/show_cassandra_status.py +3 -10
- adam/commands/show/show_cli_commands.py +1 -1
- adam/commands/show/show_processes.py +1 -1
- adam/commands/show/show_storage.py +2 -1
- adam/config.py +4 -6
- adam/embedded_params.py +1 -1
- adam/repl.py +5 -3
- adam/repl_commands.py +23 -17
- adam/repl_session.py +4 -3
- adam/repl_state.py +6 -0
- adam/sql/async_executor.py +44 -0
- adam/sql/lark_completer.py +6 -4
- adam/sql/qingl.lark +1076 -0
- adam/sso/cred_cache.py +2 -5
- adam/utils.py +206 -83
- adam/utils_k8s/app_clusters.py +11 -4
- adam/utils_k8s/app_pods.py +10 -5
- adam/utils_k8s/cassandra_clusters.py +8 -4
- adam/utils_k8s/cassandra_nodes.py +14 -5
- adam/utils_k8s/kube_context.py +1 -4
- adam/{pod_exec_result.py → utils_k8s/pod_exec_result.py} +8 -2
- adam/utils_k8s/pods.py +83 -24
- adam/utils_local.py +78 -2
- adam/utils_repl/repl_completer.py +10 -89
- adam/utils_sqlite.py +3 -8
- adam/version.py +1 -1
- {kaqing-2.0.188.dist-info → kaqing-2.0.211.dist-info}/METADATA +1 -1
- {kaqing-2.0.188.dist-info → kaqing-2.0.211.dist-info}/RECORD +67 -65
- adam/commands/cat.py +0 -36
- adam/commands/cd.py +0 -41
- adam/commands/download_file.py +0 -47
- adam/commands/find_files.py +0 -51
- adam/commands/find_processes.py +0 -76
- adam/commands/head.py +0 -36
- adam/commands/logs.py +0 -37
- adam/commands/ls.py +0 -41
- adam/commands/report.py +0 -61
- adam/commands/restart.py +0 -60
- adam/commands/shell.py +0 -41
- {kaqing-2.0.188.dist-info → kaqing-2.0.211.dist-info}/WHEEL +0 -0
- {kaqing-2.0.188.dist-info → kaqing-2.0.211.dist-info}/entry_points.txt +0 -0
- {kaqing-2.0.188.dist-info → kaqing-2.0.211.dist-info}/top_level.txt +0 -0
adam/commands/report.py
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import click
|
|
2
|
-
import json
|
|
3
|
-
|
|
4
|
-
from adam.checks.check_result import CheckResult
|
|
5
|
-
from adam.checks.check_utils import run_checks
|
|
6
|
-
from adam.commands.command import Command
|
|
7
|
-
from adam.repl_state import ReplState
|
|
8
|
-
from adam.utils import log2
|
|
9
|
-
|
|
10
|
-
class Report(Command):
|
|
11
|
-
COMMAND = 'report'
|
|
12
|
-
|
|
13
|
-
# the singleton pattern
|
|
14
|
-
def __new__(cls, *args, **kwargs):
|
|
15
|
-
if not hasattr(cls, 'instance'): cls.instance = super(Report, cls).__new__(cls)
|
|
16
|
-
|
|
17
|
-
return cls.instance
|
|
18
|
-
|
|
19
|
-
def __init__(self, successor: Command=None):
|
|
20
|
-
super().__init__(successor)
|
|
21
|
-
|
|
22
|
-
def command(self):
|
|
23
|
-
return Report.COMMAND
|
|
24
|
-
|
|
25
|
-
def required(self):
|
|
26
|
-
return ReplState.NON_L
|
|
27
|
-
|
|
28
|
-
def run(self, cmd: str, state: ReplState):
|
|
29
|
-
if not(args := self.args(cmd)):
|
|
30
|
-
return super().run(cmd, state)
|
|
31
|
-
|
|
32
|
-
with self.validate(args, state) as (args, state):
|
|
33
|
-
output: dict[str, any] = {}
|
|
34
|
-
|
|
35
|
-
if state.in_repl:
|
|
36
|
-
args, show = Command.extract_options(args, ['-s', '--show'])
|
|
37
|
-
|
|
38
|
-
args, redirect = Command.extract_options(args, ['>'])
|
|
39
|
-
if not redirect or not args:
|
|
40
|
-
log2('Please specify file name: e.g. report > /tmp/report.log')
|
|
41
|
-
return 'no-report-destination'
|
|
42
|
-
|
|
43
|
-
results = run_checks(state.sts, state.namespace, state.pod, show_out=show)
|
|
44
|
-
output = CheckResult.report(results)
|
|
45
|
-
with open(args[0], "w") as json_file:
|
|
46
|
-
json.dump(output, json_file, indent=2)
|
|
47
|
-
log2(f'Report stored in {args[0]}.')
|
|
48
|
-
else:
|
|
49
|
-
args, show = Command.extract_options(args, ['-s', '--show'])
|
|
50
|
-
|
|
51
|
-
results = run_checks(state.sts, state.namespace, state.pod, show_out=show)
|
|
52
|
-
output = CheckResult.report(results)
|
|
53
|
-
click.echo(json.dumps(output, indent=2))
|
|
54
|
-
|
|
55
|
-
return output
|
|
56
|
-
|
|
57
|
-
def completion(self, state: ReplState):
|
|
58
|
-
return super().completion(state, {">": None})
|
|
59
|
-
|
|
60
|
-
def help(self, _: ReplState):
|
|
61
|
-
return f"{Report.COMMAND} > <file-name>\t generate report"
|
adam/commands/restart.py
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
from adam.commands import extract_options
|
|
2
|
-
from adam.commands.command import Command
|
|
3
|
-
from adam.utils_k8s.pods import Pods
|
|
4
|
-
from adam.utils_k8s.statefulsets import StatefulSets
|
|
5
|
-
from adam.repl_state import ReplState, RequiredState
|
|
6
|
-
from adam.utils import log2
|
|
7
|
-
|
|
8
|
-
class Restart(Command):
|
|
9
|
-
COMMAND = 'restart'
|
|
10
|
-
|
|
11
|
-
# the singleton pattern
|
|
12
|
-
def __new__(cls, *args, **kwargs):
|
|
13
|
-
if not hasattr(cls, 'instance'): cls.instance = super(Restart, cls).__new__(cls)
|
|
14
|
-
|
|
15
|
-
return cls.instance
|
|
16
|
-
|
|
17
|
-
def __init__(self, successor: Command=None):
|
|
18
|
-
super().__init__(successor)
|
|
19
|
-
|
|
20
|
-
def command(self):
|
|
21
|
-
return Restart.COMMAND
|
|
22
|
-
|
|
23
|
-
def required(self):
|
|
24
|
-
return RequiredState.CLUSTER_OR_POD
|
|
25
|
-
|
|
26
|
-
def run(self, cmd: str, state: ReplState):
|
|
27
|
-
if not(args := self.args(cmd)):
|
|
28
|
-
return super().run(cmd, state)
|
|
29
|
-
|
|
30
|
-
with self.validate(args, state) as (args, state):
|
|
31
|
-
with extract_options(args, '--force') as (args, forced):
|
|
32
|
-
if not args:
|
|
33
|
-
if state.pod:
|
|
34
|
-
log2(f'Restarting {state.pod}...')
|
|
35
|
-
Pods.delete(state.pod, state.namespace)
|
|
36
|
-
else:
|
|
37
|
-
if not forced:
|
|
38
|
-
log2('Please add --force for restarting all nodes in a cluster.')
|
|
39
|
-
return 'force-needed'
|
|
40
|
-
|
|
41
|
-
log2(f'Restarting all pods from {state.sts}...')
|
|
42
|
-
for pod_name in StatefulSets.pod_names(state.sts, state.namespace):
|
|
43
|
-
Pods.delete(pod_name, state.namespace)
|
|
44
|
-
else:
|
|
45
|
-
for arg in args:
|
|
46
|
-
Pods.delete(arg, state.namespace)
|
|
47
|
-
|
|
48
|
-
return state
|
|
49
|
-
|
|
50
|
-
def completion(self, state: ReplState):
|
|
51
|
-
if super().completion(state):
|
|
52
|
-
if state.pod:
|
|
53
|
-
return {Restart.COMMAND: None}
|
|
54
|
-
elif state.sts:
|
|
55
|
-
return {Restart.COMMAND: {p: None for p in StatefulSets.pod_names(state.sts, state.namespace)}}
|
|
56
|
-
|
|
57
|
-
return {}
|
|
58
|
-
|
|
59
|
-
def help(self, _: ReplState):
|
|
60
|
-
return f"{Restart.COMMAND} [<host-id>] [--force]\t restart the node you're in or all the nodes in the cluster"
|
adam/commands/shell.py
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
|
|
3
|
-
from adam.commands import validate_args
|
|
4
|
-
from adam.commands.command import Command
|
|
5
|
-
from adam.repl_state import ReplState
|
|
6
|
-
from adam.utils import log2
|
|
7
|
-
|
|
8
|
-
class Shell(Command):
|
|
9
|
-
COMMAND = ':sh'
|
|
10
|
-
|
|
11
|
-
# the singleton pattern
|
|
12
|
-
def __new__(cls, *args, **kwargs):
|
|
13
|
-
if not hasattr(cls, 'instance'): cls.instance = super(Shell, cls).__new__(cls)
|
|
14
|
-
|
|
15
|
-
return cls.instance
|
|
16
|
-
|
|
17
|
-
def __init__(self, successor: Command=None):
|
|
18
|
-
super().__init__(successor)
|
|
19
|
-
|
|
20
|
-
def command(self):
|
|
21
|
-
return Shell.COMMAND
|
|
22
|
-
|
|
23
|
-
def run(self, cmd: str, state: ReplState):
|
|
24
|
-
if not(args := self.args(cmd)):
|
|
25
|
-
return super().run(cmd, state)
|
|
26
|
-
|
|
27
|
-
with self.validate(args, state) as (args, _):
|
|
28
|
-
with validate_args(args, state, at_least=0) as args_str:
|
|
29
|
-
if args_str:
|
|
30
|
-
os.system(args_str)
|
|
31
|
-
log2()
|
|
32
|
-
else:
|
|
33
|
-
os.system('QING_DROPPED=true bash')
|
|
34
|
-
|
|
35
|
-
return state
|
|
36
|
-
|
|
37
|
-
def completion(self, state: ReplState):
|
|
38
|
-
return super().completion(state)
|
|
39
|
-
|
|
40
|
-
def help(self, _: ReplState):
|
|
41
|
-
return f'{Shell.COMMAND}\t drop down to shell'
|
|
File without changes
|
|
File without changes
|
|
File without changes
|