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.

Files changed (78) hide show
  1. adam/batch.py +7 -7
  2. adam/commands/app/utils_app.py +1 -1
  3. adam/commands/bash/bash.py +1 -1
  4. adam/commands/bash/utils_bash.py +1 -1
  5. adam/commands/cassandra/__init__.py +0 -0
  6. adam/commands/command.py +1 -1
  7. adam/commands/commands_utils.py +8 -13
  8. adam/commands/{alter_tables.py → cql/alter_tables.py} +1 -1
  9. adam/commands/cql/completions_c.py +1 -0
  10. adam/commands/cql/utils_cql.py +14 -13
  11. adam/commands/debug/__init__.py +0 -0
  12. adam/commands/debug/debug.py +22 -0
  13. adam/commands/debug/debug_completes.py +35 -0
  14. adam/commands/debug/debug_timings.py +35 -0
  15. adam/commands/devices/device.py +1 -1
  16. adam/commands/devices/devices.py +1 -1
  17. adam/commands/download_cassandra_log.py +45 -0
  18. adam/commands/export/export_databases.py +13 -8
  19. adam/commands/export/export_sessions.py +12 -11
  20. adam/commands/export/exporter.py +140 -53
  21. adam/commands/export/import_session.py +0 -4
  22. adam/commands/export/importer.py +11 -11
  23. adam/commands/export/importer_athena.py +15 -6
  24. adam/commands/export/importer_sqlite.py +19 -8
  25. adam/commands/export/utils_export.py +37 -15
  26. adam/commands/generate_report.py +52 -0
  27. adam/commands/medusa/medusa_restore.py +0 -16
  28. adam/commands/nodetool.py +1 -1
  29. adam/commands/os/__init__.py +0 -0
  30. adam/commands/postgres/postgres_databases.py +2 -3
  31. adam/commands/postgres/postgres_ls.py +1 -1
  32. adam/commands/postgres/utils_postgres.py +2 -1
  33. adam/commands/preview_table.py +1 -1
  34. adam/commands/restart_cluster.py +47 -0
  35. adam/commands/restart_node.py +51 -0
  36. adam/commands/restart_nodes.py +47 -0
  37. adam/commands/show/show_cassandra_status.py +3 -10
  38. adam/commands/show/show_cli_commands.py +1 -1
  39. adam/commands/show/show_processes.py +1 -1
  40. adam/commands/show/show_storage.py +2 -1
  41. adam/config.py +4 -6
  42. adam/embedded_params.py +1 -1
  43. adam/repl.py +5 -3
  44. adam/repl_commands.py +23 -17
  45. adam/repl_session.py +4 -3
  46. adam/repl_state.py +6 -0
  47. adam/sql/async_executor.py +44 -0
  48. adam/sql/lark_completer.py +6 -4
  49. adam/sql/qingl.lark +1076 -0
  50. adam/sso/cred_cache.py +2 -5
  51. adam/utils.py +206 -83
  52. adam/utils_k8s/app_clusters.py +11 -4
  53. adam/utils_k8s/app_pods.py +10 -5
  54. adam/utils_k8s/cassandra_clusters.py +8 -4
  55. adam/utils_k8s/cassandra_nodes.py +14 -5
  56. adam/utils_k8s/kube_context.py +1 -4
  57. adam/{pod_exec_result.py → utils_k8s/pod_exec_result.py} +8 -2
  58. adam/utils_k8s/pods.py +83 -24
  59. adam/utils_local.py +78 -2
  60. adam/utils_repl/repl_completer.py +10 -89
  61. adam/utils_sqlite.py +3 -8
  62. adam/version.py +1 -1
  63. {kaqing-2.0.188.dist-info → kaqing-2.0.211.dist-info}/METADATA +1 -1
  64. {kaqing-2.0.188.dist-info → kaqing-2.0.211.dist-info}/RECORD +67 -65
  65. adam/commands/cat.py +0 -36
  66. adam/commands/cd.py +0 -41
  67. adam/commands/download_file.py +0 -47
  68. adam/commands/find_files.py +0 -51
  69. adam/commands/find_processes.py +0 -76
  70. adam/commands/head.py +0 -36
  71. adam/commands/logs.py +0 -37
  72. adam/commands/ls.py +0 -41
  73. adam/commands/report.py +0 -61
  74. adam/commands/restart.py +0 -60
  75. adam/commands/shell.py +0 -41
  76. {kaqing-2.0.188.dist-info → kaqing-2.0.211.dist-info}/WHEEL +0 -0
  77. {kaqing-2.0.188.dist-info → kaqing-2.0.211.dist-info}/entry_points.txt +0 -0
  78. {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'