kaqing 2.0.214__py3-none-any.whl → 2.0.227__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/checks/compactionstats.py +2 -1
- adam/checks/cpu.py +2 -1
- adam/checks/disk.py +6 -5
- adam/checks/gossip.py +2 -1
- adam/checks/memory.py +2 -1
- adam/checks/status.py +2 -1
- adam/commands/app/app.py +2 -2
- adam/commands/app/app_ping.py +2 -2
- adam/commands/app/login.py +2 -2
- adam/commands/app/show_app_actions.py +2 -2
- adam/commands/app/show_app_id.py +2 -2
- adam/commands/app/show_app_queues.py +2 -2
- adam/commands/app/show_login.py +2 -2
- adam/commands/audit/audit.py +3 -5
- adam/commands/audit/audit_repair_tables.py +2 -2
- adam/commands/audit/audit_run.py +2 -2
- adam/commands/audit/show_last10.py +2 -2
- adam/commands/audit/show_slow10.py +2 -2
- adam/commands/audit/show_top10.py +2 -2
- adam/commands/bash/bash.py +2 -2
- adam/commands/cassandra/download_cassandra_log.py +2 -2
- adam/commands/cassandra/restart_cluster.py +2 -2
- adam/commands/cassandra/restart_node.py +2 -2
- adam/commands/cassandra/restart_nodes.py +2 -2
- adam/commands/cassandra/rollout.py +2 -2
- adam/commands/cassandra/show_cassandra_repairs.py +2 -2
- adam/commands/cassandra/show_cassandra_status.py +2 -2
- adam/commands/cassandra/show_cassandra_version.py +2 -2
- adam/commands/cassandra/show_processes.py +6 -6
- adam/commands/cassandra/show_storage.py +2 -2
- adam/commands/cassandra/watch.py +2 -2
- adam/commands/cli/clipboard_copy.py +2 -2
- adam/commands/cli/show_cli_commands.py +3 -3
- adam/commands/code.py +2 -2
- adam/commands/command.py +32 -5
- adam/commands/config/param_get.py +2 -2
- adam/commands/config/param_set.py +2 -2
- adam/commands/config/show_params.py +2 -2
- adam/commands/cql/alter_tables.py +2 -2
- adam/commands/cql/cqlsh.py +2 -2
- adam/commands/cql/utils_cql.py +13 -3
- adam/commands/debug/debug_completes.py +2 -2
- adam/commands/debug/debug_timings.py +2 -2
- adam/commands/debug/show_offloaded_completes.py +2 -2
- adam/commands/deploy/code_start.py +2 -2
- adam/commands/deploy/code_stop.py +2 -2
- adam/commands/deploy/deploy_frontend.py +2 -2
- adam/commands/deploy/deploy_pg_agent.py +2 -2
- adam/commands/deploy/deploy_pod.py +2 -2
- adam/commands/deploy/undeploy_frontend.py +2 -2
- adam/commands/deploy/undeploy_pg_agent.py +2 -2
- adam/commands/deploy/undeploy_pod.py +2 -2
- adam/commands/devices/device.py +7 -7
- adam/commands/devices/device_app.py +6 -6
- adam/commands/devices/device_auit_log.py +2 -2
- adam/commands/devices/device_cass.py +6 -6
- adam/commands/devices/device_export.py +2 -2
- adam/commands/devices/device_postgres.py +6 -6
- adam/commands/diag/check.py +2 -2
- adam/commands/diag/generate_report.py +2 -2
- adam/commands/diag/issues.py +3 -2
- adam/commands/exit.py +2 -2
- adam/commands/export/clean_up_all_export_sessions.py +2 -2
- adam/commands/export/clean_up_export_sessions.py +2 -2
- adam/commands/export/download_export_session.py +4 -5
- adam/commands/export/drop_export_database.py +2 -2
- adam/commands/export/drop_export_databases.py +2 -2
- adam/commands/export/export.py +3 -3
- adam/commands/export/export_databases.py +3 -0
- adam/commands/export/export_select.py +2 -2
- adam/commands/export/export_sessions.py +10 -9
- adam/commands/export/export_use.py +3 -3
- adam/commands/export/export_x_select.py +2 -2
- adam/commands/export/exporter.py +11 -11
- adam/commands/export/import_files.py +3 -7
- adam/commands/export/import_session.py +2 -2
- adam/commands/export/importer.py +6 -7
- adam/commands/export/show_column_counts.py +2 -3
- adam/commands/export/show_export_databases.py +3 -4
- adam/commands/export/show_export_session.py +4 -4
- adam/commands/export/show_export_sessions.py +3 -3
- adam/commands/export/utils_export.py +25 -33
- adam/commands/fs/cat.py +2 -2
- adam/commands/fs/cat_local.py +2 -2
- adam/commands/fs/cd.py +2 -2
- adam/commands/fs/download_file.py +2 -2
- adam/commands/fs/find_files.py +3 -3
- adam/commands/fs/find_processes.py +12 -20
- adam/commands/fs/head.py +4 -4
- adam/commands/fs/head_local.py +46 -0
- adam/commands/fs/ls.py +2 -2
- adam/commands/fs/ls_local.py +2 -2
- adam/commands/fs/pwd.py +2 -2
- adam/commands/fs/rm.py +2 -2
- adam/commands/fs/rm_downloads.py +2 -2
- adam/commands/fs/rm_logs.py +13 -7
- adam/commands/fs/rm_logs_local.py +38 -0
- adam/commands/fs/shell.py +2 -2
- adam/commands/fs/show_adam.py +2 -2
- adam/commands/fs/show_host.py +2 -2
- adam/commands/fs/show_last_results.py +39 -0
- adam/commands/fs/tail.py +36 -0
- adam/commands/fs/tail_local.py +46 -0
- adam/commands/fs/utils_fs.py +192 -0
- adam/commands/help.py +2 -2
- adam/commands/kubectl.py +2 -2
- adam/commands/medusa/medusa_backup.py +2 -2
- adam/commands/medusa/medusa_restore.py +2 -2
- adam/commands/medusa/medusa_show_backupjobs.py +2 -2
- adam/commands/medusa/medusa_show_restorejobs.py +2 -2
- adam/commands/nodetool/nodetool.py +30 -7
- adam/commands/nodetool/utils_nodetool.py +44 -0
- adam/commands/postgres/postgres.py +3 -6
- adam/commands/postgres/postgres_ls.py +2 -2
- adam/commands/postgres/postgres_preview.py +2 -2
- adam/commands/preview_table.py +2 -3
- adam/commands/reaper/reaper_forward.py +2 -2
- adam/commands/reaper/reaper_forward_stop.py +2 -2
- adam/commands/reaper/reaper_restart.py +2 -2
- adam/commands/reaper/reaper_run_abort.py +2 -2
- adam/commands/reaper/reaper_runs.py +14 -12
- adam/commands/reaper/reaper_runs_abort.py +2 -2
- adam/commands/reaper/reaper_schedule_activate.py +2 -2
- adam/commands/reaper/reaper_schedule_start.py +2 -2
- adam/commands/reaper/reaper_schedule_stop.py +2 -2
- adam/commands/reaper/reaper_schedules.py +2 -2
- adam/commands/reaper/reaper_status.py +2 -2
- adam/commands/reaper/utils_reaper.py +31 -5
- adam/commands/repair/repair_log.py +2 -2
- adam/commands/repair/repair_run.py +2 -2
- adam/commands/repair/repair_scan.py +2 -2
- adam/commands/repair/repair_stop.py +2 -2
- adam/embedded_params.py +1 -1
- adam/repl.py +2 -1
- adam/repl_commands.py +25 -10
- adam/repl_session.py +10 -3
- adam/sql/qingl.lark +58 -59
- adam/utils.py +48 -8
- adam/utils_async_job.py +73 -0
- adam/utils_k8s/cassandra_clusters.py +15 -7
- adam/utils_k8s/cassandra_nodes.py +5 -4
- adam/utils_k8s/pods.py +152 -51
- adam/version.py +1 -1
- {kaqing-2.0.214.dist-info → kaqing-2.0.227.dist-info}/METADATA +1 -1
- kaqing-2.0.227.dist-info/RECORD +280 -0
- kaqing-2.0.214.dist-info/RECORD +0 -272
- {kaqing-2.0.214.dist-info → kaqing-2.0.227.dist-info}/WHEEL +0 -0
- {kaqing-2.0.214.dist-info → kaqing-2.0.227.dist-info}/entry_points.txt +0 -0
- {kaqing-2.0.214.dist-info → kaqing-2.0.227.dist-info}/top_level.txt +0 -0
adam/checks/compactionstats.py
CHANGED
|
@@ -5,6 +5,7 @@ from adam.checks.check_context import CheckContext
|
|
|
5
5
|
from adam.checks.check_result import CheckResult
|
|
6
6
|
from adam.checks.issue import Issue
|
|
7
7
|
from adam.config import Config
|
|
8
|
+
from adam.utils import Color
|
|
8
9
|
from adam.utils_k8s.cassandra_nodes import CassandraNodes
|
|
9
10
|
|
|
10
11
|
class CompactionStats(Check):
|
|
@@ -15,7 +16,7 @@ class CompactionStats(Check):
|
|
|
15
16
|
issues: list[Issue] = []
|
|
16
17
|
|
|
17
18
|
try:
|
|
18
|
-
result = CassandraNodes.exec(ctx.pod, ctx.namespace, f"nodetool -u {ctx.user} -pw {ctx.pw} compactionstats", show_out=ctx.show_output)
|
|
19
|
+
result = CassandraNodes.exec(ctx.pod, ctx.namespace, f"nodetool -u {ctx.user} -pw {ctx.pw} compactionstats", show_out=ctx.show_output, text_color=Color.gray)
|
|
19
20
|
compactions = parse_nodetool_compactionstats(result.stdout)
|
|
20
21
|
pod_details = {
|
|
21
22
|
'name': ctx.pod,
|
adam/checks/cpu.py
CHANGED
|
@@ -5,6 +5,7 @@ from adam.checks.check_context import CheckContext
|
|
|
5
5
|
from adam.checks.check_result import CheckResult
|
|
6
6
|
from adam.checks.issue import Issue
|
|
7
7
|
from adam.config import Config
|
|
8
|
+
from adam.utils import Color
|
|
8
9
|
from adam.utils_k8s.cassandra_nodes import CassandraNodes
|
|
9
10
|
from adam.utils_k8s.custom_resources import CustomResources
|
|
10
11
|
from adam.utils_k8s.pods import Pods
|
|
@@ -31,7 +32,7 @@ class Cpu(Check):
|
|
|
31
32
|
details['limit'] = container.resources.limits["cpu"]
|
|
32
33
|
|
|
33
34
|
idle = 'Unknown'
|
|
34
|
-
result = CassandraNodes.exec(ctx.pod, ctx.namespace, "mpstat 5 2 | grep Average | awk '{print $NF}'", show_out=ctx.show_output)
|
|
35
|
+
result = CassandraNodes.exec(ctx.pod, ctx.namespace, "mpstat 5 2 | grep Average | awk '{print $NF}'", show_out=ctx.show_output, text_color=Color.gray)
|
|
35
36
|
lines = result.stdout.strip(' \r\n').split('\n')
|
|
36
37
|
line = lines[len(lines) - 1].strip(' \r')
|
|
37
38
|
idle = details['idle'] = line
|
adam/checks/disk.py
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import re
|
|
2
2
|
from pathlib import Path
|
|
3
|
+
import traceback
|
|
3
4
|
|
|
4
5
|
from adam.checks.check import Check
|
|
5
6
|
from adam.checks.check_context import CheckContext
|
|
6
7
|
from adam.checks.check_result import CheckResult
|
|
7
8
|
from adam.checks.issue import Issue
|
|
8
9
|
from adam.config import Config
|
|
9
|
-
from adam.utils import log_exc
|
|
10
|
+
from adam.utils import Color, log_exc
|
|
10
11
|
from adam.utils_k8s.cassandra_nodes import CassandraNodes
|
|
11
12
|
|
|
12
13
|
class Disk(Check):
|
|
@@ -19,16 +20,16 @@ class Disk(Check):
|
|
|
19
20
|
|
|
20
21
|
try:
|
|
21
22
|
cass_data_path = Config().get('checks.cassandra-data-path', '/c3/cassandra')
|
|
22
|
-
df_result = CassandraNodes.exec(ctx.pod, ctx.namespace, f"df -h | grep -e '{cass_data_path}' -e 'overlay'", show_out=ctx.show_output)
|
|
23
|
+
df_result = CassandraNodes.exec(ctx.pod, ctx.namespace, f"df -h | grep -e '{cass_data_path}' -e 'overlay'", show_out=ctx.show_output, text_color=Color.gray)
|
|
23
24
|
|
|
24
25
|
snapshot_size = Config().get('checks.snapshot-size-cmd', "ls /c3/cassandra/data/data/*/*/snapshots | grep snapshots | sed 's/:$//g' | xargs -I {} du -sk {} | awk '{print $1}' | awk '{s+=$1} END {print s}'")
|
|
25
|
-
ss_result = CassandraNodes.exec(ctx.pod, ctx.namespace, snapshot_size, show_out=ctx.show_output)
|
|
26
|
+
ss_result = CassandraNodes.exec(ctx.pod, ctx.namespace, snapshot_size, show_out=ctx.show_output, text_color=Color.gray)
|
|
26
27
|
|
|
27
28
|
data_sizes = Config().get('checks.data-size-cmd', "du -sh /c3/cassandra/data/data")
|
|
28
|
-
ds_result = CassandraNodes.exec(ctx.pod, ctx.namespace, data_sizes, show_out=ctx.show_output)
|
|
29
|
+
ds_result = CassandraNodes.exec(ctx.pod, ctx.namespace, data_sizes, show_out=ctx.show_output, text_color=Color.gray)
|
|
29
30
|
|
|
30
31
|
table_sizes = Config().get('checks.table-sizes-cmd', "ls -Al /c3/cassandra/data/data/ | awk '{print $9}' | sed 's/\^r//g' | xargs -I {} du -sk /c3/cassandra/data/data/{}")
|
|
31
|
-
ts_result = CassandraNodes.exec(ctx.pod, ctx.namespace, table_sizes, show_out=ctx.show_output)
|
|
32
|
+
ts_result = CassandraNodes.exec(ctx.pod, ctx.namespace, table_sizes, show_out=ctx.show_output, text_color=Color.gray)
|
|
32
33
|
|
|
33
34
|
result = self.build_details(ctx, df_result.stdout, ss_result.stdout, ds_result.stdout, ts_result.stdout)
|
|
34
35
|
|
adam/checks/gossip.py
CHANGED
|
@@ -4,6 +4,7 @@ from adam.checks.check import Check
|
|
|
4
4
|
from adam.checks.check_context import CheckContext
|
|
5
5
|
from adam.checks.check_result import CheckResult
|
|
6
6
|
from adam.checks.issue import Issue
|
|
7
|
+
from adam.utils import Color
|
|
7
8
|
from adam.utils_k8s.cassandra_nodes import CassandraNodes
|
|
8
9
|
|
|
9
10
|
class Gossip(Check):
|
|
@@ -32,7 +33,7 @@ class Gossip(Check):
|
|
|
32
33
|
# TOKENS:21:<hidden>
|
|
33
34
|
# STATUS line missing -> NORMAL
|
|
34
35
|
# user, pw = get_user_pass(pod_name, ns)
|
|
35
|
-
result = CassandraNodes.exec(ctx.pod, ctx.namespace, f"nodetool -u {ctx.user} -pw {ctx.pw} gossipinfo", show_out=ctx.show_output)
|
|
36
|
+
result = CassandraNodes.exec(ctx.pod, ctx.namespace, f"nodetool -u {ctx.user} -pw {ctx.pw} gossipinfo", show_out=ctx.show_output, text_color=Color.gray)
|
|
36
37
|
|
|
37
38
|
nodes = self.parse_gossipinfo(result.stdout)
|
|
38
39
|
details = {
|
adam/checks/memory.py
CHANGED
|
@@ -2,6 +2,7 @@ from adam.checks.check import Check
|
|
|
2
2
|
from adam.checks.check_context import CheckContext
|
|
3
3
|
from adam.checks.check_result import CheckResult
|
|
4
4
|
from adam.checks.issue import Issue
|
|
5
|
+
from adam.utils import Color
|
|
5
6
|
from adam.utils_k8s.cassandra_nodes import CassandraNodes
|
|
6
7
|
from adam.utils_k8s.custom_resources import CustomResources
|
|
7
8
|
from adam.utils_k8s.pods import Pods
|
|
@@ -47,7 +48,7 @@ class Memory(Check):
|
|
|
47
48
|
|
|
48
49
|
def find_error(self, ctx: CheckContext, pattern: str, issue_desc: str):
|
|
49
50
|
escaped = pattern.replace('"', '\"')
|
|
50
|
-
result = CassandraNodes.exec(ctx.pod, ctx.namespace, f'tac /c3/cassandra/logs/system.log | grep "{escaped}" | head -1', show_out=ctx.show_output)
|
|
51
|
+
result = CassandraNodes.exec(ctx.pod, ctx.namespace, f'tac /c3/cassandra/logs/system.log | grep "{escaped}" | head -1', show_out=ctx.show_output, text_color=Color.gray)
|
|
51
52
|
if result.stdout.find(pattern) > 0:
|
|
52
53
|
return Issue(
|
|
53
54
|
statefulset=ctx.statefulset,
|
adam/checks/status.py
CHANGED
|
@@ -4,6 +4,7 @@ from adam.checks.check import Check
|
|
|
4
4
|
from adam.checks.check_context import CheckContext
|
|
5
5
|
from adam.checks.check_result import CheckResult
|
|
6
6
|
from adam.checks.issue import Issue
|
|
7
|
+
from adam.utils import Color
|
|
7
8
|
from adam.utils_k8s.cassandra_nodes import CassandraNodes
|
|
8
9
|
|
|
9
10
|
class Status(Check):
|
|
@@ -14,7 +15,7 @@ class Status(Check):
|
|
|
14
15
|
issues: list[Issue] = []
|
|
15
16
|
|
|
16
17
|
try:
|
|
17
|
-
result = CassandraNodes.exec(ctx.pod, ctx.namespace, f"nodetool -u {ctx.user} -pw {ctx.pw} status", show_out=ctx.show_output)
|
|
18
|
+
result = CassandraNodes.exec(ctx.pod, ctx.namespace, f"nodetool -u {ctx.user} -pw {ctx.pw} status", show_out=ctx.show_output, text_color=Color.gray)
|
|
18
19
|
status = parse_nodetool_status(result.stdout)
|
|
19
20
|
pod_details = {
|
|
20
21
|
'name': ctx.pod,
|
adam/commands/app/app.py
CHANGED
|
@@ -34,5 +34,5 @@ class App(Command):
|
|
|
34
34
|
def completion(self, _: ReplState):
|
|
35
35
|
return {}
|
|
36
36
|
|
|
37
|
-
def help(self,
|
|
38
|
-
return
|
|
37
|
+
def help(self, state: ReplState):
|
|
38
|
+
return super().help(state, "post app action use 'show app actions' for registered actions --force refresh session", command='<AppType>.<AppAction>', args='<args> [--force]')
|
adam/commands/app/app_ping.py
CHANGED
|
@@ -34,5 +34,5 @@ class AppPing(Command):
|
|
|
34
34
|
def completion(self, state: ReplState):
|
|
35
35
|
return super().completion(state, {'--force': None})
|
|
36
36
|
|
|
37
|
-
def help(self,
|
|
38
|
-
return
|
|
37
|
+
def help(self, state: ReplState):
|
|
38
|
+
return super().help(state, 'ping app server with Echo.echoStatic() --force refresh session', args='[--force]')
|
adam/commands/app/login.py
CHANGED
|
@@ -45,5 +45,5 @@ class ShowAppActions(Command):
|
|
|
45
45
|
def completion(self, state: ReplState):
|
|
46
46
|
return super().completion(state)
|
|
47
47
|
|
|
48
|
-
def help(self,
|
|
49
|
-
return
|
|
48
|
+
def help(self, state: ReplState):
|
|
49
|
+
return super().help(state, 'show registered app actions')
|
adam/commands/app/show_app_id.py
CHANGED
|
@@ -40,5 +40,5 @@ class ShowAppId(Command):
|
|
|
40
40
|
def completion(self, state: ReplState):
|
|
41
41
|
return super().completion(state)
|
|
42
42
|
|
|
43
|
-
def help(self,
|
|
44
|
-
return
|
|
43
|
+
def help(self, state: ReplState):
|
|
44
|
+
return super().help(state, 'show app id for the Cassandra cluster')
|
|
@@ -34,5 +34,5 @@ class ShowAppQueues(Command):
|
|
|
34
34
|
def completion(self, state: ReplState):
|
|
35
35
|
return super().completion(state, {'--force': None})
|
|
36
36
|
|
|
37
|
-
def help(self,
|
|
38
|
-
return
|
|
37
|
+
def help(self, state: ReplState):
|
|
38
|
+
return super().help(state, 'show invalidation queue counts --force refresh session', args='[--force]')
|
adam/commands/app/show_login.py
CHANGED
|
@@ -52,5 +52,5 @@ class ShowLogin(Command):
|
|
|
52
52
|
def completion(self, state: ReplState):
|
|
53
53
|
return super().completion(state)
|
|
54
54
|
|
|
55
|
-
def help(self,
|
|
56
|
-
return
|
|
55
|
+
def help(self, state: ReplState):
|
|
56
|
+
return super().help(state, 'show SSO login details')
|
adam/commands/audit/audit.py
CHANGED
|
@@ -7,12 +7,10 @@ from adam.commands.audit.audit_run import AuditRun
|
|
|
7
7
|
from adam.commands.audit.show_last10 import ShowLast10
|
|
8
8
|
from adam.commands.audit.show_slow10 import ShowSlow10
|
|
9
9
|
from adam.commands.audit.show_top10 import ShowTop10
|
|
10
|
-
from adam.commands.audit.utils_show_top10 import show_top10_completions_for_nesting
|
|
11
10
|
from adam.commands.command import Command
|
|
12
11
|
from adam.commands.intermediate_command import IntermediateCommand
|
|
13
12
|
from adam.repl_state import ReplState
|
|
14
|
-
from adam.
|
|
15
|
-
from adam.utils import log2, wait_log
|
|
13
|
+
from adam.utils import log2
|
|
16
14
|
from adam.utils_athena import Athena
|
|
17
15
|
|
|
18
16
|
class Audit(IntermediateCommand):
|
|
@@ -59,8 +57,8 @@ class Audit(IntermediateCommand):
|
|
|
59
57
|
def cmd_list(self):
|
|
60
58
|
return [AuditRepairTables(), AuditRun(), ShowLast10(), ShowSlow10(), ShowTop10()]
|
|
61
59
|
|
|
62
|
-
def help(self,
|
|
63
|
-
return
|
|
60
|
+
def help(self, state: ReplState):
|
|
61
|
+
return super().help(state, 'run SQL queries on Athena audit database', command='[audit] [<sql-statements>]')
|
|
64
62
|
|
|
65
63
|
class AuditCommandHelper(click.Command):
|
|
66
64
|
def get_help(self, ctx: click.Context):
|
|
@@ -68,5 +68,5 @@ class AuditRepairTables(Command):
|
|
|
68
68
|
exec.submit(Athena.query, f'MSCK REPAIR TABLE {table}', None,)
|
|
69
69
|
exec.submit(Audits.put_meta, Audits.PARTITIONS_ADDED, meta,)
|
|
70
70
|
|
|
71
|
-
def help(self,
|
|
72
|
-
return
|
|
71
|
+
def help(self, state: ReplState):
|
|
72
|
+
return super().help(state, 'run MSCK REPAIR to discover new partitions')
|
adam/commands/audit/audit_run.py
CHANGED
|
@@ -32,5 +32,5 @@ class ShowLast10(Command):
|
|
|
32
32
|
def completion(self, _: ReplState):
|
|
33
33
|
return {}
|
|
34
34
|
|
|
35
|
-
def help(self,
|
|
36
|
-
return
|
|
35
|
+
def help(self, state: ReplState):
|
|
36
|
+
return super().help(state, 'show last <limit> audit lines <limit> defaults to 10', args='[limit]')
|
|
@@ -32,5 +32,5 @@ class ShowSlow10(Command):
|
|
|
32
32
|
def completion(self, _: ReplState):
|
|
33
33
|
return {}
|
|
34
34
|
|
|
35
|
-
def help(self,
|
|
36
|
-
return
|
|
35
|
+
def help(self, state: ReplState):
|
|
36
|
+
return super().help(state, 'show slow <limit> audit lines <limit> default to 10', args='[limit]')
|
|
@@ -32,5 +32,5 @@ class ShowTop10(Command):
|
|
|
32
32
|
def completion(self, _: ReplState):
|
|
33
33
|
return {}
|
|
34
34
|
|
|
35
|
-
def help(self,
|
|
36
|
-
return
|
|
35
|
+
def help(self, state: ReplState):
|
|
36
|
+
return super().help(state, 'show top <limit> audit lines <limit> default to 10', args='[limit]')
|
adam/commands/bash/bash.py
CHANGED
|
@@ -32,5 +32,5 @@ class Bash(Command):
|
|
|
32
32
|
def completion(self, state: ReplState):
|
|
33
33
|
return super().completion(state, {c : {'&': None} for c in ['ls', 'cat', 'head']}, pods=Devices.of(state).pods(state, '-'))
|
|
34
34
|
|
|
35
|
-
def help(self,
|
|
36
|
-
return
|
|
35
|
+
def help(self, state: ReplState):
|
|
36
|
+
return super().help(state, 'run bash on Cassandra nodes', args='[bash-commands] [&]')
|
|
@@ -41,5 +41,5 @@ class DownloadCassandraLog(Command):
|
|
|
41
41
|
def completion(self, state: ReplState):
|
|
42
42
|
return super().completion(state, pods=Devices.of(state).pods(state, '-'), auto='jit')
|
|
43
43
|
|
|
44
|
-
def help(self,
|
|
45
|
-
return
|
|
44
|
+
def help(self, state: ReplState):
|
|
45
|
+
return super().help(state, 'download cassandra system log')
|
|
@@ -43,5 +43,5 @@ class RestartCluster(Command):
|
|
|
43
43
|
def completion(self, state: ReplState):
|
|
44
44
|
return super().completion(state, {'--force': None})
|
|
45
45
|
|
|
46
|
-
def help(self,
|
|
47
|
-
return
|
|
46
|
+
def help(self, state: ReplState):
|
|
47
|
+
return super().help(state, 'restart all the nodes in the cluster', args='--force')
|
|
@@ -47,5 +47,5 @@ class RestartNode(Command):
|
|
|
47
47
|
def completion(self, state: ReplState):
|
|
48
48
|
return super().completion(state, {'--force': None}, pods=Devices.of(state).pods(state, '-'))
|
|
49
49
|
|
|
50
|
-
def help(self,
|
|
51
|
-
return
|
|
50
|
+
def help(self, state: ReplState):
|
|
51
|
+
return super().help(state, 'restart the node', args='--force')
|
|
@@ -43,5 +43,5 @@ class RestartNodes(Command):
|
|
|
43
43
|
def completion(self, state: ReplState):
|
|
44
44
|
return super().completion(state, lambda: {p: {'--force': None} for p in StatefulSets.pod_names(state.sts, state.namespace)})
|
|
45
45
|
|
|
46
|
-
def help(self,
|
|
47
|
-
return
|
|
46
|
+
def help(self, state: ReplState):
|
|
47
|
+
return super().help(state, 'restart Cassandra nodes', args='<pod-name>... --force')
|
|
@@ -84,5 +84,5 @@ class RollOut(Command):
|
|
|
84
84
|
|
|
85
85
|
return {}
|
|
86
86
|
|
|
87
|
-
def help(self,
|
|
88
|
-
return
|
|
87
|
+
def help(self, state: ReplState):
|
|
88
|
+
return super().help(state, 'rollout all nodes --force ignore current rolling out', args='[--force]')
|
|
@@ -33,5 +33,5 @@ class ShowCassandraRepairs(Command):
|
|
|
33
33
|
def completion(self, state: ReplState):
|
|
34
34
|
return super().completion(state, {'&': None})
|
|
35
35
|
|
|
36
|
-
def help(self,
|
|
37
|
-
return
|
|
36
|
+
def help(self, state: ReplState):
|
|
37
|
+
return super().help(state, 'show Cassandra repairs', args='[&]')
|
|
@@ -113,5 +113,5 @@ class ShowCassandraStatus(Command):
|
|
|
113
113
|
def completion(self, state: ReplState):
|
|
114
114
|
return super().completion(state, {'-s': {'&': None}, '&': None})
|
|
115
115
|
|
|
116
|
-
def help(self,
|
|
117
|
-
return
|
|
116
|
+
def help(self, state: ReplState):
|
|
117
|
+
return super().help(state, 'show merged nodetool status -s show processing details', args='[-s]')
|
|
@@ -31,5 +31,5 @@ class ShowCassandraVersion(Command):
|
|
|
31
31
|
def completion(self, state: ReplState):
|
|
32
32
|
return super().completion(state)
|
|
33
33
|
|
|
34
|
-
def help(self,
|
|
35
|
-
return
|
|
34
|
+
def help(self, state: ReplState):
|
|
35
|
+
return super().help(state, 'show Cassandra version')
|
|
@@ -29,12 +29,12 @@ class ShowProcesses(Command):
|
|
|
29
29
|
with self.validate(args, state) as (args, state):
|
|
30
30
|
with extract_trailing_options(args, '&') as (args, backgrounded):
|
|
31
31
|
with extract_options(args, ['-s', '--show']) as (args, show_out):
|
|
32
|
-
with extract_sequence(args, ['with', 'recipe', '=', '
|
|
32
|
+
with extract_sequence(args, ['with', 'recipe', '=', 'mpstat']) as (_, recipe_qing):
|
|
33
33
|
cols = Config().get('processes.columns', 'pod,cpu-metrics,mem')
|
|
34
34
|
header = Config().get('processes.header', 'POD_NAME,M_CPU(USAGE/LIMIT),MEM/LIMIT')
|
|
35
35
|
if recipe_qing:
|
|
36
|
-
cols = Config().get('processes-
|
|
37
|
-
header = Config().get('processes-
|
|
36
|
+
cols = Config().get('processes-mpstat.columns', 'pod,cpu,mem')
|
|
37
|
+
header = Config().get('processes-mpstat.header', 'POD_NAME,Q_CPU/TOTAL,MEM/LIMIT')
|
|
38
38
|
|
|
39
39
|
with cassandra(state) as pods:
|
|
40
40
|
pods.display_table(cols, header, show_out=show_out, backgrounded=backgrounded, msg='Checking processes')
|
|
@@ -42,9 +42,9 @@ class ShowProcesses(Command):
|
|
|
42
42
|
return state
|
|
43
43
|
|
|
44
44
|
def completion(self, state: ReplState):
|
|
45
|
-
recipes = ['metrics', '
|
|
45
|
+
recipes = ['metrics', 'mpstat']
|
|
46
46
|
return super().completion(state, {'with': {'recipe': {'=': {r: {'-s': {'&': None}, '&': None} for r in recipes}}}, '-s': {'&': None}, '&': None})
|
|
47
47
|
# return super().completion(state, {'with': {'recipe': {'=': {'metrics': {'-s': {'&': None}, '&': None}, 'qing': {'-s': {'&': None}}}}}, '-s': {'&': None}, '&': None})
|
|
48
48
|
|
|
49
|
-
def help(self,
|
|
50
|
-
return
|
|
49
|
+
def help(self, state: ReplState):
|
|
50
|
+
return super().help(state, 'show process overview -s show processing details', args='[with recipe=metrics|mpstat] [-s]')
|
|
@@ -40,5 +40,5 @@ class ShowStorage(Command):
|
|
|
40
40
|
def completion(self, state: ReplState):
|
|
41
41
|
return super().completion(state, {'-s': {'&': None}, '&': None})
|
|
42
42
|
|
|
43
|
-
def help(self,
|
|
44
|
-
return
|
|
43
|
+
def help(self, state: ReplState):
|
|
44
|
+
return super().help(state, 'show storage overview -s show processing details', args='[-s]')
|
adam/commands/cassandra/watch.py
CHANGED
|
@@ -64,8 +64,8 @@ class ClipboardCopy(Command):
|
|
|
64
64
|
def completion(self, state: ReplState):
|
|
65
65
|
return super().completion(state, lambda: {key: None for key in CliCommands.values(state).keys()}, auto_key='cli.cp-auto-complete')
|
|
66
66
|
|
|
67
|
-
def help(self,
|
|
68
|
-
return
|
|
67
|
+
def help(self, state: ReplState):
|
|
68
|
+
return super().help(state, 'copy a value to clipboard for conveninence', args='<key')
|
|
69
69
|
|
|
70
70
|
class CopyCommandHelper(click.Command):
|
|
71
71
|
def lines(self):
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from adam.commands.cli.cli_commands import CliCommands
|
|
2
2
|
from adam.commands.command import Command
|
|
3
3
|
from adam.repl_state import ReplState, RequiredState
|
|
4
|
-
from adam.utils import tabulize
|
|
4
|
+
from adam.utils import tabulize
|
|
5
5
|
|
|
6
6
|
class ShowKubectlCommands(Command):
|
|
7
7
|
COMMAND = 'show cli-commands'
|
|
@@ -52,5 +52,5 @@ class ShowKubectlCommands(Command):
|
|
|
52
52
|
def completion(self, state: ReplState):
|
|
53
53
|
return super().completion(state)
|
|
54
54
|
|
|
55
|
-
def help(self,
|
|
56
|
-
return
|
|
55
|
+
def help(self, state: ReplState):
|
|
56
|
+
return super().help(state, 'show kubectl commands')
|
adam/commands/code.py
CHANGED
|
@@ -53,5 +53,5 @@ class Code(Command):
|
|
|
53
53
|
def completion(self, state: ReplState):
|
|
54
54
|
return super().completion(state)
|
|
55
55
|
|
|
56
|
-
def help(self,
|
|
57
|
-
return
|
|
56
|
+
def help(self, state: ReplState):
|
|
57
|
+
return super().help(state, 'run interactive Python shell')
|
adam/commands/command.py
CHANGED
|
@@ -22,6 +22,9 @@ class Command:
|
|
|
22
22
|
def command(self) -> str:
|
|
23
23
|
pass
|
|
24
24
|
|
|
25
|
+
def aliases(self):
|
|
26
|
+
return None
|
|
27
|
+
|
|
25
28
|
# The chain of responsibility pattern
|
|
26
29
|
# Do not do child of child!!!
|
|
27
30
|
@abstractmethod
|
|
@@ -68,6 +71,13 @@ class Command:
|
|
|
68
71
|
for t in reversed(self.command().split(' ')):
|
|
69
72
|
d = {t: d}
|
|
70
73
|
|
|
74
|
+
if aliases := self.aliases():
|
|
75
|
+
for alias in aliases:
|
|
76
|
+
a = leaf
|
|
77
|
+
for t in reversed(alias.split(' ')):
|
|
78
|
+
a = {t: a}
|
|
79
|
+
d |= a
|
|
80
|
+
|
|
71
81
|
return d
|
|
72
82
|
|
|
73
83
|
def required(self) -> RequiredState:
|
|
@@ -79,16 +89,33 @@ class Command:
|
|
|
79
89
|
def validate_state(self, state: ReplState, show_err = True):
|
|
80
90
|
return state.validate(self.required(), show_err=show_err)
|
|
81
91
|
|
|
82
|
-
def help(self, _: ReplState
|
|
83
|
-
|
|
92
|
+
def help(self, _: ReplState, desc: str = None, command: str = None, args: str = None):
|
|
93
|
+
if not desc:
|
|
94
|
+
return None
|
|
95
|
+
|
|
96
|
+
if not command:
|
|
97
|
+
command = self.command()
|
|
98
|
+
if args:
|
|
99
|
+
args = f' {args}'
|
|
100
|
+
else:
|
|
101
|
+
args = ''
|
|
102
|
+
aliases = ' alias ' + ','.join(self.aliases()) if self.aliases() else ''
|
|
103
|
+
return f'{command}{args}{aliases}\t{desc}'
|
|
84
104
|
|
|
85
105
|
def args(self, cmd: str):
|
|
86
106
|
a = list(filter(None, cmd.split(' ')))
|
|
87
107
|
spec = self.command_tokens()
|
|
88
|
-
if spec
|
|
89
|
-
return
|
|
108
|
+
if spec == a[:len(spec)]:
|
|
109
|
+
return a
|
|
90
110
|
|
|
91
|
-
|
|
111
|
+
if aliases := self.aliases():
|
|
112
|
+
for alias in aliases:
|
|
113
|
+
a = list(filter(None, cmd.split(' ')))
|
|
114
|
+
spec = alias.split(' ')
|
|
115
|
+
if spec == a[:len(spec)]:
|
|
116
|
+
return a
|
|
117
|
+
|
|
118
|
+
return None
|
|
92
119
|
|
|
93
120
|
def apply_state(self, args: list[str], state: ReplState, resolve_pg = True, args_to_check = 6) -> tuple[ReplState, list[str]]:
|
|
94
121
|
"""
|
|
@@ -38,5 +38,5 @@ class GetParam(Command):
|
|
|
38
38
|
def completion(self, _: ReplState):
|
|
39
39
|
return {GetParam.COMMAND: {key: None for key in Config().keys()}}
|
|
40
40
|
|
|
41
|
-
def help(self,
|
|
42
|
-
return
|
|
41
|
+
def help(self, state: ReplState):
|
|
42
|
+
return super().help(state, "shows a Kaqing system parameter's value", args='<key>')
|
|
@@ -36,5 +36,5 @@ class SetParam(Command):
|
|
|
36
36
|
def completion(self, _: ReplState):
|
|
37
37
|
return {SetParam.COMMAND: {key: ({'true': None, 'false': None} if Config().get(key, None) in [True, False] else None) for key in Config().keys()}}
|
|
38
38
|
|
|
39
|
-
def help(self,
|
|
40
|
-
return
|
|
39
|
+
def help(self, state: ReplState):
|
|
40
|
+
return super().help(state, 'sets a Kaqing system parameter to a different value', args='<key> <value>')
|
|
@@ -27,5 +27,5 @@ class ShowParams(Command):
|
|
|
27
27
|
def completion(self, state: ReplState):
|
|
28
28
|
return super().completion(state)
|
|
29
29
|
|
|
30
|
-
def help(self,
|
|
31
|
-
return
|
|
30
|
+
def help(self, state: ReplState):
|
|
31
|
+
return super().help(state, 'show Kaqing system parameters')
|
|
@@ -62,5 +62,5 @@ class AlterTables(Command):
|
|
|
62
62
|
# auto completion is taken care of by lark completer
|
|
63
63
|
return {}
|
|
64
64
|
|
|
65
|
-
def help(self,
|
|
66
|
-
return
|
|
65
|
+
def help(self, state: ReplState) -> str:
|
|
66
|
+
return super().help(state, 'alter schema on all tables', args='with <param=value>,... [--include-reaper]')
|
adam/commands/cql/cqlsh.py
CHANGED
|
@@ -44,8 +44,8 @@ class Cqlsh(Command):
|
|
|
44
44
|
|
|
45
45
|
return {}
|
|
46
46
|
|
|
47
|
-
def help(self,
|
|
48
|
-
return
|
|
47
|
+
def help(self, state: ReplState) -> str:
|
|
48
|
+
return super().help(state, 'run cqlsh with queries', command='[cql] <cql-statement>;...', args='[&]')
|
|
49
49
|
|
|
50
50
|
class CqlCommandHelper(click.Command):
|
|
51
51
|
def get_help(self, ctx: click.Context):
|
adam/commands/cql/utils_cql.py
CHANGED
|
@@ -227,16 +227,26 @@ class CassandraPodService:
|
|
|
227
227
|
def __init__(self, handler: 'CassandraExecHandler'):
|
|
228
228
|
self.handler = handler
|
|
229
229
|
|
|
230
|
-
def exec(self,
|
|
230
|
+
def exec(self,
|
|
231
|
+
command: str,
|
|
232
|
+
action='bash',
|
|
233
|
+
show_out = True,
|
|
234
|
+
on_any = False,
|
|
235
|
+
throw_err = False,
|
|
236
|
+
shell = '/bin/sh',
|
|
237
|
+
backgrounded = False,
|
|
238
|
+
log_file = None,
|
|
239
|
+
history=True,
|
|
240
|
+
text_color: str = None) -> Union[PodExecResult, list[PodExecResult]]:
|
|
231
241
|
state = self.handler.state
|
|
232
242
|
pod = self.handler.pod
|
|
233
243
|
|
|
234
244
|
if pod:
|
|
235
245
|
return CassandraNodes.exec(pod, state.namespace, command,
|
|
236
|
-
show_out=show_out, throw_err=throw_err, shell=shell, backgrounded=backgrounded, log_file=log_file, history=history)
|
|
246
|
+
show_out=show_out, throw_err=throw_err, shell=shell, backgrounded=backgrounded, log_file=log_file, history=history, text_color=text_color)
|
|
237
247
|
elif state.sts:
|
|
238
248
|
return CassandraClusters.exec(state.sts, state.namespace, command, action=action,
|
|
239
|
-
show_out=show_out, on_any=on_any, shell=shell, backgrounded=backgrounded, log_file=log_file, history=history)
|
|
249
|
+
show_out=show_out, on_any=on_any, shell=shell, backgrounded=backgrounded, log_file=log_file, history=history, text_color=text_color)
|
|
240
250
|
|
|
241
251
|
return []
|
|
242
252
|
|
|
@@ -31,5 +31,5 @@ class DebugCompletes(Command):
|
|
|
31
31
|
def completion(self, state: ReplState):
|
|
32
32
|
return super().completion(state, {f: None for f in ['on', 'off', 'file']})
|
|
33
33
|
|
|
34
|
-
def help(self,
|
|
35
|
-
return
|
|
34
|
+
def help(self, state: ReplState):
|
|
35
|
+
return super().help(state, 'turn auto complete debug on or off', args='on|off|file')
|
|
@@ -31,5 +31,5 @@ class DebugTimings(Command):
|
|
|
31
31
|
def completion(self, state: ReplState):
|
|
32
32
|
return super().completion(state, {f: None for f in ['on', 'off', 'file']})
|
|
33
33
|
|
|
34
|
-
def help(self,
|
|
35
|
-
return
|
|
34
|
+
def help(self, state: ReplState):
|
|
35
|
+
return super().help(state, 'turn timing debug on or off', args='on|off|file')
|
|
@@ -41,5 +41,5 @@ class ShowOffloadedCompletes(Command):
|
|
|
41
41
|
def completion(self, state: ReplState):
|
|
42
42
|
return super().completion(state)
|
|
43
43
|
|
|
44
|
-
def help(self,
|
|
45
|
-
return
|
|
44
|
+
def help(self, state: ReplState):
|
|
45
|
+
return super().help(state, 'show offloaded completes')
|