kaqing 2.0.94__tar.gz → 2.0.96__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.
Potentially problematic release.
This version of kaqing might be problematic. Click here for more details.
- {kaqing-2.0.94 → kaqing-2.0.96}/PKG-INFO +1 -1
- kaqing-2.0.96/adam/commands/audit/audit_repair_tables.py +94 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/ls.py +1 -1
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/config.py +1 -1
- kaqing-2.0.96/adam/embedded_params.py +2 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/repl.py +2 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/utils_k8s/pods.py +10 -8
- kaqing-2.0.96/adam/version.py +5 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/kaqing.egg-info/PKG-INFO +1 -1
- {kaqing-2.0.94 → kaqing-2.0.96}/setup.py +1 -1
- kaqing-2.0.94/adam/commands/audit/audit_repair_tables.py +0 -42
- kaqing-2.0.94/adam/embedded_params.py +0 -2
- kaqing-2.0.94/adam/version.py +0 -5
- {kaqing-2.0.94 → kaqing-2.0.96}/README +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/__init__.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/app_session.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/apps.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/batch.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/checks/__init__.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/checks/check.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/checks/check_context.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/checks/check_result.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/checks/check_utils.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/checks/compactionstats.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/checks/cpu.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/checks/disk.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/checks/gossip.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/checks/issue.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/checks/memory.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/checks/status.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/cli.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/cli_group.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/columns/__init__.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/columns/column.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/columns/columns.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/columns/compactions.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/columns/cpu.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/columns/dir_data.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/columns/dir_snapshots.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/columns/gossip.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/columns/host_id.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/columns/memory.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/columns/node_address.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/columns/node_load.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/columns/node_owns.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/columns/node_status.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/columns/node_tokens.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/columns/node_utils.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/columns/pod_name.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/columns/volume_cassandra.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/columns/volume_root.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/__init__.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/alter_tables.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/app.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/app_ping.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/audit/__init__.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/audit/audit.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/bash.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/cd.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/check.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/cli_commands.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/command.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/command_helpers.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/commands_utils.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/cp.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/cql/__init__.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/cql/cql_completions.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/cql/cql_table_completer.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/cql/cql_utils.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/cql/cqlsh.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/deploy/__init__.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/deploy/code_start.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/deploy/code_stop.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/deploy/code_utils.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/deploy/deploy.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/deploy/deploy_frontend.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/deploy/deploy_pg_agent.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/deploy/deploy_pod.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/deploy/deploy_utils.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/deploy/undeploy.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/deploy/undeploy_frontend.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/deploy/undeploy_pg_agent.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/deploy/undeploy_pod.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/describe/__init__.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/describe/describe.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/describe/describe_keyspace.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/describe/describe_keyspaces.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/describe/describe_table.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/describe/describe_tables.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/devices.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/exit.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/help.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/issues.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/login.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/logs.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/medusa/__init__.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/medusa/medusa.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/medusa/medusa_backup.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/medusa/medusa_restore.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/medusa/medusa_show_backupjobs.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/medusa/medusa_show_restorejobs.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/nodetool.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/nodetool_commands.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/param_get.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/param_set.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/postgres/__init__.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/postgres/postgres.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/postgres/postgres_ls.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/postgres/postgres_preview.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/postgres/postgres_session.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/postgres/postgres_utils.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/postgres/psql_completions.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/postgres/psql_table_completer.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/preview_table.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/pwd.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/reaper/__init__.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/reaper/reaper.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/reaper/reaper_forward.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/reaper/reaper_forward_stop.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/reaper/reaper_restart.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/reaper/reaper_run_abort.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/reaper/reaper_runs.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/reaper/reaper_runs_abort.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/reaper/reaper_schedule_activate.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/reaper/reaper_schedule_start.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/reaper/reaper_schedule_stop.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/reaper/reaper_schedules.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/reaper/reaper_session.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/reaper/reaper_status.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/repair/__init__.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/repair/repair.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/repair/repair_log.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/repair/repair_run.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/repair/repair_scan.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/repair/repair_stop.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/report.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/restart.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/rollout.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/shell.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/show/__init__.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/show/show.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/show/show_adam.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/show/show_app_actions.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/show/show_app_id.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/show/show_app_queues.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/show/show_cassandra_status.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/show/show_cassandra_version.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/show/show_commands.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/show/show_host.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/show/show_login.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/show/show_params.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/show/show_processes.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/show/show_repairs.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/show/show_storage.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/commands/watch.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/embedded_apps.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/log.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/pod_exec_result.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/repl_commands.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/repl_session.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/repl_state.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/sql/__init__.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/sql/sql_completer.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/sql/state_machine.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/sql/term_completer.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/sso/__init__.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/sso/authenticator.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/sso/authn_ad.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/sso/authn_okta.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/sso/cred_cache.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/sso/id_token.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/sso/idp.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/sso/idp_login.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/sso/idp_session.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/sso/sso_config.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/utils.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/utils_athena.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/utils_k8s/__init__.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/utils_k8s/cassandra_clusters.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/utils_k8s/cassandra_nodes.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/utils_k8s/config_maps.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/utils_k8s/custom_resources.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/utils_k8s/deployment.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/utils_k8s/ingresses.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/utils_k8s/jobs.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/utils_k8s/kube_context.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/utils_k8s/secrets.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/utils_k8s/service_accounts.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/utils_k8s/services.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/utils_k8s/statefulsets.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/utils_k8s/volumes.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/adam/utils_net.py +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/kaqing.egg-info/SOURCES.txt +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/kaqing.egg-info/dependency_links.txt +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/kaqing.egg-info/entry_points.txt +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/kaqing.egg-info/top_level.txt +0 -0
- {kaqing-2.0.94 → kaqing-2.0.96}/setup.cfg +0 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import concurrent
|
|
2
|
+
import time
|
|
3
|
+
import requests
|
|
4
|
+
|
|
5
|
+
from adam.commands.command import Command
|
|
6
|
+
from adam.config import Config
|
|
7
|
+
from adam.repl_state import ReplState
|
|
8
|
+
from adam.utils import log, log2
|
|
9
|
+
from adam.utils_athena import audit_query, run_audit_query
|
|
10
|
+
|
|
11
|
+
class AuditRepairTables(Command):
|
|
12
|
+
COMMAND = 'audit repair'
|
|
13
|
+
|
|
14
|
+
# the singleton pattern
|
|
15
|
+
def __new__(cls, *args, **kwargs):
|
|
16
|
+
if not hasattr(cls, 'instance'): cls.instance = super(AuditRepairTables, cls).__new__(cls)
|
|
17
|
+
|
|
18
|
+
return cls.instance
|
|
19
|
+
|
|
20
|
+
def __init__(self, successor: Command=None):
|
|
21
|
+
super().__init__(successor)
|
|
22
|
+
self.auto_repaired = False
|
|
23
|
+
|
|
24
|
+
def command(self):
|
|
25
|
+
return AuditRepairTables.COMMAND
|
|
26
|
+
|
|
27
|
+
def run(self, cmd: str, state: ReplState):
|
|
28
|
+
if not(args := self.args(cmd)):
|
|
29
|
+
return super().run(cmd, state)
|
|
30
|
+
|
|
31
|
+
state, args = self.apply_state(args, state)
|
|
32
|
+
|
|
33
|
+
tables = Config().get('audit.tables', 'audit').split(',')
|
|
34
|
+
if args:
|
|
35
|
+
tables = args
|
|
36
|
+
|
|
37
|
+
self.repair(tables)
|
|
38
|
+
|
|
39
|
+
return state
|
|
40
|
+
|
|
41
|
+
def completion(self, state: ReplState):
|
|
42
|
+
if state.device == ReplState.L:
|
|
43
|
+
if not self.auto_repaired:
|
|
44
|
+
if hours := Config().get('audit.athena.auto-repair.elapsed_hours', 12):
|
|
45
|
+
with concurrent.futures.ThreadPoolExecutor(max_workers=Config().get('audit.workers', 3)) as executor:
|
|
46
|
+
executor.submit(self.auto_repair, hours,)
|
|
47
|
+
|
|
48
|
+
return super().completion(state)
|
|
49
|
+
|
|
50
|
+
return {}
|
|
51
|
+
|
|
52
|
+
def auto_repair(self, hours: int):
|
|
53
|
+
self.auto_repaired = True
|
|
54
|
+
|
|
55
|
+
state, _, rs = audit_query(f'select * from meta')
|
|
56
|
+
if state == 'SUCCEEDED':
|
|
57
|
+
do_repair = True
|
|
58
|
+
if len(rs) > 1:
|
|
59
|
+
try:
|
|
60
|
+
checked_in = float(rs[1]['Data'][0]['VarCharValue'])
|
|
61
|
+
do_repair = checked_in + hours * 60 * 60 < time.time()
|
|
62
|
+
except:
|
|
63
|
+
pass
|
|
64
|
+
|
|
65
|
+
if do_repair:
|
|
66
|
+
tables = Config().get('audit.athena.tables', 'audit').split(',')
|
|
67
|
+
self.repair(tables, show_sql=True)
|
|
68
|
+
log2(f'Audit tables have been auto-repaired.')
|
|
69
|
+
|
|
70
|
+
def repair(self, tables: list[str], show_sql = False):
|
|
71
|
+
with concurrent.futures.ThreadPoolExecutor(max_workers=Config().get('audit.workers', 3)) as executor:
|
|
72
|
+
for table in tables:
|
|
73
|
+
if show_sql:
|
|
74
|
+
log(f'MSCK REPAIR TABLE {table}')
|
|
75
|
+
|
|
76
|
+
executor.submit(run_audit_query, f'MSCK REPAIR TABLE {table}', None,)
|
|
77
|
+
executor.submit(self.check_in,)
|
|
78
|
+
|
|
79
|
+
def help(self, _: ReplState):
|
|
80
|
+
return f"{AuditRepairTables.COMMAND} \t run MSCK REPAIR command for new partition discovery"
|
|
81
|
+
|
|
82
|
+
def check_in(self):
|
|
83
|
+
payload = {
|
|
84
|
+
'action': 'check-in'
|
|
85
|
+
}
|
|
86
|
+
audit_endpoint = Config().get("audit.endpoint", "https://4psvtaxlcb.execute-api.us-west-2.amazonaws.com/prod/")
|
|
87
|
+
try:
|
|
88
|
+
response = requests.post(audit_endpoint, json=payload, timeout=Config().get("audit.timeout", 10))
|
|
89
|
+
if response.status_code in [200, 201]:
|
|
90
|
+
Config().debug(response.text)
|
|
91
|
+
else:
|
|
92
|
+
log2(f"Error: {response.status_code} {response.text}")
|
|
93
|
+
except requests.exceptions.Timeout as e:
|
|
94
|
+
log2(f"Timeout occurred: {e}")
|
|
@@ -39,7 +39,7 @@ class Config:
|
|
|
39
39
|
return get_deep_keys(self.params)
|
|
40
40
|
|
|
41
41
|
def is_debug(self):
|
|
42
|
-
return os.getenv('QING_DEV').lower() == 'true' or Config().get('debug', False)
|
|
42
|
+
return os.getenv('QING_DEV', 'false').lower() == 'true' or Config().get('debug', False)
|
|
43
43
|
|
|
44
44
|
def debug(self, s: None):
|
|
45
45
|
if self.is_debug():
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
def config():
|
|
2
|
+
return {'app': {'console-endpoint': 'https://{host}/{env}/{app}/static/console/index.html', 'cr': {'cluster-regex': '(.*?-.*?)-.*', 'group': 'ops.c3.ai', 'v': 'v2', 'plural': 'c3cassandras'}, 'label': 'c3__app_id-0', 'login': {'admin-group': '{host}/C3.ClusterAdmin', 'ingress': '{app_id}-k8singr-appleader-001', 'timeout': 5, 'session-check-url': 'https://{host}/{env}/{app}/api/8/C3/userSessionToken', 'cache-creds': True, 'cache-username': True, 'url': 'https://{host}/{env}/{app}', 'another': "You're logged in to {has}. However, for this app, you need to log in to {need}.", 'token-server-url': 'http://localhost:{port}', 'password-max-length': 128}, 'strip': '0'}, 'audit': {'endpoint': 'https://4psvtaxlcb.execute-api.us-west-2.amazonaws.com/prod/', 'workers': 3, 'timeout': 10, 'log-audit-queries': False, 'athena': {'auto-repair': {'elapsed_hours': 12}, 'region': 'us-west-2', 'catalog': 'AwsDataCatalog', 'database': 'audit', 'tables': 'audit', 'output': 's3://s3.ops--audit/ddl/results'}}, 'bash': {'workers': 32}, 'cassandra': {'service-name': 'all-pods-service'}, 'cql': {'workers': 32, 'samples': 3, 'secret': {'cluster-regex': '(.*?-.*?)-.*', 'name': '{cluster}-superuser', 'password-item': 'password'}, 'alter-tables': {'excludes': 'system_auth,system_traces,reaper_db,system_distributed,system_views,system,system_schema,system_virtual_schema', 'gc-grace-periods': '3600,86400,864000,7776000', 'batching': True}}, 'checks': {'compactions-threshold': 250, 'cpu-busy-threshold': 98.0, 'cpu-threshold': 0.0, 'cassandra-data-path': '/c3/cassandra', 'root-disk-threshold': 50, 'cassandra-disk-threshold': 50, '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}'", 'snapshot-size-threshold': '40G', 'table-sizes-cmd': "ls -Al /c3/cassandra/data/data/ | awk '{print $9}' | sed 's/\\^r//g' | xargs -I {} du -sk /c3/cassandra/data/data/{}"}, 'get-host-id': {'workers': 32}, 'idps': {'ad': {'email-pattern': '.*@c3.ai', 'uri': 'https://login.microsoftonline.com/53ad779a-93e7-485c-ba20-ac8290d7252b/oauth2/v2.0/authorize?response_type=id_token&response_mode=form_post&client_id=00ff94a8-6b0a-4715-98e0-95490012d818&scope=openid+email+profile&redirect_uri=https%3A%2F%2Fplat.c3ci.cloud%2Fc3%2Fc3%2Foidc%2Flogin&nonce={nonce}&state=EMPTY', 'jwks-uri': 'https://login.microsoftonline.com/common/discovery/keys', 'contact': 'Please contact ted.tran@c3.ai.', 'whitelist-file': '/kaqing/members'}, 'okta': {'default': True, 'email-pattern': '.*@c3iot.com', 'uri': 'https://c3energy.okta.com/oauth2/v1/authorize?response_type=id_token&response_mode=form_post&client_id={client_id}&scope=openid+email+profile+groups&redirect_uri=https%3A%2F%2F{host}%2Fc3%2Fc3%2Foidc%2Flogin&nonce={nonce}&state=EMPTY', 'jwks-uri': 'https://c3energy.okta.com/oauth2/v1/keys'}}, 'issues': {'workers': 32}, 'logs': {'path': '/c3/cassandra/logs/system.log'}, 'medusa': {'restore-auto-complete': False}, 'nodetool': {'workers': 32, 'samples': 3, 'commands_in_line': 40}, 'pg': {'name-pattern': '^{namespace}.*-k8spg-.*', 'excludes': '.helm., -admin-secret', 'agent': {'name': 'ops-pg-agent', 'just-in-time': False, 'timeout': 86400, 'image': 'seanahnsf/kaqing'}, 'default-db': 'postgres', 'default-schema': 'postgres', 'secret': {'endpoint-key': 'postgres-db-endpoint', 'port-key': 'postgres-db-port', 'username-key': 'postgres-admin-username', 'password-key': 'postgres-admin-password'}}, 'pod': {'name': 'ops', 'image': 'seanahnsf/kaqing-cloud', 'sa': {'name': 'ops', 'proto': 'c3', 'additional-cluster-roles': 'c3aiops-k8ssandra-operator'}, 'label-selector': 'run=ops'}, 'preview': {'rows': 10}, 'processes': {'columns': 'pod,cpu,mem', 'header': 'POD_NAME,CPU,MEM/LIMIT'}, 'reaper': {'service-name': 'reaper-service', 'port-forward': {'timeout': 86400, 'local-port': 9001}, 'abort-runs-batch': 10, 'show-runs-batch': 100, 'pod': {'cluster-regex': '(.*?-.*?-.*?-.*?)-.*', 'label-selector': 'k8ssandra.io/reaper={cluster}-reaper'}, 'secret': {'cluster-regex': '(.*?-.*?)-.*', 'name': '{cluster}-reaper-ui', 'password-item': 'password'}}, 'repair': {'log-path': '/home/cassrepair/logs/', 'image': 'ci-registry.c3iot.io/cloudops/cassrepair:2.0.14', 'secret': 'ciregistryc3iotio', 'env': {'interval': 24, 'timeout': 60, 'pr': False, 'runs': 1}}, 'repl': {'start-drive': 'a', 'auto-enter-app': 'c3/c3', 'auto-enter-only-cluster': 'cluster', 'history': {'push-cat-remote-log-file': True}, 'background-process': {'auto-nohup': True}}, 'status': {'columns': 'status,address,load,tokens,owns,host_id,gossip,compactions', 'header': '--,Address,Load,Tokens,Owns,Host ID,GOSSIP,COMPACTIONS'}, 'storage': {'columns': 'pod,volume_root,volume_cassandra,snapshots,data,compactions', 'header': 'POD_NAME,VOLUME /,VOLUME CASS,SNAPSHOTS,DATA,COMPACTIONS'}, 'watch': {'auto': 'rollout', 'timeout': 3600, 'interval': 10}, 'debug': False, 'debugs': {'timings': False, 'exit-on-error': False, 'show-parallelism': False}}
|
|
@@ -94,6 +94,8 @@ def enter_repl(state: ReplState):
|
|
|
94
94
|
Config().wait_log(f'Moving to {state.app_env}/{state.app_app}...')
|
|
95
95
|
else:
|
|
96
96
|
Config().wait_log(f'Moving to {state.app_env}...')
|
|
97
|
+
elif state.device == ReplState.P:
|
|
98
|
+
Config().wait_log('Inspecting postgres database instances...')
|
|
97
99
|
|
|
98
100
|
kb = KeyBindings()
|
|
99
101
|
|
|
@@ -107,17 +107,19 @@ class Pods:
|
|
|
107
107
|
tty = True
|
|
108
108
|
exec_command = [shell, '-c', command]
|
|
109
109
|
if command.endswith(' &'):
|
|
110
|
-
command = command.strip(' &')
|
|
111
|
-
cmd_name = ''
|
|
112
|
-
if command.startswith('nodetool '):
|
|
113
|
-
cmd_name = f".{'_'.join(command.split(' ')[5:])}"
|
|
114
|
-
|
|
115
|
-
log_file = f'/tmp/qing-{datetime.now().strftime("%d%H%M%S")}{cmd_name}.log'
|
|
116
|
-
command = f"nohup {command} > {log_file} 2>&1 &"
|
|
117
|
-
exec_command = [shell, '-c', command]
|
|
118
110
|
# should be false for starting a backgroud process
|
|
119
111
|
tty = False
|
|
120
112
|
|
|
113
|
+
if Config().get('repl.background-process.auto-nohup', True):
|
|
114
|
+
command = command.strip(' &')
|
|
115
|
+
cmd_name = ''
|
|
116
|
+
if command.startswith('nodetool '):
|
|
117
|
+
cmd_name = f".{'_'.join(command.split(' ')[5:])}"
|
|
118
|
+
|
|
119
|
+
log_file = f'/tmp/qing-{datetime.now().strftime("%d%H%M%S")}{cmd_name}.log'
|
|
120
|
+
command = f"nohup {command} > {log_file} 2>&1 &"
|
|
121
|
+
exec_command = [shell, '-c', command]
|
|
122
|
+
|
|
121
123
|
k_command = f'kubectl exec {pod_name} -c {container} -n {namespace} -- {shell} -c "{command}"'
|
|
122
124
|
if show_out:
|
|
123
125
|
print(k_command)
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
from adam.commands.command import Command
|
|
2
|
-
from adam.repl_state import ReplState
|
|
3
|
-
from adam.utils_athena import run_audit_query
|
|
4
|
-
|
|
5
|
-
class AuditRepairTables(Command):
|
|
6
|
-
COMMAND = 'audit repair'
|
|
7
|
-
|
|
8
|
-
# the singleton pattern
|
|
9
|
-
def __new__(cls, *args, **kwargs):
|
|
10
|
-
if not hasattr(cls, 'instance'): cls.instance = super(AuditRepairTables, 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 AuditRepairTables.COMMAND
|
|
19
|
-
|
|
20
|
-
def run(self, cmd: str, state: ReplState):
|
|
21
|
-
if not(args := self.args(cmd)):
|
|
22
|
-
return super().run(cmd, state)
|
|
23
|
-
|
|
24
|
-
state, args = self.apply_state(args, state)
|
|
25
|
-
|
|
26
|
-
tables = ['audit']
|
|
27
|
-
if args:
|
|
28
|
-
tables = args
|
|
29
|
-
|
|
30
|
-
for table in tables:
|
|
31
|
-
run_audit_query(f'MSCK REPAIR TABLE {table}')
|
|
32
|
-
|
|
33
|
-
return state
|
|
34
|
-
|
|
35
|
-
def completion(self, state: ReplState):
|
|
36
|
-
if state.device == ReplState.L:
|
|
37
|
-
return super().completion(state)
|
|
38
|
-
|
|
39
|
-
return {}
|
|
40
|
-
|
|
41
|
-
def help(self, _: ReplState):
|
|
42
|
-
return f"{AuditRepairTables.COMMAND} \t run MSCK REPAIR command for new partition discovery"
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
def config():
|
|
2
|
-
return {'app': {'console-endpoint': 'https://{host}/{env}/{app}/static/console/index.html', 'cr': {'cluster-regex': '(.*?-.*?)-.*', 'group': 'ops.c3.ai', 'v': 'v2', 'plural': 'c3cassandras'}, 'label': 'c3__app_id-0', 'login': {'admin-group': '{host}/C3.ClusterAdmin', 'ingress': '{app_id}-k8singr-appleader-001', 'timeout': 5, 'session-check-url': 'https://{host}/{env}/{app}/api/8/C3/userSessionToken', 'cache-creds': True, 'cache-username': True, 'url': 'https://{host}/{env}/{app}', 'another': "You're logged in to {has}. However, for this app, you need to log in to {need}.", 'token-server-url': 'http://localhost:{port}', 'password-max-length': 128}, 'strip': '0'}, 'audit': {'endpoint': 'https://4psvtaxlcb.execute-api.us-west-2.amazonaws.com/prod/', 'workers': 3, 'timeout': 10, 'log-audit-queries': False, 'athena': {'region': 'us-west-2', 'catalog': 'AwsDataCatalog', 'database': 'audit', 'tables': 'audit', 'output': 's3://s3.ops--audit/ddl/results'}}, 'bash': {'workers': 32}, 'cassandra': {'service-name': 'all-pods-service'}, 'cql': {'workers': 32, 'samples': 3, 'secret': {'cluster-regex': '(.*?-.*?)-.*', 'name': '{cluster}-superuser', 'password-item': 'password'}, 'alter-tables': {'excludes': 'system_auth,system_traces,reaper_db,system_distributed,system_views,system,system_schema,system_virtual_schema', 'gc-grace-periods': '3600,86400,864000,7776000', 'batching': True}}, 'checks': {'compactions-threshold': 250, 'cpu-busy-threshold': 98.0, 'cpu-threshold': 0.0, 'cassandra-data-path': '/c3/cassandra', 'root-disk-threshold': 50, 'cassandra-disk-threshold': 50, '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}'", 'snapshot-size-threshold': '40G', 'table-sizes-cmd': "ls -Al /c3/cassandra/data/data/ | awk '{print $9}' | sed 's/\\^r//g' | xargs -I {} du -sk /c3/cassandra/data/data/{}"}, 'get-host-id': {'workers': 32}, 'idps': {'ad': {'email-pattern': '.*@c3.ai', 'uri': 'https://login.microsoftonline.com/53ad779a-93e7-485c-ba20-ac8290d7252b/oauth2/v2.0/authorize?response_type=id_token&response_mode=form_post&client_id=00ff94a8-6b0a-4715-98e0-95490012d818&scope=openid+email+profile&redirect_uri=https%3A%2F%2Fplat.c3ci.cloud%2Fc3%2Fc3%2Foidc%2Flogin&nonce={nonce}&state=EMPTY', 'jwks-uri': 'https://login.microsoftonline.com/common/discovery/keys', 'contact': 'Please contact ted.tran@c3.ai.', 'whitelist-file': '/kaqing/members'}, 'okta': {'default': True, 'email-pattern': '.*@c3iot.com', 'uri': 'https://c3energy.okta.com/oauth2/v1/authorize?response_type=id_token&response_mode=form_post&client_id={client_id}&scope=openid+email+profile+groups&redirect_uri=https%3A%2F%2F{host}%2Fc3%2Fc3%2Foidc%2Flogin&nonce={nonce}&state=EMPTY', 'jwks-uri': 'https://c3energy.okta.com/oauth2/v1/keys'}}, 'issues': {'workers': 32}, 'logs': {'path': '/c3/cassandra/logs/system.log'}, 'medusa': {'restore-auto-complete': False}, 'nodetool': {'workers': 32, 'samples': 3, 'commands_in_line': 40}, 'pg': {'name-pattern': '^{namespace}.*-k8spg-.*', 'excludes': '.helm., -admin-secret', 'agent': {'name': 'ops-pg-agent', 'just-in-time': False, 'timeout': 86400, 'image': 'seanahnsf/kaqing'}, 'default-db': 'postgres', 'default-schema': 'postgres', 'secret': {'endpoint-key': 'postgres-db-endpoint', 'port-key': 'postgres-db-port', 'username-key': 'postgres-admin-username', 'password-key': 'postgres-admin-password'}}, 'pod': {'name': 'ops', 'image': 'seanahnsf/kaqing-cloud', 'sa': {'name': 'ops', 'proto': 'c3', 'additional-cluster-roles': 'c3aiops-k8ssandra-operator'}, 'label-selector': 'run=ops'}, 'preview': {'rows': 10}, 'processes': {'columns': 'pod,cpu,mem', 'header': 'POD_NAME,CPU,MEM/LIMIT'}, 'reaper': {'service-name': 'reaper-service', 'port-forward': {'timeout': 86400, 'local-port': 9001}, 'abort-runs-batch': 10, 'show-runs-batch': 100, 'pod': {'cluster-regex': '(.*?-.*?-.*?-.*?)-.*', 'label-selector': 'k8ssandra.io/reaper={cluster}-reaper'}, 'secret': {'cluster-regex': '(.*?-.*?)-.*', 'name': '{cluster}-reaper-ui', 'password-item': 'password'}}, 'repair': {'log-path': '/home/cassrepair/logs/', 'image': 'ci-registry.c3iot.io/cloudops/cassrepair:2.0.14', 'secret': 'ciregistryc3iotio', 'env': {'interval': 24, 'timeout': 60, 'pr': False, 'runs': 1}}, 'repl': {'start-drive': 'a', 'auto-enter-app': 'c3/c3', 'auto-enter-only-cluster': 'cluster', 'history': {'push-cat-remote-log-file': True}}, 'status': {'columns': 'status,address,load,tokens,owns,host_id,gossip,compactions', 'header': '--,Address,Load,Tokens,Owns,Host ID,GOSSIP,COMPACTIONS'}, 'storage': {'columns': 'pod,volume_root,volume_cassandra,snapshots,data,compactions', 'header': 'POD_NAME,VOLUME /,VOLUME CASS,SNAPSHOTS,DATA,COMPACTIONS'}, 'watch': {'auto': 'rollout', 'timeout': 3600, 'interval': 10}, 'debug': False, 'debugs': {'timings': False, 'exit-on-error': False, 'show-parallelism': False}}
|
kaqing-2.0.94/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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|