kaqing 1.77.0__py3-none-any.whl → 2.0.171__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.
- adam/__init__.py +1 -0
- adam/app_session.py +182 -0
- {walker → adam}/apps.py +8 -24
- {walker → adam}/batch.py +54 -97
- {walker → adam}/checks/check.py +3 -3
- {walker → adam}/checks/check_result.py +1 -1
- adam/checks/check_utils.py +65 -0
- {walker → adam}/checks/compactionstats.py +6 -6
- {walker → adam}/checks/cpu.py +14 -8
- adam/checks/cpu_metrics.py +52 -0
- {walker → adam}/checks/disk.py +6 -6
- {walker → adam}/checks/gossip.py +5 -5
- {walker → adam}/checks/memory.py +7 -7
- {walker → adam}/checks/status.py +5 -5
- {walker → adam}/cli.py +3 -3
- {walker → adam}/columns/column.py +1 -1
- adam/columns/columns.py +45 -0
- {walker → adam}/columns/compactions.py +5 -5
- {walker → adam}/columns/cpu.py +6 -4
- adam/columns/cpu_metrics.py +22 -0
- {walker → adam}/columns/dir_data.py +3 -3
- {walker → adam}/columns/dir_snapshots.py +3 -3
- {walker → adam}/columns/gossip.py +5 -5
- {walker → adam}/columns/host_id.py +3 -3
- {walker → adam}/columns/memory.py +3 -3
- {walker → adam}/columns/node_address.py +3 -3
- {walker → adam}/columns/node_load.py +3 -3
- {walker → adam}/columns/node_owns.py +3 -3
- {walker → adam}/columns/node_status.py +3 -3
- {walker → adam}/columns/node_tokens.py +3 -3
- {walker → adam}/columns/node_utils.py +2 -2
- {walker → adam}/columns/pod_name.py +2 -2
- {walker → adam}/columns/volume_cassandra.py +4 -4
- {walker → adam}/columns/volume_root.py +3 -3
- adam/commands/__init__.py +15 -0
- adam/commands/alter_tables.py +81 -0
- adam/commands/app_cmd.py +38 -0
- {walker → adam}/commands/app_ping.py +10 -16
- adam/commands/audit/audit.py +84 -0
- adam/commands/audit/audit_repair_tables.py +74 -0
- adam/commands/audit/audit_run.py +50 -0
- adam/commands/audit/show_last10.py +48 -0
- adam/commands/audit/show_slow10.py +47 -0
- adam/commands/audit/show_top10.py +45 -0
- adam/commands/audit/utils_show_top10.py +59 -0
- adam/commands/bash/__init__.py +5 -0
- adam/commands/bash/bash.py +36 -0
- adam/commands/bash/bash_completer.py +93 -0
- adam/commands/bash/utils_bash.py +16 -0
- adam/commands/cat.py +50 -0
- adam/commands/cd.py +43 -0
- adam/commands/check.py +73 -0
- {walker → adam}/commands/cli_commands.py +7 -8
- adam/commands/code.py +57 -0
- adam/commands/command.py +190 -0
- {walker → adam}/commands/command_helpers.py +1 -1
- {walker → adam}/commands/commands_utils.py +15 -25
- adam/commands/cp.py +89 -0
- adam/commands/cql/cql_completions.py +33 -0
- {walker/commands → adam/commands/cql}/cqlsh.py +20 -35
- adam/commands/cql/utils_cql.py +343 -0
- {walker/commands/frontend → adam/commands/deploy}/code_start.py +11 -14
- adam/commands/deploy/code_stop.py +40 -0
- {walker/commands/frontend → adam/commands/deploy}/code_utils.py +7 -9
- adam/commands/deploy/deploy.py +25 -0
- adam/commands/deploy/deploy_frontend.py +49 -0
- adam/commands/deploy/deploy_pg_agent.py +35 -0
- adam/commands/deploy/deploy_pod.py +108 -0
- adam/commands/deploy/deploy_utils.py +29 -0
- adam/commands/deploy/undeploy.py +25 -0
- adam/commands/deploy/undeploy_frontend.py +38 -0
- adam/commands/deploy/undeploy_pg_agent.py +39 -0
- adam/commands/deploy/undeploy_pod.py +48 -0
- adam/commands/devices/device.py +118 -0
- adam/commands/devices/device_app.py +173 -0
- adam/commands/devices/device_auit_log.py +49 -0
- adam/commands/devices/device_cass.py +185 -0
- adam/commands/devices/device_export.py +86 -0
- adam/commands/devices/device_postgres.py +144 -0
- adam/commands/devices/devices.py +25 -0
- {walker → adam}/commands/exit.py +3 -6
- adam/commands/export/clean_up_all_export_sessions.py +37 -0
- adam/commands/export/clean_up_export_sessions.py +51 -0
- adam/commands/export/drop_export_database.py +55 -0
- adam/commands/export/drop_export_databases.py +43 -0
- adam/commands/export/export.py +53 -0
- adam/commands/export/export_databases.py +170 -0
- adam/commands/export/export_handlers.py +71 -0
- adam/commands/export/export_select.py +81 -0
- adam/commands/export/export_select_x.py +54 -0
- adam/commands/export/export_use.py +52 -0
- adam/commands/export/exporter.py +352 -0
- adam/commands/export/import_session.py +40 -0
- adam/commands/export/importer.py +67 -0
- adam/commands/export/importer_athena.py +80 -0
- adam/commands/export/importer_sqlite.py +47 -0
- adam/commands/export/show_column_counts.py +54 -0
- adam/commands/export/show_export_databases.py +36 -0
- adam/commands/export/show_export_session.py +48 -0
- adam/commands/export/show_export_sessions.py +44 -0
- adam/commands/export/utils_export.py +314 -0
- {walker → adam}/commands/help.py +17 -12
- adam/commands/intermediate_command.py +49 -0
- adam/commands/issues.py +43 -0
- adam/commands/kubectl.py +38 -0
- adam/commands/login.py +70 -0
- {walker → adam}/commands/logs.py +8 -10
- adam/commands/ls.py +41 -0
- adam/commands/medusa/medusa.py +27 -0
- adam/commands/medusa/medusa_backup.py +57 -0
- adam/commands/medusa/medusa_restore.py +83 -0
- adam/commands/medusa/medusa_show_backupjobs.py +51 -0
- adam/commands/medusa/medusa_show_restorejobs.py +47 -0
- {walker → adam}/commands/nodetool.py +17 -21
- {walker → adam}/commands/param_get.py +15 -16
- adam/commands/param_set.py +43 -0
- adam/commands/postgres/postgres.py +104 -0
- adam/commands/postgres/postgres_context.py +274 -0
- {walker → adam}/commands/postgres/postgres_ls.py +7 -11
- {walker → adam}/commands/postgres/postgres_preview.py +8 -13
- adam/commands/postgres/psql_completions.py +10 -0
- adam/commands/postgres/utils_postgres.py +66 -0
- adam/commands/preview_table.py +37 -0
- adam/commands/pwd.py +47 -0
- adam/commands/reaper/reaper.py +35 -0
- adam/commands/reaper/reaper_forward.py +93 -0
- adam/commands/reaper/reaper_forward_session.py +6 -0
- {walker → adam}/commands/reaper/reaper_forward_stop.py +13 -19
- {walker → adam}/commands/reaper/reaper_restart.py +10 -17
- adam/commands/reaper/reaper_run_abort.py +46 -0
- adam/commands/reaper/reaper_runs.py +82 -0
- adam/commands/reaper/reaper_runs_abort.py +63 -0
- adam/commands/reaper/reaper_schedule_activate.py +45 -0
- adam/commands/reaper/reaper_schedule_start.py +45 -0
- adam/commands/reaper/reaper_schedule_stop.py +45 -0
- {walker → adam}/commands/reaper/reaper_schedules.py +6 -16
- {walker → adam}/commands/reaper/reaper_status.py +11 -19
- adam/commands/reaper/utils_reaper.py +196 -0
- adam/commands/repair/repair.py +26 -0
- {walker → adam}/commands/repair/repair_log.py +7 -10
- adam/commands/repair/repair_run.py +70 -0
- adam/commands/repair/repair_scan.py +71 -0
- {walker → adam}/commands/repair/repair_stop.py +8 -11
- adam/commands/report.py +61 -0
- adam/commands/restart.py +60 -0
- {walker → adam}/commands/rollout.py +25 -30
- adam/commands/shell.py +34 -0
- adam/commands/show/show.py +39 -0
- walker/commands/show/show_version.py → adam/commands/show/show_adam.py +14 -10
- adam/commands/show/show_app_actions.py +57 -0
- {walker → adam}/commands/show/show_app_id.py +12 -15
- {walker → adam}/commands/show/show_app_queues.py +9 -12
- adam/commands/show/show_cassandra_repairs.py +38 -0
- adam/commands/show/show_cassandra_status.py +124 -0
- {walker → adam}/commands/show/show_cassandra_version.py +6 -16
- adam/commands/show/show_commands.py +59 -0
- walker/commands/show/show_storage.py → adam/commands/show/show_host.py +11 -13
- adam/commands/show/show_login.py +62 -0
- {walker → adam}/commands/show/show_params.py +4 -4
- adam/commands/show/show_processes.py +51 -0
- adam/commands/show/show_storage.py +42 -0
- adam/commands/watch.py +82 -0
- {walker → adam}/config.py +10 -22
- {walker → adam}/embedded_apps.py +1 -1
- adam/embedded_params.py +2 -0
- adam/log.py +47 -0
- {walker → adam}/pod_exec_result.py +10 -2
- adam/repl.py +182 -0
- adam/repl_commands.py +124 -0
- adam/repl_state.py +458 -0
- adam/sql/__init__.py +0 -0
- adam/sql/sql_completer.py +120 -0
- adam/sql/sql_state_machine.py +618 -0
- adam/sql/term_completer.py +76 -0
- adam/sso/__init__.py +0 -0
- {walker → adam}/sso/authenticator.py +5 -1
- adam/sso/authn_ad.py +170 -0
- {walker → adam}/sso/authn_okta.py +39 -22
- adam/sso/cred_cache.py +60 -0
- adam/sso/id_token.py +23 -0
- adam/sso/idp.py +143 -0
- adam/sso/idp_login.py +50 -0
- adam/sso/idp_session.py +55 -0
- adam/sso/sso_config.py +63 -0
- adam/utils.py +679 -0
- adam/utils_app.py +98 -0
- adam/utils_athena.py +145 -0
- adam/utils_audits.py +106 -0
- adam/utils_issues.py +32 -0
- adam/utils_k8s/__init__.py +0 -0
- adam/utils_k8s/app_clusters.py +28 -0
- adam/utils_k8s/app_pods.py +33 -0
- adam/utils_k8s/cassandra_clusters.py +36 -0
- adam/utils_k8s/cassandra_nodes.py +33 -0
- adam/utils_k8s/config_maps.py +34 -0
- {walker/k8s_utils → adam/utils_k8s}/custom_resources.py +7 -2
- adam/utils_k8s/deployment.py +56 -0
- {walker/k8s_utils → adam/utils_k8s}/ingresses.py +3 -4
- {walker/k8s_utils → adam/utils_k8s}/jobs.py +3 -3
- adam/utils_k8s/k8s.py +87 -0
- {walker/k8s_utils → adam/utils_k8s}/kube_context.py +4 -4
- adam/utils_k8s/pods.py +290 -0
- {walker/k8s_utils → adam/utils_k8s}/secrets.py +8 -4
- adam/utils_k8s/service_accounts.py +170 -0
- {walker/k8s_utils → adam/utils_k8s}/services.py +3 -4
- {walker/k8s_utils → adam/utils_k8s}/statefulsets.py +6 -16
- {walker/k8s_utils → adam/utils_k8s}/volumes.py +10 -1
- adam/utils_net.py +24 -0
- adam/utils_repl/__init__.py +0 -0
- adam/utils_repl/automata_completer.py +48 -0
- adam/utils_repl/repl_completer.py +46 -0
- adam/utils_repl/state_machine.py +173 -0
- adam/utils_sqlite.py +109 -0
- adam/version.py +5 -0
- {kaqing-1.77.0.dist-info → kaqing-2.0.171.dist-info}/METADATA +1 -1
- kaqing-2.0.171.dist-info/RECORD +236 -0
- kaqing-2.0.171.dist-info/entry_points.txt +3 -0
- kaqing-2.0.171.dist-info/top_level.txt +1 -0
- kaqing-1.77.0.dist-info/RECORD +0 -159
- kaqing-1.77.0.dist-info/entry_points.txt +0 -3
- kaqing-1.77.0.dist-info/top_level.txt +0 -1
- walker/__init__.py +0 -3
- walker/app_session.py +0 -168
- walker/checks/check_utils.py +0 -97
- walker/columns/columns.py +0 -43
- walker/commands/add_user.py +0 -68
- walker/commands/app.py +0 -67
- walker/commands/bash.py +0 -87
- walker/commands/cd.py +0 -115
- walker/commands/check.py +0 -68
- walker/commands/command.py +0 -104
- walker/commands/cp.py +0 -95
- walker/commands/cql_utils.py +0 -53
- walker/commands/devices.py +0 -89
- walker/commands/frontend/code_stop.py +0 -57
- walker/commands/frontend/setup.py +0 -60
- walker/commands/frontend/setup_frontend.py +0 -58
- walker/commands/frontend/teardown.py +0 -61
- walker/commands/frontend/teardown_frontend.py +0 -42
- walker/commands/issues.py +0 -69
- walker/commands/login.py +0 -72
- walker/commands/ls.py +0 -145
- walker/commands/medusa/medusa.py +0 -69
- walker/commands/medusa/medusa_backup.py +0 -61
- walker/commands/medusa/medusa_restore.py +0 -86
- walker/commands/medusa/medusa_show_backupjobs.py +0 -52
- walker/commands/medusa/medusa_show_restorejobs.py +0 -52
- walker/commands/param_set.py +0 -44
- walker/commands/postgres/postgres.py +0 -113
- walker/commands/postgres/postgres_session.py +0 -225
- walker/commands/preview_table.py +0 -98
- walker/commands/processes.py +0 -53
- walker/commands/pwd.py +0 -64
- walker/commands/reaper/reaper.py +0 -78
- walker/commands/reaper/reaper_forward.py +0 -100
- walker/commands/reaper/reaper_run_abort.py +0 -65
- walker/commands/reaper/reaper_runs.py +0 -97
- walker/commands/reaper/reaper_runs_abort.py +0 -83
- walker/commands/reaper/reaper_schedule_activate.py +0 -64
- walker/commands/reaper/reaper_schedule_start.py +0 -64
- walker/commands/reaper/reaper_schedule_stop.py +0 -64
- walker/commands/reaper/reaper_session.py +0 -159
- walker/commands/repair/repair.py +0 -68
- walker/commands/repair/repair_run.py +0 -72
- walker/commands/repair/repair_scan.py +0 -79
- walker/commands/report.py +0 -57
- walker/commands/restart.py +0 -61
- walker/commands/show/show.py +0 -72
- walker/commands/show/show_app_actions.py +0 -53
- walker/commands/show/show_cassandra_status.py +0 -35
- walker/commands/show/show_commands.py +0 -58
- walker/commands/show/show_processes.py +0 -35
- walker/commands/show/show_repairs.py +0 -47
- walker/commands/status.py +0 -128
- walker/commands/storage.py +0 -52
- walker/commands/user_entry.py +0 -69
- walker/commands/watch.py +0 -85
- walker/embedded_params.py +0 -2
- walker/k8s_utils/cassandra_clusters.py +0 -48
- walker/k8s_utils/cassandra_nodes.py +0 -26
- walker/k8s_utils/pods.py +0 -211
- walker/repl.py +0 -165
- walker/repl_commands.py +0 -58
- walker/repl_state.py +0 -211
- walker/sso/authn_ad.py +0 -94
- walker/sso/idp.py +0 -150
- walker/sso/idp_login.py +0 -29
- walker/sso/sso_config.py +0 -45
- walker/utils.py +0 -194
- walker/version.py +0 -5
- {walker → adam}/checks/__init__.py +0 -0
- {walker → adam}/checks/check_context.py +0 -0
- {walker → adam}/checks/issue.py +0 -0
- {walker → adam}/cli_group.py +0 -0
- {walker → adam}/columns/__init__.py +0 -0
- {walker/commands → adam/commands/audit}/__init__.py +0 -0
- {walker/commands/frontend → adam/commands/cql}/__init__.py +0 -0
- {walker/commands/medusa → adam/commands/deploy}/__init__.py +0 -0
- {walker/commands/postgres → adam/commands/devices}/__init__.py +0 -0
- {walker/commands/reaper → adam/commands/export}/__init__.py +0 -0
- {walker/commands/repair → adam/commands/medusa}/__init__.py +0 -0
- {walker → adam}/commands/nodetool_commands.py +0 -0
- {walker/commands/show → adam/commands/postgres}/__init__.py +0 -0
- {walker/k8s_utils → adam/commands/reaper}/__init__.py +0 -0
- {walker/sso → adam/commands/repair}/__init__.py +0 -0
- /walker/medusa_show_restorejobs.py → /adam/commands/show/__init__.py +0 -0
- {walker → adam}/repl_session.py +0 -0
- {kaqing-1.77.0.dist-info → kaqing-2.0.171.dist-info}/WHEEL +0 -0
{walker → adam}/checks/disk.py
RENAMED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import re
|
|
2
2
|
from pathlib import Path
|
|
3
3
|
|
|
4
|
-
from
|
|
5
|
-
from
|
|
6
|
-
from
|
|
7
|
-
from
|
|
8
|
-
from
|
|
9
|
-
from
|
|
4
|
+
from adam.checks.check import Check
|
|
5
|
+
from adam.checks.check_context import CheckContext
|
|
6
|
+
from adam.checks.check_result import CheckResult
|
|
7
|
+
from adam.checks.issue import Issue
|
|
8
|
+
from adam.config import Config
|
|
9
|
+
from adam.utils_k8s.cassandra_nodes import CassandraNodes
|
|
10
10
|
|
|
11
11
|
class Disk(Check):
|
|
12
12
|
def name(self):
|
{walker → adam}/checks/gossip.py
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import re
|
|
2
2
|
|
|
3
|
-
from
|
|
4
|
-
from
|
|
5
|
-
from
|
|
6
|
-
from
|
|
7
|
-
from
|
|
3
|
+
from adam.checks.check import Check
|
|
4
|
+
from adam.checks.check_context import CheckContext
|
|
5
|
+
from adam.checks.check_result import CheckResult
|
|
6
|
+
from adam.checks.issue import Issue
|
|
7
|
+
from adam.utils_k8s.cassandra_nodes import CassandraNodes
|
|
8
8
|
|
|
9
9
|
class Gossip(Check):
|
|
10
10
|
def name(self):
|
{walker → adam}/checks/memory.py
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
from
|
|
2
|
-
from
|
|
3
|
-
from
|
|
4
|
-
from
|
|
5
|
-
from
|
|
6
|
-
from
|
|
7
|
-
from
|
|
1
|
+
from adam.checks.check import Check
|
|
2
|
+
from adam.checks.check_context import CheckContext
|
|
3
|
+
from adam.checks.check_result import CheckResult
|
|
4
|
+
from adam.checks.issue import Issue
|
|
5
|
+
from adam.utils_k8s.cassandra_nodes import CassandraNodes
|
|
6
|
+
from adam.utils_k8s.custom_resources import CustomResources
|
|
7
|
+
from adam.utils_k8s.pods import Pods
|
|
8
8
|
|
|
9
9
|
class Memory(Check):
|
|
10
10
|
def name(self):
|
{walker → adam}/checks/status.py
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import re
|
|
2
2
|
|
|
3
|
-
from
|
|
4
|
-
from
|
|
5
|
-
from
|
|
6
|
-
from
|
|
7
|
-
from
|
|
3
|
+
from adam.checks.check import Check
|
|
4
|
+
from adam.checks.check_context import CheckContext
|
|
5
|
+
from adam.checks.check_result import CheckResult
|
|
6
|
+
from adam.checks.issue import Issue
|
|
7
|
+
from adam.utils_k8s.cassandra_nodes import CassandraNodes
|
|
8
8
|
|
|
9
9
|
class Status(Check):
|
|
10
10
|
def name(self):
|
{walker → adam}/cli.py
RENAMED
|
@@ -4,9 +4,9 @@ import click
|
|
|
4
4
|
import click_completion
|
|
5
5
|
click_completion.init()
|
|
6
6
|
|
|
7
|
-
from
|
|
8
|
-
from
|
|
9
|
-
from
|
|
7
|
+
from adam import batch
|
|
8
|
+
from adam.cli_group import cli
|
|
9
|
+
from adam.utils import display_help
|
|
10
10
|
from . import __version__, repl
|
|
11
11
|
|
|
12
12
|
@cli.command()
|
adam/columns/columns.py
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
from adam.columns.column import Column
|
|
2
|
+
from adam.columns.compactions import Compactions
|
|
3
|
+
from adam.columns.cpu import Cpu
|
|
4
|
+
from adam.columns.cpu_metrics import CpuMetrics
|
|
5
|
+
from adam.columns.dir_data import DataDir
|
|
6
|
+
from adam.columns.dir_snapshots import SnapshotsDir
|
|
7
|
+
from adam.columns.gossip import Gossip
|
|
8
|
+
from adam.columns.host_id import HostId
|
|
9
|
+
from adam.columns.memory import Memory
|
|
10
|
+
from adam.columns.node_address import NodeAddress
|
|
11
|
+
from adam.columns.node_load import NodeLoad
|
|
12
|
+
from adam.columns.node_owns import NodeOwns
|
|
13
|
+
from adam.columns.node_status import NodeStatus
|
|
14
|
+
from adam.columns.node_tokens import NodeTokens
|
|
15
|
+
from adam.columns.pod_name import PodName
|
|
16
|
+
from adam.columns.volume_cassandra import CassandraVolume
|
|
17
|
+
from adam.columns.volume_root import RootVolume
|
|
18
|
+
|
|
19
|
+
def collect_checks(columns: list[Column]):
|
|
20
|
+
checks = sum([c.checks() for c in columns], [])
|
|
21
|
+
return {cc.name(): cc for cc in checks}.values()
|
|
22
|
+
|
|
23
|
+
class Columns:
|
|
24
|
+
COLUMNS_BY_NAME = None
|
|
25
|
+
|
|
26
|
+
def all_columns():
|
|
27
|
+
return [Compactions(), Cpu(), CpuMetrics(), DataDir(), SnapshotsDir(), Gossip(), HostId(), Memory(),
|
|
28
|
+
NodeAddress(), NodeLoad(), NodeOwns(), NodeStatus(),NodeTokens(), PodName(), CassandraVolume(), RootVolume()]
|
|
29
|
+
|
|
30
|
+
def columns_by_name():
|
|
31
|
+
return {c.name(): c.__class__ for c in Columns.all_columns()}
|
|
32
|
+
|
|
33
|
+
def create_columns(columns: str):
|
|
34
|
+
if not Columns.COLUMNS_BY_NAME:
|
|
35
|
+
Columns.COLUMNS_BY_NAME = Columns.columns_by_name()
|
|
36
|
+
|
|
37
|
+
cols = []
|
|
38
|
+
for name in columns.split(','):
|
|
39
|
+
name = name.strip(' ')
|
|
40
|
+
if not name in Columns.COLUMNS_BY_NAME:
|
|
41
|
+
return None
|
|
42
|
+
|
|
43
|
+
cols.append(Columns.COLUMNS_BY_NAME[name]())
|
|
44
|
+
|
|
45
|
+
return cols
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
from
|
|
2
|
-
from
|
|
3
|
-
from
|
|
4
|
-
from
|
|
5
|
-
from
|
|
1
|
+
from adam.checks.check_result import CheckResult
|
|
2
|
+
from adam.checks.compactionstats import CompactionStats
|
|
3
|
+
from adam.columns.column import Column
|
|
4
|
+
from adam.columns.host_id import HostId
|
|
5
|
+
from adam.columns.node_utils import merge_compactions
|
|
6
6
|
|
|
7
7
|
class Compactions(Column):
|
|
8
8
|
def name(self):
|
{walker → adam}/columns/cpu.py
RENAMED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
from
|
|
2
|
-
|
|
3
|
-
from
|
|
1
|
+
from kubernetes.utils.quantity import parse_quantity
|
|
2
|
+
|
|
3
|
+
from adam.checks.check_result import CheckResult
|
|
4
|
+
from adam.checks.cpu import Cpu as CpuCheck
|
|
5
|
+
from adam.columns.column import Column
|
|
4
6
|
|
|
5
7
|
class Cpu(Column):
|
|
6
8
|
def name(self):
|
|
@@ -14,4 +16,4 @@ class Cpu(Column):
|
|
|
14
16
|
cpu = r.details[CpuCheck().name()]
|
|
15
17
|
busy = 100.0 - float(cpu['idle'])
|
|
16
18
|
|
|
17
|
-
return f'{round(busy)}%'
|
|
19
|
+
return f'{round(busy)}%/{parse_quantity(cpu["limit"]) * 100}%'
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from kubernetes.utils.quantity import parse_quantity
|
|
2
|
+
|
|
3
|
+
from adam.checks.check_result import CheckResult
|
|
4
|
+
from adam.checks.cpu_metrics import CpuMetrics as CpuCheck
|
|
5
|
+
from adam.columns.column import Column
|
|
6
|
+
|
|
7
|
+
class CpuMetrics(Column):
|
|
8
|
+
def name(self):
|
|
9
|
+
return 'cpu-metrics'
|
|
10
|
+
|
|
11
|
+
def checks(self):
|
|
12
|
+
return [CpuCheck()]
|
|
13
|
+
|
|
14
|
+
def pod_value(self, check_results: list[CheckResult], pod_name: str):
|
|
15
|
+
r = self.result_by_pod(check_results, pod_name)
|
|
16
|
+
cpu = r.details[CpuCheck().name()]
|
|
17
|
+
|
|
18
|
+
cpu_decimal = parse_quantity(cpu['cpu'])
|
|
19
|
+
cpu_limit = parse_quantity(cpu['limit'])
|
|
20
|
+
business = cpu_decimal * 100 / cpu_limit
|
|
21
|
+
|
|
22
|
+
return f"{business:.2f}%({cpu_decimal}/{cpu_limit})"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
from
|
|
2
|
-
from
|
|
3
|
-
from
|
|
1
|
+
from adam.checks.check_result import CheckResult
|
|
2
|
+
from adam.checks.disk import Disk
|
|
3
|
+
from adam.columns.column import Column
|
|
4
4
|
|
|
5
5
|
class DataDir(Column):
|
|
6
6
|
def name(self):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
from
|
|
2
|
-
from
|
|
3
|
-
from
|
|
1
|
+
from adam.checks.check_result import CheckResult
|
|
2
|
+
from adam.checks.disk import Disk
|
|
3
|
+
from adam.columns.column import Column
|
|
4
4
|
|
|
5
5
|
class SnapshotsDir(Column):
|
|
6
6
|
def name(self):
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
from
|
|
2
|
-
from
|
|
3
|
-
from
|
|
4
|
-
from
|
|
5
|
-
from
|
|
1
|
+
from adam.checks.check_result import CheckResult
|
|
2
|
+
from adam.checks.status import Status
|
|
3
|
+
from adam.columns.column import Column
|
|
4
|
+
from adam.columns.host_id import HostId
|
|
5
|
+
from adam.columns.node_utils import merge_gossip
|
|
6
6
|
|
|
7
7
|
class Gossip(Column):
|
|
8
8
|
def name(self):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
from
|
|
2
|
-
from
|
|
3
|
-
from
|
|
1
|
+
from adam.checks.check_result import CheckResult
|
|
2
|
+
from adam.checks.status import Status
|
|
3
|
+
from adam.columns.column import Column
|
|
4
4
|
|
|
5
5
|
class HostId(Column):
|
|
6
6
|
def name(self):
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
from kubernetes.utils import parse_quantity
|
|
2
2
|
|
|
3
|
-
from
|
|
4
|
-
from
|
|
5
|
-
from
|
|
3
|
+
from adam.checks.check_result import CheckResult
|
|
4
|
+
from adam.checks.memory import Memory as MemoryCheck
|
|
5
|
+
from adam.columns.column import Column
|
|
6
6
|
|
|
7
7
|
class Memory(Column):
|
|
8
8
|
def name(self):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
from
|
|
2
|
-
from
|
|
3
|
-
from
|
|
1
|
+
from adam.checks.check_result import CheckResult
|
|
2
|
+
from adam.checks.status import Status
|
|
3
|
+
from adam.columns.column import Column
|
|
4
4
|
|
|
5
5
|
class NodeAddress(Column):
|
|
6
6
|
def name(self):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
from
|
|
2
|
-
from
|
|
3
|
-
from
|
|
1
|
+
from adam.checks.check_result import CheckResult
|
|
2
|
+
from adam.checks.status import Status
|
|
3
|
+
from adam.columns.column import Column
|
|
4
4
|
|
|
5
5
|
class NodeLoad(Column):
|
|
6
6
|
def name(self):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
from
|
|
2
|
-
from
|
|
3
|
-
from
|
|
1
|
+
from adam.checks.check_result import CheckResult
|
|
2
|
+
from adam.checks.status import Status
|
|
3
|
+
from adam.columns.column import Column
|
|
4
4
|
|
|
5
5
|
class NodeOwns(Column):
|
|
6
6
|
def name(self):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
from
|
|
2
|
-
from
|
|
3
|
-
from
|
|
1
|
+
from adam.checks.check_result import CheckResult
|
|
2
|
+
from adam.checks.status import Status
|
|
3
|
+
from adam.columns.column import Column
|
|
4
4
|
|
|
5
5
|
class NodeStatus(Column):
|
|
6
6
|
def name(self):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
from
|
|
2
|
-
from
|
|
3
|
-
from
|
|
1
|
+
from adam.checks.check_result import CheckResult
|
|
2
|
+
from adam.checks.status import Status
|
|
3
|
+
from adam.columns.column import Column
|
|
4
4
|
|
|
5
5
|
class NodeTokens(Column):
|
|
6
6
|
def name(self):
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
from
|
|
2
|
-
from
|
|
1
|
+
from adam.checks.check_result import CheckResult
|
|
2
|
+
from adam.checks.compactionstats import CompactionStats
|
|
3
3
|
|
|
4
4
|
def merge_gossip(check_results: list[CheckResult]):
|
|
5
5
|
hosts_with_gossip_issue = set()
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
from
|
|
2
|
-
from
|
|
3
|
-
from
|
|
4
|
-
from
|
|
1
|
+
from adam.checks.check_result import CheckResult
|
|
2
|
+
from adam.checks.disk import Disk
|
|
3
|
+
from adam.columns.column import Column
|
|
4
|
+
from adam.config import Config
|
|
5
5
|
|
|
6
6
|
class CassandraVolume(Column):
|
|
7
7
|
def name(self):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
from
|
|
2
|
-
from
|
|
3
|
-
from
|
|
1
|
+
from adam.checks.check_result import CheckResult
|
|
2
|
+
from adam.checks.disk import Disk
|
|
3
|
+
from adam.columns.column import Column
|
|
4
4
|
|
|
5
5
|
class RootVolume(Column):
|
|
6
6
|
def name(self):
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from adam.commands.command import ExtractAllOptionsHandler, ExtractOptionsHandler, ExtractTrailingOptionsHandler
|
|
2
|
+
from adam.repl_state import ReplState
|
|
3
|
+
from adam.utils_app import AppHandler
|
|
4
|
+
|
|
5
|
+
def app(state: ReplState) -> AppHandler:
|
|
6
|
+
return AppHandler(state)
|
|
7
|
+
|
|
8
|
+
def extract_options(args: list[str], options = None):
|
|
9
|
+
return ExtractOptionsHandler(args, options = options)
|
|
10
|
+
|
|
11
|
+
def extract_trailing_options(args: list[str], trailing = None):
|
|
12
|
+
return ExtractTrailingOptionsHandler(args, trailing = trailing)
|
|
13
|
+
|
|
14
|
+
def extract_all_options(args: list[str], trailing = None, options = None):
|
|
15
|
+
return ExtractAllOptionsHandler(args, trailing = trailing, options = options)
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
from adam.commands import extract_options
|
|
2
|
+
from adam.commands.command import Command
|
|
3
|
+
from adam.commands.cql.utils_cql import cassandra, cassandra_tables as get_tables
|
|
4
|
+
from adam.config import Config
|
|
5
|
+
from adam.repl_state import ReplState, RequiredState
|
|
6
|
+
from adam.utils import log2
|
|
7
|
+
|
|
8
|
+
class AlterTables(Command):
|
|
9
|
+
COMMAND = 'alter tables with'
|
|
10
|
+
|
|
11
|
+
# the singleton pattern
|
|
12
|
+
def __new__(cls, *args, **kwargs):
|
|
13
|
+
if not hasattr(cls, 'instance'): cls.instance = super(AlterTables, cls).__new__(cls)
|
|
14
|
+
|
|
15
|
+
return cls.instance
|
|
16
|
+
|
|
17
|
+
def __init__(self, successor: Command=None):
|
|
18
|
+
super().__init__(successor)
|
|
19
|
+
|
|
20
|
+
def required(self):
|
|
21
|
+
return RequiredState.CLUSTER
|
|
22
|
+
|
|
23
|
+
def command(self):
|
|
24
|
+
return AlterTables.COMMAND
|
|
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, '--include-reaper') as (args, include_reaper):
|
|
32
|
+
if not args:
|
|
33
|
+
if state.in_repl:
|
|
34
|
+
log2('Please enter gc grace in seconds. e.g. alter gc-grace-seconds 3600')
|
|
35
|
+
else:
|
|
36
|
+
log2('* gc grace second is missing.')
|
|
37
|
+
log2()
|
|
38
|
+
Command.display_help()
|
|
39
|
+
|
|
40
|
+
return 'missing-arg'
|
|
41
|
+
|
|
42
|
+
arg_str = ' '.join(args)
|
|
43
|
+
|
|
44
|
+
excludes = [e.strip(' \r\n') for e in Config().get(
|
|
45
|
+
'cql.alter-tables.excludes',
|
|
46
|
+
'system_auth,system_traces,reaper_db,system_distributed,system_views,system,system_schema,system_virtual_schema').split(',')]
|
|
47
|
+
batching = Config().get('cql.alter-tables.batching', True)
|
|
48
|
+
tables = get_tables(state, on_any=True)
|
|
49
|
+
for k, v in tables.items():
|
|
50
|
+
if k not in excludes or k == 'reaper_db' and include_reaper:
|
|
51
|
+
if batching:
|
|
52
|
+
# alter table <table_name> with GC_GRACE_SECONDS = <timeout>;
|
|
53
|
+
cql = ';\n'.join([f'alter table {k}.{t} with {arg_str}' for t in v])
|
|
54
|
+
try:
|
|
55
|
+
with cassandra(state) as pods:
|
|
56
|
+
pods.cql(cql, show_out=Config().is_debug(), show_query=not Config().is_debug(), on_any=True)
|
|
57
|
+
except Exception as e:
|
|
58
|
+
log2(e)
|
|
59
|
+
continue
|
|
60
|
+
else:
|
|
61
|
+
for t in v:
|
|
62
|
+
try:
|
|
63
|
+
# alter table <table_name> with GC_GRACE_SECONDS = <timeout>;
|
|
64
|
+
cql = f'alter table {k}.{t} with {arg_str}'
|
|
65
|
+
with cassandra(state) as pods:
|
|
66
|
+
pods.cql(show_out=Config().is_debug(), show_query=not Config().is_debug(), on_any=True)
|
|
67
|
+
except Exception as e:
|
|
68
|
+
log2(e)
|
|
69
|
+
continue
|
|
70
|
+
|
|
71
|
+
log2(f'{len(v)} tables altered in {k}.')
|
|
72
|
+
|
|
73
|
+
# do not continue to cql route
|
|
74
|
+
return state
|
|
75
|
+
|
|
76
|
+
def completion(self, _: ReplState) -> dict[str, any]:
|
|
77
|
+
# auto completion is taken care of by sql completer
|
|
78
|
+
return {}
|
|
79
|
+
|
|
80
|
+
def help(self, _: ReplState) -> str:
|
|
81
|
+
return f'{AlterTables.COMMAND} <param = value> [--include-reaper] \t alter schema on all tables'
|
adam/commands/app_cmd.py
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
from adam.commands import app, extract_options
|
|
2
|
+
from adam.commands.command import Command
|
|
3
|
+
from adam.repl_state import ReplState, RequiredState
|
|
4
|
+
|
|
5
|
+
class App(Command):
|
|
6
|
+
COMMAND = 'app'
|
|
7
|
+
|
|
8
|
+
# the singleton pattern
|
|
9
|
+
def __new__(cls, *args, **kwargs):
|
|
10
|
+
if not hasattr(cls, 'instance'): cls.instance = super(App, cls).__new__(cls)
|
|
11
|
+
|
|
12
|
+
return cls.instance
|
|
13
|
+
|
|
14
|
+
def __init__(self, successor: Command=None):
|
|
15
|
+
super().__init__(successor)
|
|
16
|
+
|
|
17
|
+
def command(self):
|
|
18
|
+
return App.COMMAND
|
|
19
|
+
|
|
20
|
+
def required(self):
|
|
21
|
+
return RequiredState.APP_APP
|
|
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
|
+
with extract_options(args, '--force') as (args, forced):
|
|
29
|
+
with app(state) as http:
|
|
30
|
+
http.post(args, forced=forced)
|
|
31
|
+
|
|
32
|
+
return state
|
|
33
|
+
|
|
34
|
+
def completion(self, state: ReplState):
|
|
35
|
+
return super().completion(state, {'--force': None})
|
|
36
|
+
|
|
37
|
+
def help(self, _: ReplState):
|
|
38
|
+
return f"<AppType>.<AppAction> <args> [--force]\t post app action; check with 'show app actions' command"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
from
|
|
2
|
-
from
|
|
3
|
-
from
|
|
1
|
+
from adam.commands import app, extract_options
|
|
2
|
+
from adam.commands.command import Command
|
|
3
|
+
from adam.repl_state import ReplState, RequiredState
|
|
4
4
|
|
|
5
5
|
class AppPing(Command):
|
|
6
6
|
COMMAND = 'app ping'
|
|
@@ -18,27 +18,21 @@ class AppPing(Command):
|
|
|
18
18
|
return AppPing.COMMAND
|
|
19
19
|
|
|
20
20
|
def required(self):
|
|
21
|
-
return RequiredState.
|
|
21
|
+
return RequiredState.APP_APP
|
|
22
22
|
|
|
23
23
|
def run(self, cmd: str, state: ReplState):
|
|
24
24
|
if not(args := self.args(cmd)):
|
|
25
25
|
return super().run(cmd, state)
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
with self.validate(args, state) as (args, state):
|
|
28
|
+
with extract_options(args, '--force') as (args, forced):
|
|
29
|
+
with app(state) as http:
|
|
30
|
+
http.post(['Echo.echoStatic'], forced=forced)
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
AppSession.run(state.app_env, state.app_app, state.namespace, 'Echo', 'echoStatic', forced= forced)
|
|
34
|
-
|
|
35
|
-
return state
|
|
32
|
+
return state
|
|
36
33
|
|
|
37
34
|
def completion(self, state: ReplState):
|
|
38
|
-
|
|
39
|
-
return super().completion(state, {'--force': None})
|
|
40
|
-
|
|
41
|
-
return {}
|
|
35
|
+
return super().completion(state, {'--force': None})
|
|
42
36
|
|
|
43
37
|
def help(self, _: ReplState):
|
|
44
38
|
return f"{AppPing.COMMAND} [--force]\t ping app server with Echo.echoStatic()"
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import click
|
|
2
|
+
|
|
3
|
+
from adam.commands.audit.audit_repair_tables import AuditRepairTables
|
|
4
|
+
from adam.commands.audit.audit_run import AuditRun
|
|
5
|
+
from adam.commands.audit.show_last10 import ShowLast10
|
|
6
|
+
from adam.commands.audit.show_slow10 import ShowSlow10
|
|
7
|
+
from adam.commands.audit.show_top10 import ShowTop10
|
|
8
|
+
from adam.commands.audit.utils_show_top10 import show_top10_completions_for_nesting
|
|
9
|
+
from adam.commands.command import Command
|
|
10
|
+
from adam.commands.intermediate_command import IntermediateCommand
|
|
11
|
+
from adam.repl_state import ReplState
|
|
12
|
+
from adam.sql.sql_completer import SqlCompleter, SqlVariant
|
|
13
|
+
from adam.utils import log2, wait_log
|
|
14
|
+
from adam.utils_athena import Athena
|
|
15
|
+
|
|
16
|
+
class Audit(IntermediateCommand):
|
|
17
|
+
COMMAND = 'audit'
|
|
18
|
+
|
|
19
|
+
# the singleton pattern
|
|
20
|
+
def __new__(cls, *args, **kwargs):
|
|
21
|
+
if not hasattr(cls, 'instance'): cls.instance = super(Audit, cls).__new__(cls)
|
|
22
|
+
|
|
23
|
+
return cls.instance
|
|
24
|
+
|
|
25
|
+
def __init__(self, successor: Command=None):
|
|
26
|
+
super().__init__(successor)
|
|
27
|
+
self.schema_read = False
|
|
28
|
+
|
|
29
|
+
def command(self):
|
|
30
|
+
return Audit.COMMAND
|
|
31
|
+
|
|
32
|
+
def required(self):
|
|
33
|
+
return ReplState.L
|
|
34
|
+
|
|
35
|
+
def run(self, cmd: str, state: ReplState):
|
|
36
|
+
if not(args := self.args(cmd)):
|
|
37
|
+
return super().run(cmd, state)
|
|
38
|
+
|
|
39
|
+
with self.validate(args, state) as (args, state):
|
|
40
|
+
r = None
|
|
41
|
+
if len(args) > 0:
|
|
42
|
+
r = self.intermediate_run(cmd, state, args, self.cmd_list(), display_help=False)
|
|
43
|
+
|
|
44
|
+
if not r or isinstance(r, str) and r == 'command-missing':
|
|
45
|
+
sql = 'select * from audit order by ts desc limit 10'
|
|
46
|
+
if args:
|
|
47
|
+
sql = ' '.join(args)
|
|
48
|
+
else:
|
|
49
|
+
log2(sql)
|
|
50
|
+
|
|
51
|
+
Athena.run_query(sql)
|
|
52
|
+
|
|
53
|
+
return state
|
|
54
|
+
|
|
55
|
+
def completion(self, state: ReplState):
|
|
56
|
+
if state.device == ReplState.L:
|
|
57
|
+
if not self.schema_read:
|
|
58
|
+
wait_log(f'Inspecting audit database schema...')
|
|
59
|
+
self.schema_read = True
|
|
60
|
+
# warm up the caches first time when l: drive is accessed
|
|
61
|
+
Athena.table_names()
|
|
62
|
+
Athena.column_names()
|
|
63
|
+
Athena.column_names(partition_cols_only=True)
|
|
64
|
+
|
|
65
|
+
return super().completion(state) | show_top10_completions_for_nesting() | SqlCompleter(
|
|
66
|
+
lambda: Athena.table_names(),
|
|
67
|
+
expandables={
|
|
68
|
+
'columns': lambda table: Athena.column_names(),
|
|
69
|
+
'partition_columns': lambda table: Athena.column_names(partition_cols_only=True)
|
|
70
|
+
},
|
|
71
|
+
variant=SqlVariant.ATHENA
|
|
72
|
+
).completions_for_nesting()
|
|
73
|
+
|
|
74
|
+
return {}
|
|
75
|
+
|
|
76
|
+
def cmd_list(self):
|
|
77
|
+
return [AuditRepairTables(), AuditRun(), ShowLast10(), ShowSlow10(), ShowTop10()]
|
|
78
|
+
|
|
79
|
+
def help(self, _: ReplState):
|
|
80
|
+
return f'[{Audit.COMMAND}] [<sql-statements>]\t run SQL queries on Authena audit database'
|
|
81
|
+
|
|
82
|
+
class AuditCommandHelper(click.Command):
|
|
83
|
+
def get_help(self, ctx: click.Context):
|
|
84
|
+
IntermediateCommand.intermediate_help(super().get_help(ctx), Audit.COMMAND, Audit().cmd_list(), show_cluster_help=False)
|