kaqing 2.0.200__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 +1 -1
- adam/commands/app/utils_app.py +1 -1
- adam/commands/cql/completions_c.py +1 -1
- adam/commands/cql/utils_cql.py +14 -13
- adam/commands/devices/device.py +1 -1
- adam/commands/download_cassandra_log.py +2 -2
- 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/postgres/postgres_databases.py +1 -1
- adam/commands/postgres/postgres_ls.py +1 -1
- adam/commands/postgres/utils_postgres.py +2 -1
- adam/commands/show/show_cassandra_status.py +3 -10
- adam/commands/show/show_processes.py +1 -1
- adam/commands/show/show_storage.py +2 -1
- adam/embedded_params.py +1 -1
- adam/repl_commands.py +13 -12
- adam/sso/cred_cache.py +2 -5
- adam/utils.py +122 -71
- adam/utils_k8s/app_clusters.py +10 -3
- adam/utils_k8s/app_pods.py +9 -3
- adam/utils_k8s/cassandra_clusters.py +4 -4
- adam/utils_k8s/cassandra_nodes.py +13 -7
- adam/{pod_exec_result.py → utils_k8s/pod_exec_result.py} +8 -2
- adam/utils_k8s/pods.py +34 -29
- adam/utils_local.py +78 -2
- adam/utils_repl/repl_completer.py +6 -2
- adam/utils_sqlite.py +3 -8
- adam/version.py +1 -1
- {kaqing-2.0.200.dist-info → kaqing-2.0.211.dist-info}/METADATA +1 -1
- {kaqing-2.0.200.dist-info → kaqing-2.0.211.dist-info}/RECORD +39 -61
- adam/commands/alter_tables.py +0 -66
- adam/commands/cassandra/download_cassandra_log.py +0 -45
- adam/commands/cassandra/nodetool.py +0 -64
- adam/commands/cassandra/nodetool_commands.py +0 -120
- adam/commands/cassandra/restart_cluster.py +0 -47
- adam/commands/cassandra/restart_node.py +0 -51
- adam/commands/cassandra/restart_nodes.py +0 -47
- adam/commands/cassandra/rollout.py +0 -88
- 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/ls.py +0 -41
- adam/commands/os/cat.py +0 -36
- adam/commands/os/download_file.py +0 -47
- adam/commands/os/find_files.py +0 -51
- adam/commands/os/find_processes.py +0 -76
- adam/commands/os/head.py +0 -36
- adam/commands/os/shell.py +0 -41
- adam/commands/shell.py +0 -41
- {kaqing-2.0.200.dist-info → kaqing-2.0.211.dist-info}/WHEEL +0 -0
- {kaqing-2.0.200.dist-info → kaqing-2.0.211.dist-info}/entry_points.txt +0 -0
- {kaqing-2.0.200.dist-info → kaqing-2.0.211.dist-info}/top_level.txt +0 -0
adam/commands/os/cat.py
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
from adam.commands import validate_args
|
|
2
|
-
from adam.commands.command import Command
|
|
3
|
-
from adam.commands.devices.devices import Devices
|
|
4
|
-
from adam.repl_state import ReplState, RequiredState
|
|
5
|
-
|
|
6
|
-
class Cat(Command):
|
|
7
|
-
COMMAND = 'cat'
|
|
8
|
-
|
|
9
|
-
# the singleton pattern
|
|
10
|
-
def __new__(cls, *args, **kwargs):
|
|
11
|
-
if not hasattr(cls, 'instance'): cls.instance = super(Cat, cls).__new__(cls)
|
|
12
|
-
|
|
13
|
-
return cls.instance
|
|
14
|
-
|
|
15
|
-
def __init__(self, successor: Command=None):
|
|
16
|
-
super().__init__(successor)
|
|
17
|
-
|
|
18
|
-
def command(self):
|
|
19
|
-
return Cat.COMMAND
|
|
20
|
-
|
|
21
|
-
def required(self):
|
|
22
|
-
return [RequiredState.CLUSTER_OR_POD, RequiredState.APP_APP, ReplState.P]
|
|
23
|
-
|
|
24
|
-
def run(self, cmd: str, state: ReplState):
|
|
25
|
-
if not(args := self.args(cmd)):
|
|
26
|
-
return super().run(cmd, state)
|
|
27
|
-
|
|
28
|
-
with self.validate(args, state) as (args, state):
|
|
29
|
-
with validate_args(args, state, name='file'):
|
|
30
|
-
return Devices.of(state).bash(state, state, cmd.split(' '))
|
|
31
|
-
|
|
32
|
-
def completion(self, state: ReplState):
|
|
33
|
-
return super().completion(state, lambda: {f: None for f in Devices.of(state).files(state)}, pods=Devices.of(state).pods(state, '-'), auto='jit')
|
|
34
|
-
|
|
35
|
-
def help(self, _: ReplState):
|
|
36
|
-
return f'{Cat.COMMAND} file [&]\t run cat command on the pod'
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
from adam.commands import validate_args
|
|
2
|
-
from adam.commands.command import Command
|
|
3
|
-
from adam.commands.devices.devices import Devices
|
|
4
|
-
from adam.config import Config
|
|
5
|
-
from adam.pod_exec_result import PodExecResult
|
|
6
|
-
from adam.repl_state import ReplState, RequiredState
|
|
7
|
-
from adam.utils import log2
|
|
8
|
-
from adam.utils_k8s.pods import Pods
|
|
9
|
-
|
|
10
|
-
class DownloadFile(Command):
|
|
11
|
-
COMMAND = 'download file'
|
|
12
|
-
|
|
13
|
-
# the singleton pattern
|
|
14
|
-
def __new__(cls, *args, **kwargs):
|
|
15
|
-
if not hasattr(cls, 'instance'): cls.instance = super(DownloadFile, 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 DownloadFile.COMMAND
|
|
24
|
-
|
|
25
|
-
def required(self):
|
|
26
|
-
return [RequiredState.CLUSTER_OR_POD, RequiredState.APP_APP, ReplState.P]
|
|
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
|
-
with validate_args(args, state, name='file'):
|
|
34
|
-
to_file = Pods.download_file(Devices.of(state).pod(state),
|
|
35
|
-
Devices.of(state).default_container(state),
|
|
36
|
-
state.namespace,
|
|
37
|
-
args[0],
|
|
38
|
-
args[1] if len(args) > 1 else None)
|
|
39
|
-
log2(f'Downloaded to {to_file}.')
|
|
40
|
-
|
|
41
|
-
return state
|
|
42
|
-
|
|
43
|
-
def completion(self, state: ReplState):
|
|
44
|
-
return super().completion(state, lambda: {f: None for f in Devices.of(state).files(state)}, pods=Devices.of(state).pods(state, '-'), auto='jit')
|
|
45
|
-
|
|
46
|
-
def help(self, _: ReplState):
|
|
47
|
-
return f'{DownloadFile.COMMAND} from-file [to-file]\t download file from pod'
|
adam/commands/os/find_files.py
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
|
|
3
|
-
from adam.commands.command import Command
|
|
4
|
-
from adam.repl_state import ReplState
|
|
5
|
-
from adam.utils import log2
|
|
6
|
-
from adam.utils_local import local_tmp_dir
|
|
7
|
-
|
|
8
|
-
class FindLocalFiles(Command):
|
|
9
|
-
COMMAND = 'find local'
|
|
10
|
-
|
|
11
|
-
# the singleton pattern
|
|
12
|
-
def __new__(cls, *args, **kwargs):
|
|
13
|
-
if not hasattr(cls, 'instance'): cls.instance = super(FindLocalFiles, 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 FindLocalFiles.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, state):
|
|
28
|
-
cmd = 'find'
|
|
29
|
-
|
|
30
|
-
if not args:
|
|
31
|
-
cmd = f'find {local_tmp_dir()}'
|
|
32
|
-
elif len(args) == 1:
|
|
33
|
-
cmd = f"find {local_tmp_dir()} -name '{args[0]}'"
|
|
34
|
-
else:
|
|
35
|
-
new_args = [f"'{arg}'" if '*' in arg else arg for arg in args]
|
|
36
|
-
cmd = 'find ' + ' '.join(new_args)
|
|
37
|
-
|
|
38
|
-
log2(cmd)
|
|
39
|
-
os.system(cmd)
|
|
40
|
-
|
|
41
|
-
return state
|
|
42
|
-
|
|
43
|
-
def completion(self, state: ReplState):
|
|
44
|
-
return super().completion(state, {
|
|
45
|
-
'*.csv': None,
|
|
46
|
-
'*.db': None,
|
|
47
|
-
'*': None
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
def help(self, _: ReplState):
|
|
51
|
-
return f'{FindLocalFiles.COMMAND} [linux-find-arguments]\t find files from local machine'
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
from adam.commands import extract_options, validate_args
|
|
2
|
-
from adam.commands.command import Command
|
|
3
|
-
from adam.commands.devices.devices import Devices
|
|
4
|
-
from adam.commands.export.utils_export import state_with_pod
|
|
5
|
-
from adam.repl_state import ReplState, RequiredState
|
|
6
|
-
from adam.utils import log2, tabulize
|
|
7
|
-
|
|
8
|
-
class FindProcesses(Command):
|
|
9
|
-
COMMAND = 'find processes'
|
|
10
|
-
|
|
11
|
-
# the singleton pattern
|
|
12
|
-
def __new__(cls, *args, **kwargs):
|
|
13
|
-
if not hasattr(cls, 'instance'): cls.instance = super(FindProcesses, 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 FindProcesses.COMMAND
|
|
22
|
-
|
|
23
|
-
def required(self):
|
|
24
|
-
return [RequiredState.CLUSTER_OR_POD, RequiredState.APP_APP, ReplState.P]
|
|
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, '-kill') as (args, kill):
|
|
32
|
-
with validate_args(args, state, name='words to look for'):
|
|
33
|
-
arg = ' | '.join([f'grep {a}' for a in args])
|
|
34
|
-
awk = "awk '{ print $1, $2, $8, $NF }'"
|
|
35
|
-
rs = Devices.of(state).bash(state, state, f"ps -ef | grep -v grep | {arg} | {awk}".split(' '))
|
|
36
|
-
|
|
37
|
-
lines: list[list[str]] = []
|
|
38
|
-
for r in rs:
|
|
39
|
-
for l in r.stdout.split('\n'):
|
|
40
|
-
l = l.strip(' \t\r\n')
|
|
41
|
-
if not l:
|
|
42
|
-
continue
|
|
43
|
-
|
|
44
|
-
tokens = [r.pod] + l.split(' ')
|
|
45
|
-
lines.append(tokens)
|
|
46
|
-
|
|
47
|
-
pids = []
|
|
48
|
-
for l in lines:
|
|
49
|
-
pids.append(f'{l[2]}@{l[0]}')
|
|
50
|
-
|
|
51
|
-
tabulize(lines, lambda l: '\t'.join(l), header = 'POD\tUSER\tPID\tCMD\tLAST_ARG', separator='\t')
|
|
52
|
-
log2()
|
|
53
|
-
log2(f'PIDS with {",".join(args)}: {",".join(pids)}')
|
|
54
|
-
|
|
55
|
-
if kill:
|
|
56
|
-
log2()
|
|
57
|
-
for pidp in pids:
|
|
58
|
-
pid_n_pod = pidp.split('@')
|
|
59
|
-
pid = pid_n_pod[0]
|
|
60
|
-
if len(pid_n_pod) < 2:
|
|
61
|
-
continue
|
|
62
|
-
|
|
63
|
-
pod = pid_n_pod[1]
|
|
64
|
-
|
|
65
|
-
log2(f'@{pod} bash kill -9 {pid}')
|
|
66
|
-
|
|
67
|
-
with state_with_pod(state, pod) as state1:
|
|
68
|
-
Devices.of(state).bash(state, state1, ['kill', '-9', pid])
|
|
69
|
-
|
|
70
|
-
return rs
|
|
71
|
-
|
|
72
|
-
def completion(self, state: ReplState):
|
|
73
|
-
return super().completion(state)
|
|
74
|
-
|
|
75
|
-
def help(self, _: ReplState):
|
|
76
|
-
return f'{FindProcesses.COMMAND} word... [-kill]\t find processes with words'
|
adam/commands/os/head.py
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
from adam.commands import validate_args
|
|
2
|
-
from adam.commands.command import Command
|
|
3
|
-
from adam.commands.devices.devices import Devices
|
|
4
|
-
from adam.repl_state import ReplState, RequiredState
|
|
5
|
-
|
|
6
|
-
class Head(Command):
|
|
7
|
-
COMMAND = 'head'
|
|
8
|
-
|
|
9
|
-
# the singleton pattern
|
|
10
|
-
def __new__(cls, *args, **kwargs):
|
|
11
|
-
if not hasattr(cls, 'instance'): cls.instance = super(Head, cls).__new__(cls)
|
|
12
|
-
|
|
13
|
-
return cls.instance
|
|
14
|
-
|
|
15
|
-
def __init__(self, successor: Command=None):
|
|
16
|
-
super().__init__(successor)
|
|
17
|
-
|
|
18
|
-
def command(self):
|
|
19
|
-
return Head.COMMAND
|
|
20
|
-
|
|
21
|
-
def required(self):
|
|
22
|
-
return [RequiredState.CLUSTER_OR_POD, RequiredState.APP_APP, ReplState.P]
|
|
23
|
-
|
|
24
|
-
def run(self, cmd: str, state: ReplState):
|
|
25
|
-
if not(args := self.args(cmd)):
|
|
26
|
-
return super().run(cmd, state)
|
|
27
|
-
|
|
28
|
-
with self.validate(args, state) as (args, state):
|
|
29
|
-
with validate_args(args, state, name='file'):
|
|
30
|
-
return Devices.of(state).bash(state, state, cmd.split(' '))
|
|
31
|
-
|
|
32
|
-
def completion(self, state: ReplState):
|
|
33
|
-
return super().completion(state, lambda: {f: None for f in Devices.of(state).files(state)}, pods=Devices.of(state).pods(state, '-'), auto='jit')
|
|
34
|
-
|
|
35
|
-
def help(self, _: ReplState):
|
|
36
|
-
return f'{Head.COMMAND} file [&]\t run head command on the pod'
|
adam/commands/os/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'
|
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
|