kaqing 2.0.30__tar.gz → 2.0.31__tar.gz
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.
- {kaqing-2.0.30 → kaqing-2.0.31}/PKG-INFO +1 -1
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/alter_tables.py +7 -10
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/cql_utils.py +15 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/cqlsh.py +7 -6
- {kaqing-2.0.30/adam/commands → kaqing-2.0.31/adam/commands/describe}/describe_keyspace.py +7 -10
- kaqing-2.0.31/adam/commands/describe/describe_keyspaces.py +50 -0
- kaqing-2.0.31/adam/commands/describe/describe_table.py +60 -0
- kaqing-2.0.31/adam/commands/describe/describe_tables.py +50 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/preview_table.py +14 -7
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/reaper/reaper_session.py +1 -1
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/config.py +10 -1
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/k8s_utils/cassandra_clusters.py +1 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/k8s_utils/pods.py +3 -2
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/repl.py +5 -5
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/repl_commands.py +8 -4
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/repl_state.py +22 -10
- kaqing-2.0.31/adam/sso/__init__.py +0 -0
- kaqing-2.0.31/adam/version.py +5 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/kaqing.egg-info/PKG-INFO +1 -1
- {kaqing-2.0.30 → kaqing-2.0.31}/kaqing.egg-info/SOURCES.txt +5 -1
- {kaqing-2.0.30 → kaqing-2.0.31}/setup.py +1 -1
- kaqing-2.0.30/adam/version.py +0 -5
- {kaqing-2.0.30 → kaqing-2.0.31}/README +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/__init__.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/app_session.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/apps.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/batch.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/checks/__init__.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/checks/check.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/checks/check_context.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/checks/check_result.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/checks/check_utils.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/checks/compactionstats.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/checks/cpu.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/checks/disk.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/checks/gossip.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/checks/issue.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/checks/memory.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/checks/status.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/cli.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/cli_group.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/columns/__init__.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/columns/column.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/columns/columns.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/columns/compactions.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/columns/cpu.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/columns/dir_data.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/columns/dir_snapshots.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/columns/gossip.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/columns/host_id.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/columns/memory.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/columns/node_address.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/columns/node_load.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/columns/node_owns.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/columns/node_status.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/columns/node_tokens.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/columns/node_utils.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/columns/pod_name.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/columns/volume_cassandra.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/columns/volume_root.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/__init__.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/app.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/app_ping.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/bash.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/cd.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/check.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/cli_commands.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/command.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/command_helpers.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/commands_utils.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/cp.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/deploy/__init__.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/deploy/code_start.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/deploy/code_stop.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/deploy/code_utils.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/deploy/deploy.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/deploy/deploy_frontend.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/deploy/deploy_pg_agent.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/deploy/deploy_pod.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/deploy/deploy_utils.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/deploy/undeploy.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/deploy/undeploy_frontend.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/deploy/undeploy_pg_agent.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/deploy/undeploy_pod.py +0 -0
- {kaqing-2.0.30/adam/commands/medusa → kaqing-2.0.31/adam/commands/describe}/__init__.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/devices.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/exit.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/help.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/issues.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/login.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/logs.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/ls.py +0 -0
- {kaqing-2.0.30/adam/commands/postgres → kaqing-2.0.31/adam/commands/medusa}/__init__.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/medusa/medusa.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/medusa/medusa_backup.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/medusa/medusa_restore.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/medusa/medusa_show_backupjobs.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/medusa/medusa_show_restorejobs.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/nodetool.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/nodetool_commands.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/param_get.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/param_set.py +0 -0
- {kaqing-2.0.30/adam/commands/reaper → kaqing-2.0.31/adam/commands/postgres}/__init__.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/postgres/postgres.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/postgres/postgres_ls.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/postgres/postgres_preview.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/postgres/postgres_session.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/pwd.py +0 -0
- {kaqing-2.0.30/adam/commands/repair → kaqing-2.0.31/adam/commands/reaper}/__init__.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/reaper/reaper.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/reaper/reaper_forward.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/reaper/reaper_forward_stop.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/reaper/reaper_restart.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/reaper/reaper_run_abort.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/reaper/reaper_runs.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/reaper/reaper_runs_abort.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/reaper/reaper_schedule_activate.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/reaper/reaper_schedule_start.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/reaper/reaper_schedule_stop.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/reaper/reaper_schedules.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/reaper/reaper_status.py +0 -0
- {kaqing-2.0.30/adam/commands/show → kaqing-2.0.31/adam/commands/repair}/__init__.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/repair/repair.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/repair/repair_log.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/repair/repair_run.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/repair/repair_scan.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/repair/repair_stop.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/report.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/restart.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/rollout.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/shell.py +0 -0
- {kaqing-2.0.30/adam/k8s_utils → kaqing-2.0.31/adam/commands/show}/__init__.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/show/show.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/show/show_adam.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/show/show_app_actions.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/show/show_app_id.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/show/show_app_queues.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/show/show_cassandra_status.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/show/show_cassandra_version.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/show/show_commands.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/show/show_login.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/show/show_params.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/show/show_processes.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/show/show_repairs.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/show/show_storage.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/commands/watch.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/embedded_apps.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/embedded_params.py +0 -0
- {kaqing-2.0.30/adam/sso → kaqing-2.0.31/adam/k8s_utils}/__init__.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/k8s_utils/cassandra_nodes.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/k8s_utils/config_maps.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/k8s_utils/custom_resources.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/k8s_utils/deployment.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/k8s_utils/ingresses.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/k8s_utils/jobs.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/k8s_utils/kube_context.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/k8s_utils/secrets.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/k8s_utils/service_accounts.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/k8s_utils/services.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/k8s_utils/statefulsets.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/k8s_utils/volumes.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/log.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/pod_exec_result.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/repl_session.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/sso/authenticator.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/sso/authn_ad.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/sso/authn_okta.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/sso/cred_cache.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/sso/id_token.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/sso/idp.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/sso/idp_login.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/sso/idp_session.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/sso/sso_config.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/adam/utils.py +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/kaqing.egg-info/dependency_links.txt +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/kaqing.egg-info/entry_points.txt +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/kaqing.egg-info/top_level.txt +0 -0
- {kaqing-2.0.30 → kaqing-2.0.31}/setup.cfg +0 -0
@@ -1,12 +1,9 @@
|
|
1
|
-
import click
|
2
|
-
|
3
1
|
from adam.commands.command import Command
|
4
|
-
from adam.commands.
|
5
|
-
from adam.commands.cql_utils import parse_cql_desc_tables, run_cql
|
2
|
+
from adam.commands.cql_utils import tables as get_tables, run_cql
|
6
3
|
from adam.config import Config
|
7
4
|
from adam.pod_exec_result import PodExecResult
|
8
5
|
from adam.repl_state import ReplState, RequiredState
|
9
|
-
from adam.utils import
|
6
|
+
from adam.utils import log2
|
10
7
|
|
11
8
|
class AlterTables(Command):
|
12
9
|
COMMAND = 'alter tables with'
|
@@ -47,16 +44,16 @@ class AlterTables(Command):
|
|
47
44
|
args, include_reaper = Command.extract_options(args, '--include-reaper')
|
48
45
|
arg_str = ' '.join(args)
|
49
46
|
|
50
|
-
r: list[PodExecResult] = run_cql(state, 'describe tables', show_out=False, on_any=True)
|
51
|
-
if not r:
|
52
|
-
|
53
|
-
|
47
|
+
# r: list[PodExecResult] = run_cql(state, 'describe tables', show_out=False, on_any=True)
|
48
|
+
# if not r:
|
49
|
+
# log2('No pod is available')
|
50
|
+
# return 'no-pod'
|
54
51
|
|
55
52
|
excludes = [e.strip(' \r\n') for e in Config().get(
|
56
53
|
'cql.alter-tables.excludes',
|
57
54
|
'system_auth,system_traces,reaper_db,system_distributed,system_views,system,system_schema,system_virtual_schema').split(',')]
|
58
55
|
batching = Config().get('cql.alter-tables.batching', True)
|
59
|
-
tables =
|
56
|
+
tables = get_tables(state, on_any=True)
|
60
57
|
for k, v in tables.items():
|
61
58
|
if k not in excludes or k == 'reaper_db' and include_reaper:
|
62
59
|
if batching:
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import functools
|
2
2
|
import re
|
3
3
|
|
4
|
+
from adam.config import Config
|
4
5
|
from adam.k8s_utils.cassandra_clusters import CassandraClusters
|
5
6
|
from adam.k8s_utils.cassandra_nodes import CassandraNodes
|
6
7
|
from adam.k8s_utils.secrets import Secrets
|
@@ -10,6 +11,8 @@ from adam.utils import log2
|
|
10
11
|
|
11
12
|
@functools.lru_cache()
|
12
13
|
def keyspaces(sts: str, namespace: str):
|
14
|
+
Config().wait_log("Inspecting Cassandra Keyspaces...")
|
15
|
+
|
13
16
|
user, pw = Secrets.get_user_pass(sts, namespace, secret_path='cql.secret')
|
14
17
|
command = f'cqlsh -u {user} -p {pw} -e "describe keyspaces"'
|
15
18
|
|
@@ -20,6 +23,18 @@ def keyspaces(sts: str, namespace: str):
|
|
20
23
|
|
21
24
|
return parse_cql_desc_keyspaces(r[0].stdout)
|
22
25
|
|
26
|
+
def table_names(state: ReplState):
|
27
|
+
return [f'{k}.{t}' for k, ts in tables(state, on_any=True).items() for t in ts]
|
28
|
+
|
29
|
+
@functools.lru_cache()
|
30
|
+
def tables(state: ReplState, on_any=False):
|
31
|
+
r: list[PodExecResult] = run_cql(state, 'describe tables', show_out=False, on_any=on_any)
|
32
|
+
if not r:
|
33
|
+
log2('No pod is available')
|
34
|
+
return []
|
35
|
+
|
36
|
+
return parse_cql_desc_tables(r[0].stdout)
|
37
|
+
|
23
38
|
def run_cql(state: ReplState, cql: str, opts: list = [], show_out = False, use_single_quotes = False, on_any = False):
|
24
39
|
user, pw = Secrets.get_user_pass(state.sts if state.sts else state.pod, state.namespace, secret_path='cql.secret')
|
25
40
|
if use_single_quotes:
|
@@ -2,7 +2,7 @@ import click
|
|
2
2
|
|
3
3
|
from adam.commands.command import Command
|
4
4
|
from adam.commands.command_helpers import ClusterOrPodCommandHelper
|
5
|
-
from adam.commands.cql_utils import run_cql
|
5
|
+
from adam.commands.cql_utils import run_cql, table_names, tables
|
6
6
|
from adam.repl_state import ReplState, RequiredState
|
7
7
|
from adam.utils import log, log2
|
8
8
|
|
@@ -54,12 +54,13 @@ class Cqlsh(Command):
|
|
54
54
|
|
55
55
|
def completion(self, state: ReplState) -> dict[str, any]:
|
56
56
|
if state.sts or state.pod:
|
57
|
+
ts = table_names(state)
|
57
58
|
return {Cqlsh.COMMAND: None} | {
|
58
|
-
'delete': {'from': None},
|
59
|
-
'insert': {'into': None},
|
60
|
-
'select': None,
|
61
|
-
'update': None,
|
62
|
-
'describe': {'keyspaces': None},
|
59
|
+
'delete': {'from': {t: {'where': None} for t in ts}},
|
60
|
+
'insert': {'into': {t: {'values': None} for t in ts}},
|
61
|
+
'select': {'*': {'from': {t: {'limit': {'1': None}, 'where': None} for t in ts}}},
|
62
|
+
'update': {t: {'set': None} for t in ts},
|
63
|
+
'describe': {'keyspaces': None, 'table': {t: None for t in ts}, 'tables': None},
|
63
64
|
}
|
64
65
|
|
65
66
|
return {}
|
@@ -1,12 +1,8 @@
|
|
1
|
-
import click
|
2
|
-
|
3
1
|
from adam.commands.command import Command
|
4
|
-
from adam.commands.
|
5
|
-
from adam.commands.cql_utils import keyspaces, parse_cql_desc_tables, run_cql
|
6
|
-
from adam.config import Config
|
2
|
+
from adam.commands.cql_utils import keyspaces, run_cql
|
7
3
|
from adam.pod_exec_result import PodExecResult
|
8
4
|
from adam.repl_state import ReplState, RequiredState
|
9
|
-
from adam.utils import
|
5
|
+
from adam.utils import log2
|
10
6
|
|
11
7
|
class DescribeKeyspace(Command):
|
12
8
|
COMMAND = 'describe keyspace'
|
@@ -34,6 +30,8 @@ class DescribeKeyspace(Command):
|
|
34
30
|
if not self.validate_state(state):
|
35
31
|
return state
|
36
32
|
|
33
|
+
args, all_nodes = Command.extract_options(args, '--all-nodes')
|
34
|
+
|
37
35
|
if not args:
|
38
36
|
if state.in_repl:
|
39
37
|
log2('Please enter keyspace name')
|
@@ -44,7 +42,7 @@ class DescribeKeyspace(Command):
|
|
44
42
|
|
45
43
|
return 'missing-keyspace'
|
46
44
|
|
47
|
-
r: list[PodExecResult] = run_cql(state, f'describe keyspace {args[0]}', show_out=True, on_any=
|
45
|
+
r: list[PodExecResult] = run_cql(state, f'describe keyspace {args[0]}', show_out=True, on_any=not all_nodes)
|
48
46
|
if not r:
|
49
47
|
log2('No pod is available')
|
50
48
|
return 'no-pod'
|
@@ -54,10 +52,9 @@ class DescribeKeyspace(Command):
|
|
54
52
|
|
55
53
|
def completion(self, state: ReplState) -> dict[str, any]:
|
56
54
|
if state.sts:
|
57
|
-
|
58
|
-
return super().completion(state, {ks: None for ks in keyspaces(state.sts, state.namespace)})
|
55
|
+
return super().completion(state, {ks: {'--all-nodes': None} for ks in keyspaces(state.sts, state.namespace)})
|
59
56
|
|
60
57
|
return {}
|
61
58
|
|
62
59
|
def help(self, _: ReplState) -> str:
|
63
|
-
return f'{DescribeKeyspace.COMMAND} <keyspace-name
|
60
|
+
return f'{DescribeKeyspace.COMMAND} <keyspace-name> [--all-nodes]\t describe Cassandra keyspace'
|
@@ -0,0 +1,50 @@
|
|
1
|
+
from adam.commands.command import Command
|
2
|
+
from adam.commands.cql_utils import keyspaces, run_cql
|
3
|
+
from adam.pod_exec_result import PodExecResult
|
4
|
+
from adam.repl_state import ReplState, RequiredState
|
5
|
+
from adam.utils import log2
|
6
|
+
|
7
|
+
class DescribeKeyspaces(Command):
|
8
|
+
COMMAND = 'describe keyspaces'
|
9
|
+
|
10
|
+
# the singleton pattern
|
11
|
+
def __new__(cls, *args, **kwargs):
|
12
|
+
if not hasattr(cls, 'instance'): cls.instance = super(DescribeKeyspaces, cls).__new__(cls)
|
13
|
+
|
14
|
+
return cls.instance
|
15
|
+
|
16
|
+
def __init__(self, successor: Command=None):
|
17
|
+
super().__init__(successor)
|
18
|
+
|
19
|
+
def required(self):
|
20
|
+
return RequiredState.CLUSTER
|
21
|
+
|
22
|
+
def command(self):
|
23
|
+
return DescribeKeyspaces.COMMAND
|
24
|
+
|
25
|
+
def run(self, cmd: str, state: ReplState):
|
26
|
+
if not(args := self.args(cmd)):
|
27
|
+
return super().run(cmd, state)
|
28
|
+
|
29
|
+
state, args = self.apply_state(args, state)
|
30
|
+
if not self.validate_state(state):
|
31
|
+
return state
|
32
|
+
|
33
|
+
_, all_nodes = Command.extract_options(args, '--all-nodes')
|
34
|
+
|
35
|
+
r: list[PodExecResult] = run_cql(state, f'describe keyspaces', show_out=True, on_any=not all_nodes)
|
36
|
+
if not r:
|
37
|
+
log2('No pod is available')
|
38
|
+
return 'no-pod'
|
39
|
+
|
40
|
+
# do not continue to cql route
|
41
|
+
return state
|
42
|
+
|
43
|
+
def completion(self, state: ReplState) -> dict[str, any]:
|
44
|
+
if state.sts:
|
45
|
+
return super().completion(state, {'--all-nodes': None})
|
46
|
+
|
47
|
+
return {}
|
48
|
+
|
49
|
+
def help(self, _: ReplState) -> str:
|
50
|
+
return f'{DescribeKeyspaces.COMMAND} [--all-nodes]\t describe Cassandra keyspaces'
|
@@ -0,0 +1,60 @@
|
|
1
|
+
from adam.commands.command import Command
|
2
|
+
from adam.commands.cql_utils import keyspaces, run_cql, table_names, tables
|
3
|
+
from adam.pod_exec_result import PodExecResult
|
4
|
+
from adam.repl_state import ReplState, RequiredState
|
5
|
+
from adam.utils import log2
|
6
|
+
|
7
|
+
class DescribeTable(Command):
|
8
|
+
COMMAND = 'describe table'
|
9
|
+
|
10
|
+
# the singleton pattern
|
11
|
+
def __new__(cls, *args, **kwargs):
|
12
|
+
if not hasattr(cls, 'instance'): cls.instance = super(DescribeTable, cls).__new__(cls)
|
13
|
+
|
14
|
+
return cls.instance
|
15
|
+
|
16
|
+
def __init__(self, successor: Command=None):
|
17
|
+
super().__init__(successor)
|
18
|
+
|
19
|
+
def required(self):
|
20
|
+
return RequiredState.CLUSTER
|
21
|
+
|
22
|
+
def command(self):
|
23
|
+
return DescribeTable.COMMAND
|
24
|
+
|
25
|
+
def run(self, cmd: str, state: ReplState):
|
26
|
+
if not(args := self.args(cmd)):
|
27
|
+
return super().run(cmd, state)
|
28
|
+
|
29
|
+
state, args = self.apply_state(args, state)
|
30
|
+
if not self.validate_state(state):
|
31
|
+
return state
|
32
|
+
|
33
|
+
args, all_nodes = Command.extract_options(args, '--all-nodes')
|
34
|
+
|
35
|
+
if not args:
|
36
|
+
if state.in_repl:
|
37
|
+
log2('Please enter table name')
|
38
|
+
else:
|
39
|
+
log2('* table name is missing.')
|
40
|
+
log2()
|
41
|
+
Command.display_help()
|
42
|
+
|
43
|
+
return 'missing-table'
|
44
|
+
|
45
|
+
r: list[PodExecResult] = run_cql(state, f'describe table {args[0]}', show_out=True, on_any=not all_nodes)
|
46
|
+
if not r:
|
47
|
+
log2('No pod is available')
|
48
|
+
return 'no-pod'
|
49
|
+
|
50
|
+
# do not continue to cql route
|
51
|
+
return state
|
52
|
+
|
53
|
+
def completion(self, state: ReplState) -> dict[str, any]:
|
54
|
+
if state.sts:
|
55
|
+
return super().completion(state, {t: {'--all-nodes': None} for t in table_names(state)})
|
56
|
+
|
57
|
+
return {}
|
58
|
+
|
59
|
+
def help(self, _: ReplState) -> str:
|
60
|
+
return f'{DescribeTable.COMMAND} <table-name> [--all-nodes]\t describe Cassandra table'
|
@@ -0,0 +1,50 @@
|
|
1
|
+
from adam.commands.command import Command
|
2
|
+
from adam.commands.cql_utils import keyspaces, run_cql, table_names, tables
|
3
|
+
from adam.pod_exec_result import PodExecResult
|
4
|
+
from adam.repl_state import ReplState, RequiredState
|
5
|
+
from adam.utils import log2
|
6
|
+
|
7
|
+
class DescribeTables(Command):
|
8
|
+
COMMAND = 'describe tables'
|
9
|
+
|
10
|
+
# the singleton pattern
|
11
|
+
def __new__(cls, *args, **kwargs):
|
12
|
+
if not hasattr(cls, 'instance'): cls.instance = super(DescribeTables, cls).__new__(cls)
|
13
|
+
|
14
|
+
return cls.instance
|
15
|
+
|
16
|
+
def __init__(self, successor: Command=None):
|
17
|
+
super().__init__(successor)
|
18
|
+
|
19
|
+
def required(self):
|
20
|
+
return RequiredState.CLUSTER
|
21
|
+
|
22
|
+
def command(self):
|
23
|
+
return DescribeTables.COMMAND
|
24
|
+
|
25
|
+
def run(self, cmd: str, state: ReplState):
|
26
|
+
if not(args := self.args(cmd)):
|
27
|
+
return super().run(cmd, state)
|
28
|
+
|
29
|
+
state, args = self.apply_state(args, state)
|
30
|
+
if not self.validate_state(state):
|
31
|
+
return state
|
32
|
+
|
33
|
+
_, all_nodes = Command.extract_options(args, '--all-nodes')
|
34
|
+
|
35
|
+
r: list[PodExecResult] = run_cql(state, f'describe tables', show_out=True, on_any=not all_nodes)
|
36
|
+
if not r:
|
37
|
+
log2('No pod is available')
|
38
|
+
return 'no-pod'
|
39
|
+
|
40
|
+
# do not continue to cql route
|
41
|
+
return state
|
42
|
+
|
43
|
+
def completion(self, state: ReplState) -> dict[str, any]:
|
44
|
+
if state.sts:
|
45
|
+
return super().completion(state, {'--all-nodes': None})
|
46
|
+
|
47
|
+
return {}
|
48
|
+
|
49
|
+
def help(self, _: ReplState) -> str:
|
50
|
+
return f'{DescribeTables.COMMAND} [--all-nodes]\t describe Cassandra tables'
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import functools
|
2
2
|
|
3
3
|
from adam.commands.command import Command
|
4
|
-
from adam.commands.cql_utils import
|
4
|
+
from adam.commands.cql_utils import run_cql, tables
|
5
5
|
from adam.commands.postgres.postgres_session import PostgresSession
|
6
6
|
from adam.config import Config
|
7
7
|
from adam.pod_exec_result import PodExecResult
|
@@ -74,10 +74,9 @@ class PreviewTable(Command):
|
|
74
74
|
if state.device == ReplState.P:
|
75
75
|
if tables := PreviewTable.pg_tables(state.namespace, state.pg_path):
|
76
76
|
return {PreviewTable.COMMAND: {db["name"]: None for db in tables if db["schema"] == PostgresSession.default_schema()}}
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
return {PreviewTable.COMMAND: {f'{k}.{t}': None for k, ts in tables.items() for t in ts}}
|
77
|
+
elif state.sts:
|
78
|
+
tables = PreviewTable.cql_tables(state)
|
79
|
+
return {PreviewTable.COMMAND: {f'{k}.{t}': None for k, ts in tables.items() for t in ts}}
|
81
80
|
|
82
81
|
return {}
|
83
82
|
|
@@ -86,8 +85,16 @@ class PreviewTable(Command):
|
|
86
85
|
|
87
86
|
@functools.lru_cache()
|
88
87
|
def cql_tables(state: ReplState):
|
89
|
-
|
90
|
-
|
88
|
+
if state.pod:
|
89
|
+
return tables(state)
|
90
|
+
|
91
|
+
return tables(state, on_any=True)
|
92
|
+
|
93
|
+
# r: list[PodExecResult] = run_cql(state, 'describe tables', show_out=False, on_any=True)
|
94
|
+
# if not r:
|
95
|
+
# return []
|
96
|
+
|
97
|
+
# return parse_cql_desc_tables(r[0].stdout)
|
91
98
|
|
92
99
|
@functools.lru_cache()
|
93
100
|
def pg_tables(ns: str, pg_path: str):
|
@@ -149,7 +149,7 @@ class ReaperSession:
|
|
149
149
|
return ReaperSession.schedules_ids_by_cluster[state.sts]
|
150
150
|
|
151
151
|
if reaper := ReaperSession.create(state):
|
152
|
-
|
152
|
+
Config().wait_log("Inspecting Cassandra Reaper...")
|
153
153
|
|
154
154
|
schedules = reaper.schedule_ids(state, show_output = False)
|
155
155
|
ReaperSession.schedules_ids_by_cluster[state.sts] = schedules
|
@@ -17,6 +17,7 @@ class Config:
|
|
17
17
|
|
18
18
|
def __init__(self, path: str = None, is_user_entry = False):
|
19
19
|
if path:
|
20
|
+
self.wait_log_flag = False
|
20
21
|
try:
|
21
22
|
with open(path) as f:
|
22
23
|
self.params = cast(dict[str, any], yaml.safe_load(f))
|
@@ -83,4 +84,12 @@ class Config:
|
|
83
84
|
log2(f'incorrect path: {key}')
|
84
85
|
return None
|
85
86
|
|
86
|
-
return v if v else 'false'
|
87
|
+
return v if v else 'false'
|
88
|
+
|
89
|
+
def wait_log(self, msg: str):
|
90
|
+
if not self.wait_log_flag:
|
91
|
+
log2(msg)
|
92
|
+
self.wait_log_flag = True
|
93
|
+
|
94
|
+
def clear_wait_log_flag(self):
|
95
|
+
self.wait_log_flag = False
|
@@ -47,7 +47,7 @@ class Pods:
|
|
47
47
|
|
48
48
|
if not max_workers:
|
49
49
|
max_workers = Config().action_workers(action, 0)
|
50
|
-
if not on_any and
|
50
|
+
if not on_any and max_workers > 0:
|
51
51
|
# if parallel, node sampling is suppressed
|
52
52
|
if KubeContext.show_parallelism():
|
53
53
|
log2(f'Executing on all nodes from statefulset in parallel...')
|
@@ -79,7 +79,8 @@ class Pods:
|
|
79
79
|
log2(f'Executing on {adj} nodes from statefulset...')
|
80
80
|
for pod_name in pods:
|
81
81
|
try:
|
82
|
-
|
82
|
+
# disable stdout from the pod_exec, then show the output in a for loop
|
83
|
+
result = body(None, pod_name, namespace, False)
|
83
84
|
if post:
|
84
85
|
result = post(result, show_out=show_out)
|
85
86
|
results.append(result)
|
@@ -70,7 +70,7 @@ def enter_repl(state: ReplState):
|
|
70
70
|
cluster = ss[0]
|
71
71
|
state.sts = cluster[0]
|
72
72
|
state.namespace = cluster[1]
|
73
|
-
|
73
|
+
Config().wait_log(f'Moving to the only Cassandra cluster: {state.sts}@{state.namespace}...')
|
74
74
|
elif state.device == ReplState.A:
|
75
75
|
if app := Config().get('repl.auto-enter-app', 'c3/c3'):
|
76
76
|
if app != 'no':
|
@@ -78,9 +78,9 @@ def enter_repl(state: ReplState):
|
|
78
78
|
state.app_env = ea[0]
|
79
79
|
if len(ea) > 1:
|
80
80
|
state.app_app = ea[1]
|
81
|
-
|
81
|
+
Config().wait_log(f'Moving to {state.app_env}/{state.app_app}...')
|
82
82
|
else:
|
83
|
-
|
83
|
+
Config().wait_log(f'Moving to {state.app_env}...')
|
84
84
|
|
85
85
|
kb = KeyBindings()
|
86
86
|
|
@@ -151,7 +151,7 @@ def enter_repl(state: ReplState):
|
|
151
151
|
log2(e)
|
152
152
|
Config().debug(traceback.format_exc())
|
153
153
|
finally:
|
154
|
-
|
154
|
+
Config().clear_wait_log_flag()
|
155
155
|
if Config().get('debugs.timings', False) and 'cmd' in locals() and 's0' in locals():
|
156
156
|
print('Timing command', cmd, f'{time.time() - s0:.2f}')
|
157
157
|
|
@@ -168,5 +168,5 @@ def repl(kubeconfig: str, config: str, param: list[str], cluster:str, namespace:
|
|
168
168
|
return
|
169
169
|
|
170
170
|
state = ReplState(device=Config().get('repl.start-drive', 'a'), ns_sts=cluster, namespace=namespace, in_repl=True)
|
171
|
-
state, _ = state.
|
171
|
+
state, _ = state.apply_device_arg(extra_args)
|
172
172
|
enter_repl(state)
|
@@ -11,7 +11,10 @@ from adam.commands.deploy.undeploy import Undeploy
|
|
11
11
|
from adam.commands.deploy.undeploy_frontend import UndeployFrontend
|
12
12
|
from adam.commands.deploy.undeploy_pg_agent import UndeployPgAgent
|
13
13
|
from adam.commands.deploy.undeploy_pod import UndeployPod
|
14
|
-
from adam.commands.describe_keyspace import DescribeKeyspace
|
14
|
+
from adam.commands.describe.describe_keyspace import DescribeKeyspace
|
15
|
+
from adam.commands.describe.describe_keyspaces import DescribeKeyspaces
|
16
|
+
from adam.commands.describe.describe_table import DescribeTable
|
17
|
+
from adam.commands.describe.describe_tables import DescribeTables
|
15
18
|
from adam.commands.shell import Shell
|
16
19
|
from adam.commands.show.show_app_queues import ShowAppQueues
|
17
20
|
from adam.commands.cp import ClipboardCopy
|
@@ -76,14 +79,15 @@ class ReplCommands:
|
|
76
79
|
GetParam(), SetParam(), ShowParams(), ShowKubectlCommands(), ShowLogin(), ShowAdam()]
|
77
80
|
|
78
81
|
def cassandra_check() -> list[Command]:
|
79
|
-
return [DescribeKeyspace(),
|
82
|
+
return [DescribeKeyspace(), DescribeKeyspaces(), DescribeTable(), DescribeTables(), ShowCassandraStatus(),
|
83
|
+
ShowCassandraVersion(), ShowRepairs(), ShowStorage(), ShowProcesses(), Check(), Issues(), NodeTool(), Report()]
|
80
84
|
|
81
85
|
def cassandra_ops() -> list[Command]:
|
82
|
-
# return Medusa.cmd_list() + [Restart(), RollOut(), Watch()] + Reaper.cmd_list() + Repair.cmd_list()
|
83
86
|
return [AlterTables()] + Medusa.cmd_list() + [Restart(), RollOut(), Watch()] + Reaper.cmd_list() + Repair.cmd_list()
|
84
87
|
|
85
88
|
def tools() -> list[Command]:
|
86
|
-
return [Cqlsh(), Postgres(), Bash(), Shell(), CodeStart(), CodeStop(), DeployFrontend(), UndeployFrontend(),
|
89
|
+
return [Cqlsh(), Postgres(), Bash(), Shell(), CodeStart(), CodeStop(), DeployFrontend(), UndeployFrontend(),
|
90
|
+
DeployPod(), UndeployPod(), DeployPgAgent(), UndeployPgAgent()]
|
87
91
|
|
88
92
|
def app() -> list[Command]:
|
89
93
|
return [ShowAppActions(), ShowAppId(), ShowAppQueues(), AppPing(), App()]
|
@@ -67,7 +67,7 @@ class ReplState:
|
|
67
67
|
self.in_repl = in_repl
|
68
68
|
self.bash_session = bash_session
|
69
69
|
self.remote_dir = remote_dir
|
70
|
-
self.wait_log_flag = False
|
70
|
+
# self.wait_log_flag = False
|
71
71
|
|
72
72
|
if ns_sts:
|
73
73
|
nn = ns_sts.split('@')
|
@@ -120,6 +120,26 @@ class ReplState:
|
|
120
120
|
|
121
121
|
return (state, new_args)
|
122
122
|
|
123
|
+
def apply_device_arg(self, args: list[str], cmd: list[str] = None) -> tuple['ReplState', list[str]]:
|
124
|
+
state = self
|
125
|
+
|
126
|
+
new_args = []
|
127
|
+
for index, arg in enumerate(args):
|
128
|
+
if index < 6:
|
129
|
+
state = copy.copy(state)
|
130
|
+
|
131
|
+
if arg in [f'{ReplState.A}:', f'{ReplState.C}:', f'{ReplState.P}:']:
|
132
|
+
state.device = arg.strip(':')
|
133
|
+
else:
|
134
|
+
new_args.append(arg)
|
135
|
+
else:
|
136
|
+
new_args.append(arg)
|
137
|
+
|
138
|
+
if cmd:
|
139
|
+
new_args = new_args[len(cmd):]
|
140
|
+
|
141
|
+
return (state, new_args)
|
142
|
+
|
123
143
|
def validate(self, required: RequiredState = None, pg_required: RequiredState = None, app_required: RequiredState = None):
|
124
144
|
if not pg_required and not app_required:
|
125
145
|
if required == RequiredState.CLUSTER:
|
@@ -200,12 +220,4 @@ class ReplState:
|
|
200
220
|
if self.bash_session and self.bash_session.device:
|
201
221
|
self.device = self.bash_session.device
|
202
222
|
|
203
|
-
self.bash_session = None
|
204
|
-
|
205
|
-
def wait_log(self, msg: str):
|
206
|
-
if not self.wait_log_flag:
|
207
|
-
log2(msg)
|
208
|
-
self.wait_log_flag = True
|
209
|
-
|
210
|
-
def clear_wait_log_flag(self):
|
211
|
-
self.wait_log_flag = False
|
223
|
+
self.bash_session = None
|
File without changes
|
@@ -62,7 +62,6 @@ adam/commands/commands_utils.py
|
|
62
62
|
adam/commands/cp.py
|
63
63
|
adam/commands/cql_utils.py
|
64
64
|
adam/commands/cqlsh.py
|
65
|
-
adam/commands/describe_keyspace.py
|
66
65
|
adam/commands/devices.py
|
67
66
|
adam/commands/exit.py
|
68
67
|
adam/commands/help.py
|
@@ -94,6 +93,11 @@ adam/commands/deploy/undeploy.py
|
|
94
93
|
adam/commands/deploy/undeploy_frontend.py
|
95
94
|
adam/commands/deploy/undeploy_pg_agent.py
|
96
95
|
adam/commands/deploy/undeploy_pod.py
|
96
|
+
adam/commands/describe/__init__.py
|
97
|
+
adam/commands/describe/describe_keyspace.py
|
98
|
+
adam/commands/describe/describe_keyspaces.py
|
99
|
+
adam/commands/describe/describe_table.py
|
100
|
+
adam/commands/describe/describe_tables.py
|
97
101
|
adam/commands/medusa/__init__.py
|
98
102
|
adam/commands/medusa/medusa.py
|
99
103
|
adam/commands/medusa/medusa_backup.py
|
kaqing-2.0.30/adam/version.py
DELETED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|