mirror of
https://github.com/hanzoai/datastore.git
synced 2026-09-26 13:55:07 +00:00
Enable more Ruff checks (F401/F403/F405/F541/F841) and clean up tests
Follow-up to #105171, which added `ruff` with a deliberately narrow, bug-class-only rule set and left the unused-name and star-import rules off pending a dedicated cleanup pass. This enables that second batch in `pyproject.toml` and fixes every violation across the tree (the bulk in integration tests): - `F401` unused-import and `F841` unused-variable: removed, preserving any side-effecting right-hand side (e.g. `result = node.query(...)` becomes `node.query(...)`). Two `try: import ...` feature probes are kept with `# noqa: F401`. - `F541` f-string-missing-placeholders: dropped the redundant `f` prefix. - `F403`/`F405` star imports: every `from module import *` is expanded into explicit imports of the names actually used, taken from each name's real origin, so stdlib/third-party names import from their real source rather than through a test "convenience bundle". The now-empty `tests/integration/helpers/kafka/common_direct.py` bundle is removed and its three remaining consumers import `_VarintBytes`/`KafkaAdminClient` directly. Eliminating the star imports surfaced a real bug the wildcard had masked from `F821`: `generate_presets.py` in `test_prometheus_protocols` called an undefined `execute_instant_query_with_http_api`; fixed to the existing `execute_query_via_http_api`. No `black`/`isort` reformatting was applied (neither is enforced in the style check), so the diff is limited to the lint fixes themselves. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
daf89d0396
commit
295ced78d1
@@ -2212,7 +2212,7 @@ def render_text(
|
||||
if binary.build_id:
|
||||
lines.append(f"Build ID: {binary.build_id[:16]}...")
|
||||
lines.append(f"Address: 0x{symbol.address:x}..0x{symbol.address + symbol.size:x} ({symbol.size} bytes)")
|
||||
lines.append(f"Resolution confidence: high")
|
||||
lines.append("Resolution confidence: high")
|
||||
lines.append("")
|
||||
|
||||
# Metrics section
|
||||
|
||||
@@ -18,7 +18,6 @@ Run directly: python3 .claude/tools/test_fetch_perf_report.py
|
||||
import importlib.util
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
import tempfile
|
||||
import types
|
||||
|
||||
|
||||
+7
-7
@@ -464,12 +464,12 @@ LLVM_FT_ARTIFACTS_LIST = [
|
||||
|
||||
LLVM_FT_ARTIFACTS_LIST += [
|
||||
# default.profdata files for 6 jobs from Functional tests with Old Analyzer + S3 + AsyncInsert + parallel/sequential execution
|
||||
ArtifactNames.LLVM_COVERAGE_FILE + f"_ft_old_s3_db_repl_wasm_parallel",
|
||||
ArtifactNames.LLVM_COVERAGE_FILE + f"_ft_old_s3_db_repl_wasm_sequential",
|
||||
ArtifactNames.LLVM_COVERAGE_FILE + f"_ft_s3_parallel",
|
||||
ArtifactNames.LLVM_COVERAGE_FILE + f"_ft_s3_sequential",
|
||||
ArtifactNames.LLVM_COVERAGE_FILE + f"_ft_s3_async_parallel",
|
||||
ArtifactNames.LLVM_COVERAGE_FILE + f"_ft_s3_async_sequential",
|
||||
ArtifactNames.LLVM_COVERAGE_FILE + "_ft_old_s3_db_repl_wasm_parallel",
|
||||
ArtifactNames.LLVM_COVERAGE_FILE + "_ft_old_s3_db_repl_wasm_sequential",
|
||||
ArtifactNames.LLVM_COVERAGE_FILE + "_ft_s3_parallel",
|
||||
ArtifactNames.LLVM_COVERAGE_FILE + "_ft_s3_sequential",
|
||||
ArtifactNames.LLVM_COVERAGE_FILE + "_ft_s3_async_parallel",
|
||||
ArtifactNames.LLVM_COVERAGE_FILE + "_ft_s3_async_sequential",
|
||||
]
|
||||
|
||||
LLVM_IT_ARTIFACTS_LIST = [
|
||||
@@ -539,7 +539,7 @@ class ArtifactConfigs:
|
||||
name="...",
|
||||
type=Artifact.Type.S3,
|
||||
path=[
|
||||
f"./*.profdata",
|
||||
"./*.profdata",
|
||||
],
|
||||
).parametrize(names=LLVM_ARTIFACTS_LIST)
|
||||
|
||||
|
||||
+10
-10
@@ -119,7 +119,7 @@ common_ft_job_config = Job.Config(
|
||||
common_unit_test_job_config = Job.Config(
|
||||
name=JobNames.UNITTEST,
|
||||
runs_on=[], # from parametrize()
|
||||
command=f"python3 ./ci/jobs/unit_tests_job.py --gtest_filter=-FunctionsStress.*",
|
||||
command="python3 ./ci/jobs/unit_tests_job.py --gtest_filter=-FunctionsStress.*",
|
||||
run_in_docker="clickhouse/test-base+--privileged",
|
||||
digest_config=Job.CacheDigestConfig(
|
||||
include_paths=[
|
||||
@@ -604,37 +604,37 @@ class JobConfigs:
|
||||
parameter="amd_llvm_coverage, old analyzer, s3 storage, DatabaseReplicated, WasmEdge, parallel",
|
||||
runs_on=RunnerLabels.AMD_MEDIUM, # large machine - no boost, why?
|
||||
requires=[ArtifactNames.CH_AMD_LLVM_COVERAGE_BUILD],
|
||||
provides=[ArtifactNames.LLVM_COVERAGE_FILE + f"_ft_old_s3_db_repl_wasm_parallel"],
|
||||
provides=[ArtifactNames.LLVM_COVERAGE_FILE + "_ft_old_s3_db_repl_wasm_parallel"],
|
||||
),
|
||||
Job.ParamSet(
|
||||
parameter="amd_llvm_coverage, old analyzer, s3 storage, DatabaseReplicated, WasmEdge, sequential",
|
||||
runs_on=RunnerLabels.AMD_SMALL,
|
||||
requires=[ArtifactNames.CH_AMD_LLVM_COVERAGE_BUILD],
|
||||
provides=[ArtifactNames.LLVM_COVERAGE_FILE + f"_ft_old_s3_db_repl_wasm_sequential"],
|
||||
provides=[ArtifactNames.LLVM_COVERAGE_FILE + "_ft_old_s3_db_repl_wasm_sequential"],
|
||||
),
|
||||
Job.ParamSet(
|
||||
parameter="amd_llvm_coverage, ParallelReplicas, s3 storage, parallel",
|
||||
runs_on=RunnerLabels.AMD_MEDIUM, # large machine - no boost, why?
|
||||
requires=[ArtifactNames.CH_AMD_LLVM_COVERAGE_BUILD],
|
||||
provides=[ArtifactNames.LLVM_COVERAGE_FILE + f"_ft_s3_parallel"],
|
||||
provides=[ArtifactNames.LLVM_COVERAGE_FILE + "_ft_s3_parallel"],
|
||||
),
|
||||
Job.ParamSet(
|
||||
parameter="amd_llvm_coverage, ParallelReplicas, s3 storage, sequential",
|
||||
runs_on=RunnerLabels.AMD_SMALL,
|
||||
requires=[ArtifactNames.CH_AMD_LLVM_COVERAGE_BUILD],
|
||||
provides=[ArtifactNames.LLVM_COVERAGE_FILE + f"_ft_s3_sequential"],
|
||||
provides=[ArtifactNames.LLVM_COVERAGE_FILE + "_ft_s3_sequential"],
|
||||
),
|
||||
Job.ParamSet(
|
||||
parameter="amd_llvm_coverage, AsyncInsert, s3 storage, parallel",
|
||||
runs_on=RunnerLabels.AMD_MEDIUM, # large machine - no boost, why?
|
||||
requires=[ArtifactNames.CH_AMD_LLVM_COVERAGE_BUILD],
|
||||
provides=[ArtifactNames.LLVM_COVERAGE_FILE + f"_ft_s3_async_parallel"],
|
||||
provides=[ArtifactNames.LLVM_COVERAGE_FILE + "_ft_s3_async_parallel"],
|
||||
),
|
||||
Job.ParamSet(
|
||||
parameter="amd_llvm_coverage, AsyncInsert, s3 storage, sequential",
|
||||
runs_on=RunnerLabels.AMD_SMALL,
|
||||
requires=[ArtifactNames.CH_AMD_LLVM_COVERAGE_BUILD],
|
||||
provides=[ArtifactNames.LLVM_COVERAGE_FILE + f"_ft_s3_async_sequential"],
|
||||
provides=[ArtifactNames.LLVM_COVERAGE_FILE + "_ft_s3_async_sequential"],
|
||||
),
|
||||
Job.ParamSet(
|
||||
parameter="amd_debug, parallel",
|
||||
@@ -944,7 +944,7 @@ class JobConfigs:
|
||||
integration_test_asan_flaky_pr_jobs = (
|
||||
common_integration_test_job_config.parametrize(
|
||||
Job.ParamSet(
|
||||
parameter=f"amd_asan_ubsan, flaky",
|
||||
parameter="amd_asan_ubsan, flaky",
|
||||
runs_on=RunnerLabels.AMD_MEDIUM,
|
||||
requires=[ArtifactNames.CH_AMD_ASAN_UBSAN],
|
||||
)
|
||||
@@ -1027,7 +1027,7 @@ class JobConfigs:
|
||||
|
||||
integration_test_targeted_pr_jobs = common_integration_test_job_config.parametrize(
|
||||
Job.ParamSet(
|
||||
parameter=f"amd_asan_ubsan, targeted",
|
||||
parameter="amd_asan_ubsan, targeted",
|
||||
runs_on=RunnerLabels.AMD_MEDIUM,
|
||||
requires=[ArtifactNames.CH_AMD_ASAN_UBSAN],
|
||||
)
|
||||
@@ -1081,7 +1081,7 @@ class JobConfigs:
|
||||
ast_fuzzer_jobs = Job.Config(
|
||||
name=JobNames.ASTFUZZER,
|
||||
runs_on=[], # from parametrize()
|
||||
command=f"python3 ./ci/jobs/ast_fuzzer_job.py",
|
||||
command="python3 ./ci/jobs/ast_fuzzer_job.py",
|
||||
digest_config=Job.CacheDigestConfig(
|
||||
include_paths=[
|
||||
"./ci/docker/fuzzer",
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
import argparse
|
||||
import base64
|
||||
import json
|
||||
|
||||
import pyarrow as pa
|
||||
import pyarrow.flight as fl
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
from praktika import CloudInfrastructure
|
||||
from praktika.infrastructure.dedicated_host import DedicatedHost
|
||||
from praktika.infrastructure.ec2_instance import EC2Instance
|
||||
from praktika.infrastructure.iam_instance_profile import IAMInstanceProfile
|
||||
|
||||
from ci.defs.defs import RunnerLabels
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
import logging
|
||||
import os
|
||||
import random
|
||||
import subprocess
|
||||
import sys
|
||||
import traceback
|
||||
from pathlib import Path
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import json
|
||||
from datetime import datetime, timedelta
|
||||
from typing import List, Optional
|
||||
from typing import List
|
||||
|
||||
from ci.praktika.result import Result
|
||||
from ci.praktika.utils import Shell
|
||||
@@ -143,7 +143,7 @@ def assign_approver_to_pr(pr_number: int, approver: str) -> bool:
|
||||
"""
|
||||
try:
|
||||
cmd = f"gh pr edit {pr_number} --add-assignee {approver}"
|
||||
output = Shell.get_output(cmd, verbose=True)
|
||||
Shell.get_output(cmd, verbose=True)
|
||||
print(f" ✓ Assigned {approver} to PR #{pr_number}")
|
||||
return True
|
||||
except Exception as e:
|
||||
|
||||
@@ -113,7 +113,7 @@ def main():
|
||||
|
||||
# stop log replication
|
||||
Shell.check(
|
||||
f"./ci/jobs/scripts/functional_tests/setup_log_cluster.sh --stop-log-replication",
|
||||
"./ci/jobs/scripts/functional_tests/setup_log_cluster.sh --stop-log-replication",
|
||||
verbose=True,
|
||||
)
|
||||
|
||||
|
||||
@@ -1,18 +1,13 @@
|
||||
import argparse
|
||||
import atexit
|
||||
import dataclasses
|
||||
import fcntl
|
||||
import http.client
|
||||
import os
|
||||
import pty
|
||||
import re
|
||||
import select
|
||||
import shlex
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
import urllib.parse
|
||||
from enum import Enum
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.append("./")
|
||||
@@ -82,7 +77,7 @@ class TestResult:
|
||||
query_result.description.expected_results
|
||||
!= query_result.description.actual_results
|
||||
):
|
||||
info += f"Result mismatch:\n"
|
||||
info += "Result mismatch:\n"
|
||||
info += f"Expected: {query_result.description.expected_results}\n"
|
||||
info += f"Actual: {query_result.description.actual_results}\n"
|
||||
else:
|
||||
@@ -197,7 +192,6 @@ class ClickHouseSetup:
|
||||
test_name = test_name.split(".")[0]
|
||||
test_file = Path(f"./ci/jobs/queries/{test_name}.sql")
|
||||
expected_results_file = Path(f"./ci/jobs/queries/{test_name}.reference")
|
||||
result = {}
|
||||
if not test_file.exists():
|
||||
raise Exception(f"Test file {test_file} does not exist")
|
||||
|
||||
@@ -270,12 +264,12 @@ if __name__ == "__main__":
|
||||
action="extend",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
Shell.check(f"rm -rf /home/max/work/ClickHouse/ci/tmp/wd/")
|
||||
Shell.check("rm -rf /home/max/work/ClickHouse/ci/tmp/wd/")
|
||||
Shell.check(f"chmod +x {args.path}")
|
||||
Shell.check(f"{args.path} --version", strict=True)
|
||||
|
||||
def cleanup():
|
||||
Shell.check(f"pkill -f 'clickhouse server'", verbose=True, strict=False)
|
||||
Shell.check("pkill -f 'clickhouse server'", verbose=True, strict=False)
|
||||
|
||||
atexit.register(cleanup)
|
||||
CH = ClickHouseSetup(args.workdir, args.path)
|
||||
|
||||
@@ -20,7 +20,7 @@ import platform
|
||||
import subprocess
|
||||
import time
|
||||
|
||||
from ci.defs.defs import BuildTypes, ToolSet
|
||||
from ci.defs.defs import ToolSet
|
||||
from ci.praktika.result import Result
|
||||
from ci.praktika.utils import MetaClasses, Shell, Utils
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ if __name__ == "__main__":
|
||||
names = None
|
||||
results = []
|
||||
|
||||
print(f"--- Get Job Names ---")
|
||||
print("--- Get Job Names ---")
|
||||
|
||||
def get_all_job_names():
|
||||
query = JOB_NAMES_QUERY.format(DAYS=3, BASE_REF=BASE_REF)
|
||||
@@ -138,7 +138,7 @@ if __name__ == "__main__":
|
||||
if not results[-1].is_ok():
|
||||
sys.exit()
|
||||
|
||||
print(f"--- Get statistics for each job ---")
|
||||
print("--- Get statistics for each job ---")
|
||||
overall_statistics = {}
|
||||
is_collected = False
|
||||
results_stat = []
|
||||
@@ -170,7 +170,7 @@ if __name__ == "__main__":
|
||||
)
|
||||
)
|
||||
|
||||
print(f"--- Upload statistics ---")
|
||||
print("--- Upload statistics ---")
|
||||
statistics_link = None
|
||||
if is_collected:
|
||||
|
||||
|
||||
@@ -36,7 +36,6 @@ def process_glibc_check():
|
||||
for command in commands:
|
||||
Shell.check(command, verbose=True, strict=True)
|
||||
|
||||
test_results = []
|
||||
ok = True
|
||||
with open(f"{temp_path}/glibc.log", "r", encoding="utf-8") as log:
|
||||
for line in log:
|
||||
|
||||
@@ -419,7 +419,7 @@ def main():
|
||||
else:
|
||||
assert False, "BUG"
|
||||
urls = read_build_urls(build_name)
|
||||
assert urls, f"URLS has not been read from build report"
|
||||
assert urls, "URLS has not been read from build report"
|
||||
direct_urls[arch] = [
|
||||
url
|
||||
for url in urls
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import argparse
|
||||
import os
|
||||
import platform
|
||||
import time
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
@@ -15,7 +14,7 @@ from ci.jobs.scripts.functional_tests_results import FTResultsProcessor
|
||||
from ci.praktika.info import Info
|
||||
from ci.praktika.result import Result
|
||||
from ci.praktika.settings import Settings
|
||||
from ci.praktika.utils import ContextManager, MetaClasses, Shell, Utils
|
||||
from ci.praktika.utils import MetaClasses, Shell, Utils
|
||||
|
||||
current_directory = Utils.cwd()
|
||||
build_dir = f"{current_directory}/ci/tmp/fast_build"
|
||||
|
||||
@@ -386,7 +386,7 @@ def main():
|
||||
|
||||
if (is_azure_storage or is_s3_storage) and is_encrypted_storage:
|
||||
config_installs_args += " --encrypted-storage"
|
||||
runner_options += f" --encrypted-storage"
|
||||
runner_options += " --encrypted-storage"
|
||||
|
||||
if is_bugfix_validation:
|
||||
os.environ["GLOBAL_TAGS"] = "no-random-settings"
|
||||
@@ -566,9 +566,9 @@ def main():
|
||||
print("skip log export config for local run")
|
||||
|
||||
commands = [
|
||||
f"rm -rf /etc/clickhouse-client/* /etc/clickhouse-server/* /etc/clickhouse-server1/* /etc/clickhouse-server2/*",
|
||||
"rm -rf /etc/clickhouse-client/* /etc/clickhouse-server/* /etc/clickhouse-server1/* /etc/clickhouse-server2/*",
|
||||
# google *.proto files
|
||||
f"mkdir -p /usr/share/clickhouse/ && ln -sf /usr/local/include /usr/share/clickhouse/protos",
|
||||
"mkdir -p /usr/share/clickhouse/ && ln -sf /usr/local/include /usr/share/clickhouse/protos",
|
||||
f"ln -sf {ch_path}/clickhouse {ch_path}/clickhouse-server",
|
||||
f"ln -sf {ch_path}/clickhouse {ch_path}/clickhouse-client",
|
||||
f"ln -sf {ch_path}/clickhouse {ch_path}/clickhouse-compressor",
|
||||
@@ -578,9 +578,9 @@ def main():
|
||||
f"ln -sf {ch_path}/clickhouse {ch_path}/clickhouse-format",
|
||||
f"ln -sf {ch_path}/clickhouse {ch_path}/ch",
|
||||
f"ln -sf /usr/bin/clickhouse-odbc-bridge {ch_path}/clickhouse-odbc-bridge",
|
||||
f"cp programs/server/config.xml programs/server/users.xml /etc/clickhouse-server/",
|
||||
"cp programs/server/config.xml programs/server/users.xml /etc/clickhouse-server/",
|
||||
f"./tests/config/install.sh /etc/clickhouse-server /etc/clickhouse-client {config_installs_args}",
|
||||
f"clickhouse-server --version",
|
||||
"clickhouse-server --version",
|
||||
f"sed -i 's|>/test/chroot|>{temp_dir}/chroot|' /etc/clickhouse-server**/config.d/*.xml",
|
||||
CH.set_random_timezone,
|
||||
]
|
||||
@@ -782,7 +782,7 @@ def main():
|
||||
# racing the half-written binary fails with
|
||||
# `open: Is a directory`.
|
||||
Shell.run(
|
||||
f"clickhouse-server --version",
|
||||
"clickhouse-server --version",
|
||||
verbose=True,
|
||||
strict=True,
|
||||
)
|
||||
|
||||
@@ -50,7 +50,7 @@ def main():
|
||||
|
||||
# stop log replication
|
||||
Shell.check(
|
||||
f"./ci/jobs/scripts/functional_tests/setup_log_cluster.sh --stop-log-replication",
|
||||
"./ci/jobs/scripts/functional_tests/setup_log_cluster.sh --stop-log-replication",
|
||||
verbose=True,
|
||||
)
|
||||
|
||||
|
||||
@@ -390,7 +390,7 @@ def merge_profraw_files(llvm_profdata_cmd: str, job_params: list):
|
||||
print(f" Deleted {deleted_count} profraw files", flush=True)
|
||||
return final_file
|
||||
else:
|
||||
print(f"ERROR: Failed to create final coverage file", flush=True)
|
||||
print("ERROR: Failed to create final coverage file", flush=True)
|
||||
if result.stderr:
|
||||
print(result.stderr, flush=True)
|
||||
return None
|
||||
@@ -666,7 +666,6 @@ tar -czf ./ci/tmp/logs.tar.gz \
|
||||
if "/" in to:
|
||||
batch_num, total_batches = map(int, to.split("/"))
|
||||
elif any(build in to for build in ("amd_", "arm_")):
|
||||
build_type = to
|
||||
if "amd_llvm_coverage" in to:
|
||||
is_llvm_coverage = True
|
||||
elif to == "old analyzer":
|
||||
@@ -935,7 +934,7 @@ tar -czf ./ci/tmp/logs.tar.gz \
|
||||
),
|
||||
}
|
||||
if is_llvm_coverage:
|
||||
test_env["LLVM_PROFILE_FILE"] = f"it-%4m.profraw"
|
||||
test_env["LLVM_PROFILE_FILE"] = "it-%4m.profraw"
|
||||
print(
|
||||
f"NOTE: This is LLVM coverage run, setting LLVM_PROFILE_FILE to [{test_env['LLVM_PROFILE_FILE']}]"
|
||||
)
|
||||
|
||||
@@ -335,7 +335,7 @@ def process_results(result_path: Path):
|
||||
oks += 1
|
||||
elif status[0] == "ERROR":
|
||||
errors += 1
|
||||
raw_logs.append(f"Fuzzing FAILED.")
|
||||
raw_logs.append("Fuzzing FAILED.")
|
||||
if file_path_out.exists():
|
||||
log_files.append(str(file_path_out))
|
||||
if file_path_stdout.exists():
|
||||
|
||||
@@ -161,8 +161,8 @@ def _make_insert_query(table, table_columns, input_schema, select_exprs, where=N
|
||||
return (
|
||||
f"INSERT INTO {table}\n"
|
||||
f"(\n " + ",\n ".join(all_cols) + "\n)\n"
|
||||
f"SELECT\n" + select_all + "\n"
|
||||
f"FROM input('" + input_schema + "')\n"
|
||||
"SELECT\n" + select_all + "\n"
|
||||
"FROM input('" + input_schema + "')\n"
|
||||
+ where_clause + "\n"
|
||||
"FORMAT TSV"
|
||||
)
|
||||
@@ -741,12 +741,12 @@ class CHServer:
|
||||
stderr = self.proc.stderr.read().strip() if self.proc.stderr else ""
|
||||
Utils.print_formatted_error("Failed to start ClickHouse", stdout, stderr)
|
||||
return False
|
||||
print(f"ClickHouse server process started -> wait ready")
|
||||
print("ClickHouse server process started -> wait ready")
|
||||
res = self.wait_ready()
|
||||
if res:
|
||||
print(f"ClickHouse server ready")
|
||||
print("ClickHouse server ready")
|
||||
else:
|
||||
print(f"ClickHouse server NOT ready")
|
||||
print("ClickHouse server NOT ready")
|
||||
|
||||
Shell.check(
|
||||
f"clickhouse-client --port {self.port} --query 'create database IF NOT EXISTS test' && clickhouse-client --port {self.port} --query 'rename table datasets.hits_v1 to test.hits'",
|
||||
@@ -772,12 +772,12 @@ class CHServer:
|
||||
stderr = self.proc.stderr.read().strip() if self.proc.stderr else ""
|
||||
Utils.print_formatted_error("Failed to start ClickHouse", stdout, stderr)
|
||||
return False
|
||||
print(f"ClickHouse server process started -> wait ready")
|
||||
print("ClickHouse server process started -> wait ready")
|
||||
res = self.wait_ready()
|
||||
if res:
|
||||
print(f"ClickHouse server ready")
|
||||
print("ClickHouse server ready")
|
||||
else:
|
||||
print(f"ClickHouse server NOT ready")
|
||||
print("ClickHouse server NOT ready")
|
||||
return res
|
||||
|
||||
def wait_ready(self):
|
||||
@@ -792,7 +792,7 @@ class CHServer:
|
||||
print("Server ready")
|
||||
break
|
||||
else:
|
||||
print(f"Server not ready, wait")
|
||||
print("Server not ready, wait")
|
||||
Utils.sleep(delay)
|
||||
else:
|
||||
Utils.print_formatted_error(
|
||||
@@ -953,7 +953,7 @@ def main():
|
||||
else:
|
||||
assert False
|
||||
else:
|
||||
Utils.raise_with_error(f"Unknown processor architecture")
|
||||
Utils.raise_with_error("Unknown processor architecture")
|
||||
|
||||
if compare_against_release:
|
||||
print("It's a comparison against latest release baseline")
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import time
|
||||
@@ -253,7 +252,7 @@ Test output:
|
||||
|
||||
@classmethod
|
||||
def repr_result(cls, result):
|
||||
res = f"\n - test output:\n"
|
||||
res = "\n - test output:\n"
|
||||
# For ERROR status (typically job-level failures), meaningful output is usually at the end,
|
||||
# so we truncate from the top to preserve the error details.
|
||||
# For other statuses (test failures), the relevant information is often at the beginning,
|
||||
@@ -524,7 +523,7 @@ class CommitStatusCheck:
|
||||
context=context,
|
||||
)
|
||||
|
||||
print(f"\nCommit statuses:")
|
||||
print("\nCommit statuses:")
|
||||
for check in required_checks:
|
||||
if check in status_map:
|
||||
state = status_map[check].state
|
||||
@@ -1014,7 +1013,7 @@ def main():
|
||||
only_update=True,
|
||||
verbose=False,
|
||||
):
|
||||
print(f"ERROR: failed to post CI summary")
|
||||
print("ERROR: failed to post CI summary")
|
||||
except Exception as e:
|
||||
print(f"ERROR: failed to post CI summary, ex: {e}")
|
||||
traceback.print_exc()
|
||||
@@ -1027,7 +1026,7 @@ def main():
|
||||
if Shell.check(
|
||||
f"gh pr view {pr_number} --json isDraft --jq '.isDraft' --repo ClickHouse/ClickHouse | grep -q true"
|
||||
):
|
||||
if UserPrompt.confirm(f"It's a draft PR. Do you want to undraft it?"):
|
||||
if UserPrompt.confirm("It's a draft PR. Do you want to undraft it?"):
|
||||
Shell.check(
|
||||
f"gh pr ready {pr_number} --repo ClickHouse/ClickHouse",
|
||||
strict=True,
|
||||
|
||||
@@ -469,7 +469,7 @@ def main():
|
||||
finally:
|
||||
# Cleanup worktree
|
||||
if worktree_dir and worktree_dir.exists():
|
||||
print(f"\nCleaning up worktree...")
|
||||
print("\nCleaning up worktree...")
|
||||
run_command(
|
||||
["git", "worktree", "remove", "--force", str(worktree_dir)],
|
||||
cwd=git_root,
|
||||
|
||||
@@ -73,7 +73,7 @@ class CIDBCluster:
|
||||
"X-ClickHouse-Key": self.pwd,
|
||||
}
|
||||
params = {
|
||||
"query": f"SELECT 1",
|
||||
"query": "SELECT 1",
|
||||
}
|
||||
try:
|
||||
response = requests.post(
|
||||
@@ -178,7 +178,7 @@ class CIDBCluster:
|
||||
print(f"ERROR: CIDB query failed with exception: {ex}")
|
||||
traceback.print_exc()
|
||||
break
|
||||
print(f"ERROR: Failed to query CIDB")
|
||||
print("ERROR: Failed to query CIDB")
|
||||
return False
|
||||
|
||||
def insert_json(self, table, json_str):
|
||||
|
||||
@@ -75,9 +75,9 @@ class ClickHouseProc:
|
||||
self.user_files_path = f"{self.run_path0}/user_files"
|
||||
self.test_output_file = f"{temp_dir}/test_result.txt"
|
||||
self.command = f"clickhouse-server --config-file {self.config_file} --pid-file {self.pid_file} -- --path {self.run_path0} --user_files_path {self.user_files_path} --top_level_domains_path {self.ch_config_dir}/top_level_domains --logger.stderr {self.log_dir}/stderr.log"
|
||||
self.ch_config_dir_replica_1 = f"/etc/clickhouse-server1"
|
||||
self.ch_config_dir_replica_1 = "/etc/clickhouse-server1"
|
||||
self.config_file_replica_1 = f"{self.ch_config_dir_replica_1}/config.xml"
|
||||
self.ch_config_dir_replica_2 = f"/etc/clickhouse-server2"
|
||||
self.ch_config_dir_replica_2 = "/etc/clickhouse-server2"
|
||||
self.config_file_replica_2 = f"{self.ch_config_dir_replica_2}/config.xml"
|
||||
self.pid_file = f"{self.ch_config_dir}/clickhouse-server.pid"
|
||||
self.pid_file_replica_1 = (
|
||||
@@ -98,7 +98,7 @@ class ClickHouseProc:
|
||||
self.proc_1 = None
|
||||
self.proc_2 = None
|
||||
self.pid = 0
|
||||
nproc = int(Utils.cpu_count() / 2)
|
||||
int(Utils.cpu_count() / 2)
|
||||
self.minio_proc = None
|
||||
self.azurite_proc = None
|
||||
self.kafka_proc = None
|
||||
@@ -214,7 +214,7 @@ class ClickHouseProc:
|
||||
@staticmethod
|
||||
def log_cluster_config():
|
||||
return Shell.check(
|
||||
f"./ci/jobs/scripts/functional_tests/setup_log_cluster.sh --config-logs-export-cluster ./tmp_ci/etc/clickhouse-server/config.d/system_logs_export.yaml",
|
||||
"./ci/jobs/scripts/functional_tests/setup_log_cluster.sh --config-logs-export-cluster ./tmp_ci/etc/clickhouse-server/config.d/system_logs_export.yaml",
|
||||
verbose=True,
|
||||
)
|
||||
|
||||
@@ -282,7 +282,7 @@ class ClickHouseProc:
|
||||
"""
|
||||
Start ClickHouse server with config installed with _install_config()
|
||||
"""
|
||||
print(f"Starting ClickHouse server")
|
||||
print("Starting ClickHouse server")
|
||||
# check binary available and do decompression in the meantime
|
||||
assert Shell.check("clickhouse --version", verbose=True)
|
||||
self.pid_file = f"{temp_dir}/clickhouse-server.pid"
|
||||
@@ -299,12 +299,12 @@ class ClickHouseProc:
|
||||
stderr = self.proc.stderr.read().strip() if self.proc.stderr else ""
|
||||
Utils.print_formatted_error("Failed to start ClickHouse", stdout, stderr)
|
||||
return False
|
||||
print(f"ClickHouse server process started -> wait ready")
|
||||
print("ClickHouse server process started -> wait ready")
|
||||
res = self.wait_ready()
|
||||
if res:
|
||||
print(f"ClickHouse server ready")
|
||||
print("ClickHouse server ready")
|
||||
else:
|
||||
print(f"ClickHouse server NOT ready")
|
||||
print("ClickHouse server NOT ready")
|
||||
|
||||
self._flush_system_logs()
|
||||
self.save_system_metadata_files_from_remote_database_disk()
|
||||
@@ -419,7 +419,7 @@ profiles:
|
||||
@staticmethod
|
||||
def stop_log_exports():
|
||||
return Shell.check(
|
||||
f"./ci/jobs/scripts/functional_tests/setup_log_cluster.sh --stop-log-replication",
|
||||
"./ci/jobs/scripts/functional_tests/setup_log_cluster.sh --stop-log-replication",
|
||||
verbose=True,
|
||||
)
|
||||
|
||||
@@ -457,7 +457,7 @@ profiles:
|
||||
# set profile file for the server (not needed for per-test coverage,
|
||||
# which uses system.coverage_log instead of .profraw files)
|
||||
if not self.is_per_test_coverage:
|
||||
os.environ["LLVM_PROFILE_FILE"] = f"ft-server-%m.profraw"
|
||||
os.environ["LLVM_PROFILE_FILE"] = "ft-server-%m.profraw"
|
||||
|
||||
env = os.environ.copy()
|
||||
env["TSAN_OPTIONS"] = " ".join(
|
||||
@@ -636,7 +636,7 @@ profiles:
|
||||
try:
|
||||
self.pid = int(Shell.get_output(f"cat {pid_file}").strip())
|
||||
break
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
Utils.sleep(1)
|
||||
i += 1
|
||||
if self.pid is None:
|
||||
@@ -839,7 +839,7 @@ clickhouse-client --query "SELECT count() FROM test.visits"
|
||||
"""
|
||||
print("Stop ClickHouse processes")
|
||||
|
||||
Shell.check(f"ps -ef | grep clickhouse")
|
||||
Shell.check("ps -ef | grep clickhouse")
|
||||
for proc, pid_file, pid, run_path in (
|
||||
(self.proc, self.pid_file, self.pid_0, self.run_path0),
|
||||
(self.proc_1, self.pid_file_replica_1, self.pid_1, self.run_path1),
|
||||
@@ -1187,7 +1187,7 @@ clickhouse-client --query "SELECT count() FROM test.visits"
|
||||
#
|
||||
# [2]: https://github.com/ClickHouse/ClickHouse/issues/77320
|
||||
#
|
||||
command_args_post = f"-- --zookeeper.implementation=testkeeper"
|
||||
command_args_post = "-- --zookeeper.implementation=testkeeper"
|
||||
|
||||
Utils.clean_dir(p_temp_dir / "system_tables")
|
||||
res = True
|
||||
@@ -1204,7 +1204,7 @@ clickhouse-client --query "SELECT count() FROM test.visits"
|
||||
for cache_status_path in cache_status_files:
|
||||
Shell.check(f"rm {cache_status_path}", verbose=True)
|
||||
|
||||
scraping_system_table = Result(name=f"Scraping system tables", status=Result.Status.OK)
|
||||
scraping_system_table = Result(name="Scraping system tables", status=Result.Status.OK)
|
||||
for table in TABLES:
|
||||
path_arg = f" --path {self.run_path0}"
|
||||
res, stdout, stderr = Shell.get_res_stdout_stderr(
|
||||
@@ -1366,7 +1366,7 @@ clickhouse-client --query "SELECT count() FROM test.visits"
|
||||
@staticmethod
|
||||
def set_random_timezone():
|
||||
tz = Shell.get_output(
|
||||
f"rg -v '#' /usr/share/zoneinfo/zone.tab | awk '{{print $3}}' | shuf | head -n1"
|
||||
"rg -v '#' /usr/share/zoneinfo/zone.tab | awk '{print $3}' | shuf | head -n1"
|
||||
)
|
||||
print(f"Chosen random timezone: {tz}")
|
||||
assert tz, "Failed to get random TZ"
|
||||
@@ -1414,7 +1414,7 @@ if __name__ == "__main__":
|
||||
res = ch.start_azurite()
|
||||
else:
|
||||
raise ValueError(f"Unknown command: {command}")
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
print(f"ERROR: Failed to do [{command}]")
|
||||
traceback.print_exc()
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ if __name__ == "__main__":
|
||||
continue
|
||||
|
||||
try:
|
||||
print(f" Checking PRs reviewed by me...")
|
||||
print(" Checking PRs reviewed by me...")
|
||||
seven_days_ago = (datetime.now() - timedelta(days=INTERVAL_DAYS)).strftime(
|
||||
"%Y-%m-%d"
|
||||
)
|
||||
@@ -88,7 +88,7 @@ if __name__ == "__main__":
|
||||
print(f"Error processing approved PRs for {repo}: {e}")
|
||||
continue
|
||||
|
||||
print(f"\nSummary:")
|
||||
print("\nSummary:")
|
||||
print(f"- Authored and merged: {len(result_merged)} PRs")
|
||||
print(f"- Reviewed and merged: {len(result_approved)} PRs")
|
||||
|
||||
|
||||
@@ -1409,7 +1409,6 @@ class Targeting:
|
||||
using KEYWORD_FALLBACK_WIDTH so they always rank below any direct or
|
||||
sibling hit.
|
||||
"""
|
||||
import glob as _glob
|
||||
|
||||
if not changed_src_files:
|
||||
return []
|
||||
@@ -2070,7 +2069,6 @@ if __name__ == "__main__":
|
||||
# get_changed_lines_from_diff and get_most_relevant_tests read from the file
|
||||
# rather than fetching the diff.
|
||||
if args.diff_file:
|
||||
import types
|
||||
diff_text = Path(args.diff_file).read_text()
|
||||
targeting._diff_text = diff_text
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ class CoverageExporter:
|
||||
#
|
||||
# [2]: https://github.com/ClickHouse/ClickHouse/issues/77320
|
||||
#
|
||||
command_args_post = f"-- --zookeeper.implementation=testkeeper"
|
||||
command_args_post = "-- --zookeeper.implementation=testkeeper"
|
||||
|
||||
Shell.check(
|
||||
f"rm -rf {temp_dir}/system_tables && mkdir -p {temp_dir}/system_tables"
|
||||
|
||||
@@ -180,7 +180,7 @@ class FTResultsProcessor:
|
||||
info="".join(test[3])[:16384],
|
||||
)
|
||||
)
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
print(f"ERROR: Failed to parse test results: {test}")
|
||||
traceback.print_exc()
|
||||
self.debug_files.append(self.tests_output_file)
|
||||
|
||||
@@ -25,18 +25,18 @@ def check():
|
||||
c_function_cov = d["c_function_cov"]
|
||||
b_branch_cov = d["b_branch_cov"]
|
||||
c_branch_cov = d["c_branch_cov"]
|
||||
b_line_hit = d.get("b_line_hit", 0)
|
||||
b_line_total = d.get("b_line_total", 0)
|
||||
c_line_hit = d.get("c_line_hit", 0)
|
||||
c_line_total = d.get("c_line_total", 0)
|
||||
b_func_hit = d.get("b_func_hit", 0)
|
||||
b_func_total = d.get("b_func_total", 0)
|
||||
c_func_hit = d.get("c_func_hit", 0)
|
||||
c_func_total = d.get("c_func_total", 0)
|
||||
b_branch_hit = d.get("b_branch_hit", 0)
|
||||
b_branch_total = d.get("b_branch_total", 0)
|
||||
c_branch_hit = d.get("c_branch_hit", 0)
|
||||
c_branch_total = d.get("c_branch_total", 0)
|
||||
d.get("b_line_hit", 0)
|
||||
d.get("b_line_total", 0)
|
||||
d.get("c_line_hit", 0)
|
||||
d.get("c_line_total", 0)
|
||||
d.get("b_func_hit", 0)
|
||||
d.get("b_func_total", 0)
|
||||
d.get("c_func_hit", 0)
|
||||
d.get("c_func_total", 0)
|
||||
d.get("b_branch_hit", 0)
|
||||
d.get("b_branch_total", 0)
|
||||
d.get("c_branch_hit", 0)
|
||||
d.get("c_branch_total", 0)
|
||||
pr_changed_lines_info = d.get("pr_changed_lines_info", "")
|
||||
diff_url = d.get("diff_url", "")
|
||||
uncovered_code_url = d.get("uncovered_code_url", "")
|
||||
|
||||
@@ -45,7 +45,7 @@ class LogCluster:
|
||||
"X-ClickHouse-Key": passwd,
|
||||
}
|
||||
params = {
|
||||
"query": f"SELECT 1",
|
||||
"query": "SELECT 1",
|
||||
}
|
||||
try:
|
||||
response = requests.post(
|
||||
@@ -109,7 +109,7 @@ class LogCluster:
|
||||
else:
|
||||
break
|
||||
except Exception:
|
||||
print(f"WARNING: LogCluster query failed with exception")
|
||||
print("WARNING: LogCluster query failed with exception")
|
||||
traceback.print_exc()
|
||||
if response is not None:
|
||||
print(
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import argparse
|
||||
import ast
|
||||
import collections
|
||||
import csv
|
||||
import itertools
|
||||
import json
|
||||
import os
|
||||
import os.path
|
||||
import pprint
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
class StackTraceReader(object):
|
||||
@@ -24,7 +23,6 @@ class StackTraceReader(object):
|
||||
errors_before_trace = []
|
||||
errors_after_trace = []
|
||||
trace = ""
|
||||
changed_settings = []
|
||||
unknown_lines = []
|
||||
|
||||
i = 0
|
||||
|
||||
@@ -134,7 +134,7 @@ def get_options(i: int, upgrade_check: bool, encrypted_storage: bool) -> str:
|
||||
options.append("--no-random-merge-tree-settings")
|
||||
|
||||
# allow constraint
|
||||
client_options.append(f"enable_analyzer=1")
|
||||
client_options.append("enable_analyzer=1")
|
||||
|
||||
if i > 0:
|
||||
options.append("--order=random")
|
||||
@@ -625,7 +625,7 @@ def main():
|
||||
query_killer = RandomQueryKiller(interval=3.0)
|
||||
|
||||
try:
|
||||
func_pipes = run_func_test(
|
||||
run_func_test(
|
||||
args.test_cmd,
|
||||
args.output_folder,
|
||||
args.num_parallel,
|
||||
|
||||
@@ -30,7 +30,7 @@ if __name__ == "__main__":
|
||||
sys.exit(-1)
|
||||
|
||||
if not info.get_changed_files():
|
||||
print(f"ERROR: No Files changed in the Backport PR.")
|
||||
print("ERROR: No Files changed in the Backport PR.")
|
||||
sys.exit(-1)
|
||||
else:
|
||||
assert False, f"Unsupported workflow name [{info.workflow_name}]"
|
||||
|
||||
@@ -90,7 +90,7 @@ def check():
|
||||
"No new tests have been added, but the PR description has a link to a CI report - pass"
|
||||
)
|
||||
return True
|
||||
print(f"No new tests have been added")
|
||||
print("No new tests have been added")
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ def check():
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
check()
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
print("Failed to initiate sync")
|
||||
traceback.print_exc()
|
||||
sys.exit(1)
|
||||
|
||||
+11
-12
@@ -4,7 +4,6 @@ import html
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
from praktika.result import Result
|
||||
@@ -286,18 +285,18 @@ def generate_html_report(
|
||||
f"{reset_color}\n"
|
||||
)
|
||||
f.write(
|
||||
f" These tests were not failing before. "
|
||||
f"Each entry shows the test file, position, query, and failure reason.\n"
|
||||
" These tests were not failing before. "
|
||||
"Each entry shows the test file, position, query, and failure reason.\n"
|
||||
)
|
||||
# Collect unique test files and show per-file reproduction commands
|
||||
new_test_files = sorted(
|
||||
set(d["test_name"] for d in new_failures.values())
|
||||
)
|
||||
f.write(
|
||||
f"\n To reproduce via sqllogictest (ClickHouse must be running):\n"
|
||||
f" <span style='color: blue;'>"
|
||||
f"git clone https://github.com/gregrahn/sqllogictest.git"
|
||||
f" /tmp/sqllogictest</span>\n\n"
|
||||
"\n To reproduce via sqllogictest (ClickHouse must be running):\n"
|
||||
" <span style='color: blue;'>"
|
||||
"git clone https://github.com/gregrahn/sqllogictest.git"
|
||||
" /tmp/sqllogictest</span>\n\n"
|
||||
)
|
||||
for tf in new_test_files:
|
||||
subdir = os.path.dirname(tf)
|
||||
@@ -417,7 +416,7 @@ def generate_html_report(
|
||||
# Failure classification by reason
|
||||
classified = classify_failures(report)
|
||||
if classified:
|
||||
f.write(f" Failure categories:\n")
|
||||
f.write(" Failure categories:\n")
|
||||
for count, cat, cat_examples in classified:
|
||||
pct = 100.0 * count / fail if fail else 0
|
||||
f.write(
|
||||
@@ -644,10 +643,10 @@ def main():
|
||||
f" /tmp/sqllogic_input/{subdir}/"
|
||||
)
|
||||
print(
|
||||
f" python3 tests/sqllogic/runner.py"
|
||||
f" complete-test"
|
||||
f" --input-dir /tmp/sqllogic_input"
|
||||
f" --out-dir /tmp/sqllogic_output"
|
||||
" python3 tests/sqllogic/runner.py"
|
||||
" complete-test"
|
||||
" --input-dir /tmp/sqllogic_input"
|
||||
" --out-dir /tmp/sqllogic_output"
|
||||
)
|
||||
displayed = 0
|
||||
for fid in sorted(new_failures.keys()):
|
||||
|
||||
@@ -43,7 +43,7 @@ class ClickHouseBinary:
|
||||
return res
|
||||
|
||||
def start(self):
|
||||
print(f"Starting ClickHouse server")
|
||||
print("Starting ClickHouse server")
|
||||
print("Command: ", self.start_cmd)
|
||||
self.log_fd = open(self.log_file, "w")
|
||||
self.proc = subprocess.Popen(
|
||||
@@ -56,12 +56,12 @@ class ClickHouseBinary:
|
||||
stderr = self.proc.stderr.read().strip() if self.proc.stderr else ""
|
||||
Utils.print_formatted_error("Failed to start ClickHouse", stdout, stderr)
|
||||
return False
|
||||
print(f"ClickHouse server process started -> wait ready")
|
||||
print("ClickHouse server process started -> wait ready")
|
||||
res = self.wait_ready()
|
||||
if res:
|
||||
print(f"ClickHouse server ready")
|
||||
print("ClickHouse server ready")
|
||||
else:
|
||||
print(f"ClickHouse server NOT ready")
|
||||
print("ClickHouse server NOT ready")
|
||||
return res
|
||||
|
||||
def wait_ready(self):
|
||||
@@ -76,7 +76,7 @@ class ClickHouseBinary:
|
||||
print("Server ready")
|
||||
break
|
||||
else:
|
||||
print(f"Server not ready, wait")
|
||||
print("Server not ready, wait")
|
||||
Utils.sleep(delay)
|
||||
else:
|
||||
Utils.print_formatted_error(
|
||||
@@ -87,7 +87,6 @@ class ClickHouseBinary:
|
||||
|
||||
|
||||
def main():
|
||||
res = True
|
||||
results = []
|
||||
stop_watch = Utils.Stopwatch()
|
||||
ch = ClickHouseBinary()
|
||||
@@ -246,7 +245,7 @@ def main():
|
||||
total,
|
||||
success / total,
|
||||
reset_color,
|
||||
f" - " + html.escape(description) if description else "",
|
||||
" - " + html.escape(description) if description else "",
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ if __name__ == "__main__":
|
||||
# Note, LSan does not compatible with debugger
|
||||
if "asan" not in job_name:
|
||||
# With gdb we will capture stacktrace in case of abnormal termination and timeout (45 mins)
|
||||
command_launcher = f"timeout -s INT -v 45m gdb -batch -ex 'handle all nostop' -ex 'set print thread-events off' -ex run -ex bt -ex 'thread apply all bt' -arg"
|
||||
command_launcher = "timeout -s INT -v 45m gdb -batch -ex 'handle all nostop' -ex 'set print thread-events off' -ex run -ex bt -ex 'thread apply all bt' -arg"
|
||||
else:
|
||||
command_launcher = ""
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ def main():
|
||||
elif Utils.is_amd():
|
||||
latest_ch_master_url = "https://clickhouse-builds.s3.us-east-1.amazonaws.com/master/amd64/clickhouse"
|
||||
else:
|
||||
assert False, f"Unknown processor architecture"
|
||||
assert False, "Unknown processor architecture"
|
||||
|
||||
if res and not info.is_local_run:
|
||||
step_name = "Download ClickHouse"
|
||||
|
||||
@@ -14,7 +14,7 @@ import numpy as np
|
||||
from ci.jobs.scripts.clickhouse_proc import ClickHouseProc
|
||||
from ci.praktika.info import Info
|
||||
from ci.praktika.result import Result
|
||||
from ci.praktika.utils import Shell, Utils
|
||||
from ci.praktika.utils import Utils
|
||||
|
||||
temp_dir = f"{Utils.cwd()}/ci/tmp/"
|
||||
|
||||
@@ -655,10 +655,10 @@ class RunTest:
|
||||
try:
|
||||
ann_search_query = f"SELECT {self._id_column}, distance FROM {self._table} ORDER BY {self._distance_metric}( {self._vector_column}, {warmup_query_source} ) AS distance LIMIT {self._k}"
|
||||
result = chclient.query(ann_search_query)
|
||||
logger(f"Vector indexes have loaded!")
|
||||
logger("Vector indexes have loaded!")
|
||||
break
|
||||
except Exception as e:
|
||||
logger(f"Waiting for indexes to load...")
|
||||
except Exception:
|
||||
logger("Waiting for indexes to load...")
|
||||
time.sleep(30)
|
||||
|
||||
for truth_record in self._truth_set:
|
||||
@@ -788,7 +788,7 @@ def run_single_test(test_name, dataset, test_params):
|
||||
# Run concurrency test on the current truth set
|
||||
if test_runner._test_params[CONCURRENCY_TEST]:
|
||||
test_runner.concurrency_test()
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
print(traceback.format_exc(), file=sys.stdout)
|
||||
result = False
|
||||
finally:
|
||||
@@ -805,14 +805,14 @@ def install_and_start_clickhouse():
|
||||
res = True
|
||||
results = []
|
||||
ch = ClickHouseProc()
|
||||
info = Info()
|
||||
Info()
|
||||
|
||||
if Utils.is_arm():
|
||||
latest_ch_master_url = "https://clickhouse-builds.s3.us-east-1.amazonaws.com/master/aarch64/clickhouse"
|
||||
elif Utils.is_amd():
|
||||
latest_ch_master_url = "https://clickhouse-builds.s3.us-east-1.amazonaws.com/master/amd64/clickhouse"
|
||||
else:
|
||||
assert False, f"Unknown processor architecture"
|
||||
assert False, "Unknown processor architecture"
|
||||
|
||||
if True:
|
||||
step_name = "Download ClickHouse"
|
||||
|
||||
@@ -351,7 +351,7 @@ def main():
|
||||
for workflow in workflows:
|
||||
print(
|
||||
f"Workflow [{workflow.name}] has jobs:\n"
|
||||
" \"" + f'"\n "'.join([job.name for job in workflow.jobs]) + '"'
|
||||
" \"" + '"\n "'.join([job.name for job in workflow.jobs]) + '"'
|
||||
)
|
||||
Utils.exit_with_error("Job name is required to run a job.")
|
||||
|
||||
|
||||
@@ -369,7 +369,7 @@ class _Environment(MetaClasses.Serializable):
|
||||
env = cls.from_workflow_data()
|
||||
env.dump()
|
||||
return env
|
||||
except FileNotFoundError as e:
|
||||
except FileNotFoundError:
|
||||
# For workflows without Config job
|
||||
print(
|
||||
f"NOTE: Workflow context file [{Settings.WORKFLOW_STATUS_FILE}] does not exist - read context from GH event"
|
||||
@@ -425,7 +425,7 @@ class _Environment(MetaClasses.Serializable):
|
||||
prefix = f"REFs/{branch}"
|
||||
assert sha or latest
|
||||
if latest:
|
||||
prefix += f"/latest"
|
||||
prefix += "/latest"
|
||||
elif sha:
|
||||
prefix += f"/{sha}"
|
||||
return prefix
|
||||
|
||||
@@ -53,7 +53,7 @@ class Cache:
|
||||
)
|
||||
assert (
|
||||
Settings.CACHE_S3_PATH
|
||||
), f"Setting CACHE_S3_PATH must be defined with enabled CI Cache"
|
||||
), "Setting CACHE_S3_PATH must be defined with enabled CI Cache"
|
||||
record_path = f"{Settings.CACHE_S3_PATH}/v{Settings.CACHE_VERSION}/{Utils.normalize_string(job_name)}/{job_digest}/{type_}"
|
||||
record_file = Path(Settings.TEMP_DIR) / type_
|
||||
record.dump(record_file)
|
||||
@@ -69,7 +69,7 @@ class Cache:
|
||||
type_ = Cache.CacheRecord.Type.SUCCESS
|
||||
assert (
|
||||
Settings.CACHE_S3_PATH
|
||||
), f"Setting CACHE_S3_PATH must be defined with enabled CI Cache"
|
||||
), "Setting CACHE_S3_PATH must be defined with enabled CI Cache"
|
||||
record_path = f"{Settings.CACHE_S3_PATH}/v{Settings.CACHE_VERSION}/{Utils.normalize_string(job_name)}/{job_digest}/{type_}"
|
||||
record_file_local_dir = (
|
||||
f"{Settings.CACHE_LOCAL_PATH}/{Utils.normalize_string(job_name)}/"
|
||||
|
||||
+1
-2
@@ -1,7 +1,6 @@
|
||||
import copy
|
||||
import dataclasses
|
||||
import json
|
||||
import os
|
||||
import time
|
||||
import urllib
|
||||
from typing import List, Optional
|
||||
@@ -404,7 +403,7 @@ ORDER BY day DESC
|
||||
# Create a session object
|
||||
params = {
|
||||
"database": Settings.CI_DB_DB_NAME,
|
||||
"query": f"SELECT 1",
|
||||
"query": "SELECT 1",
|
||||
}
|
||||
error = ""
|
||||
for retry in range(2):
|
||||
|
||||
@@ -31,7 +31,7 @@ class StateMachine:
|
||||
self.state_updated_at = int(time.time())
|
||||
# TODO: add monitoring
|
||||
if not self.machine.is_actions_process_healthy():
|
||||
print(f"ERROR: GH runner process unexpectedly died")
|
||||
print("ERROR: GH runner process unexpectedly died")
|
||||
self.machine.self_terminate(decrease_capacity=False)
|
||||
elif self.state == self.StateNames.WAIT:
|
||||
res = self.machine.check_job_assigned()
|
||||
@@ -59,7 +59,7 @@ class StateMachine:
|
||||
return
|
||||
if ScalingType.AUTOMATIC_SCALE_UP_DOWN and not self.forked:
|
||||
print(
|
||||
f"Scaling type is AUTOMATIC_SCALE_UP_DOWN and machine has not run a job - do not scale down"
|
||||
"Scaling type is AUTOMATIC_SCALE_UP_DOWN and machine has not run a job - do not scale down"
|
||||
)
|
||||
return
|
||||
if (
|
||||
@@ -108,7 +108,7 @@ class StateMachine:
|
||||
class Machine:
|
||||
@staticmethod
|
||||
def get_latest_gh_actions_release():
|
||||
url = f"https://api.github.com/repos/actions/runner/releases/latest"
|
||||
url = "https://api.github.com/repos/actions/runner/releases/latest"
|
||||
response = requests.get(url, timeout=5)
|
||||
if response.status_code == 200:
|
||||
latest_release = response.json()
|
||||
@@ -152,9 +152,9 @@ class Machine:
|
||||
strict=True,
|
||||
verbose=True,
|
||||
)
|
||||
Shell.check(f"tar xzf *tar.gz", strict=True, verbose=True)
|
||||
Shell.check(f"rm -f *tar.gz", strict=True, verbose=True)
|
||||
Shell.check(f"sudo ./bin/installdependencies.sh", strict=True, verbose=True)
|
||||
Shell.check("tar xzf *tar.gz", strict=True, verbose=True)
|
||||
Shell.check("rm -f *tar.gz", strict=True, verbose=True)
|
||||
Shell.check("sudo ./bin/installdependencies.sh", strict=True, verbose=True)
|
||||
Shell.check(
|
||||
f"chown -R ubuntu:ubuntu {ExecutionSettings.GH_ACTIONS_DIRECTORY}",
|
||||
strict=True,
|
||||
@@ -209,7 +209,7 @@ class Machine:
|
||||
|
||||
def check_job_running(self):
|
||||
if self.proc is None:
|
||||
print(f"WARNING: No job started")
|
||||
print("WARNING: No job started")
|
||||
return False
|
||||
exit_code = self.proc.poll()
|
||||
if exit_code is None:
|
||||
@@ -271,7 +271,7 @@ class Machine:
|
||||
print(f"Error output: {stderr}")
|
||||
return False
|
||||
else:
|
||||
print(f"GH Action process is not running")
|
||||
print("GH Action process is not running")
|
||||
return False
|
||||
except Exception as e:
|
||||
print(f"GH Action process exception: {e}")
|
||||
|
||||
+2
-2
@@ -78,7 +78,7 @@ class GH:
|
||||
raise RuntimeError(
|
||||
f"Failed to extract repository name from remote URL [{repo_url}]"
|
||||
)
|
||||
sha = Shell.get_output(f"git rev-parse HEAD", strict=True)
|
||||
sha = Shell.get_output("git rev-parse HEAD", strict=True)
|
||||
|
||||
assert repo_name
|
||||
print(repo_name)
|
||||
@@ -648,7 +648,7 @@ class GH:
|
||||
# Pass --repo so gh does not probe git remotes (Docker mounts can hit
|
||||
# "detected dubious ownership" and fail comment creation).
|
||||
cmd = f"gh pr comment {pr} --repo {repo} --body-file {temp_file_path}"
|
||||
print(f"Create new comment")
|
||||
print("Create new comment")
|
||||
res = cls.do_command_with_retries(cmd)
|
||||
else:
|
||||
print(
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import json
|
||||
from dataclasses import asdict, dataclass, field
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import json
|
||||
from dataclasses import asdict, dataclass, field
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import json
|
||||
import os
|
||||
import sys
|
||||
import zipfile
|
||||
from dataclasses import asdict, dataclass, field
|
||||
from dataclasses import dataclass, field
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict, List
|
||||
|
||||
@@ -323,7 +323,7 @@ class Lambda:
|
||||
|
||||
# Fetch secrets and merge with environment (secrets overwrite existing)
|
||||
if self.secrets:
|
||||
print(f"Fetching secrets from Parameter Store...")
|
||||
print("Fetching secrets from Parameter Store...")
|
||||
secrets_env = self._fetch_secrets()
|
||||
environment = {**environment, **secrets_env}
|
||||
print(
|
||||
@@ -352,7 +352,7 @@ class Lambda:
|
||||
print(
|
||||
f"Code unchanged for Lambda function: {function_name} (SHA256: {new_code_sha256})"
|
||||
)
|
||||
print(f"Skipping code update")
|
||||
print("Skipping code update")
|
||||
else:
|
||||
# Function exists, update it
|
||||
print(f"Code changed for Lambda function: {function_name}")
|
||||
@@ -376,7 +376,7 @@ class Lambda:
|
||||
)
|
||||
if config_changed:
|
||||
if code_updated:
|
||||
print(f"Waiting for code update to complete...")
|
||||
print("Waiting for code update to complete...")
|
||||
waiter = lambda_client.get_waiter("function_updated")
|
||||
waiter.wait(FunctionName=function_name)
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@ def publish_home_view(
|
||||
|
||||
def handle_slash_command(form: dict):
|
||||
user_id = form.get("user_id", [""])[0]
|
||||
command = form.get("command", [""])[0]
|
||||
form.get("command", [""])[0]
|
||||
text = form.get("text", [""])[0].strip()
|
||||
username = form.get("user_name", [""])[0]
|
||||
response_url = form.get("response_url", [""])[0]
|
||||
|
||||
@@ -978,7 +978,7 @@ def lambda_handler(event, context):
|
||||
ext = getattr(newest_event, "ext", {}) or {}
|
||||
pr_number = ext.get("pr_number", 0) or 0
|
||||
repo_name = ext.get("repo_name", "")
|
||||
pr_title = ext.get("pr_title", "")
|
||||
ext.get("pr_title", "")
|
||||
sha = getattr(newest_event, "sha", "")
|
||||
ci_status = (
|
||||
getattr(newest_event, "ci_status", "") or ""
|
||||
|
||||
@@ -102,7 +102,7 @@ class EC2:
|
||||
"""Detect the current AWS region from instance metadata, falling back to the default."""
|
||||
try:
|
||||
cls.region_name = EC2.get_instance_metadata("placement/region")
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
pass
|
||||
return cls.region_name
|
||||
|
||||
@@ -312,14 +312,14 @@ class Runner:
|
||||
|
||||
self.config()
|
||||
self.run_job()
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
self.remove_if_not_running()
|
||||
raise
|
||||
|
||||
log(f"Completed jobs: {self.completed_jobs}/{config.max_jobs}")
|
||||
# macOS runners run continuously without job limits
|
||||
if config.init_environment != Environment.MACOS and self.completed_jobs >= config.max_jobs:
|
||||
raise Exception(f"Runner completed max number of jobs")
|
||||
raise Exception("Runner completed max number of jobs")
|
||||
|
||||
def run_job(self) -> None:
|
||||
"""Execute one iteration of the runner loop."""
|
||||
@@ -360,7 +360,7 @@ class Runner:
|
||||
|
||||
try:
|
||||
Monitor.check_termination_flag()
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
self.ec2.scale_down()
|
||||
raise
|
||||
Runner.check_post_run()
|
||||
@@ -806,7 +806,7 @@ class Monitor:
|
||||
last_job_time = start_time
|
||||
runner_state = "starting"
|
||||
last_job_start_time = start_time
|
||||
Monitor.log(f"started")
|
||||
Monitor.log("started")
|
||||
|
||||
while True:
|
||||
time.sleep(20)
|
||||
@@ -1021,7 +1021,7 @@ if __name__ == "__main__":
|
||||
monitor.daemonize()
|
||||
runner.run()
|
||||
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
if config.init_environment != Environment.MACOS:
|
||||
ec2.terminate()
|
||||
raise
|
||||
|
||||
@@ -559,10 +559,10 @@ if __name__ == "__main__":
|
||||
Path(temp_path).mkdir(exist_ok=True)
|
||||
|
||||
def collect_and_upload():
|
||||
print(f"Fetching active testing issues...")
|
||||
print("Fetching active testing issues...")
|
||||
c = TestCaseIssueCatalog.from_gh()
|
||||
c.dump()
|
||||
print(f"Uploading to S3...")
|
||||
print("Uploading to S3...")
|
||||
url = c.to_s3()
|
||||
print(f"Catalog uploaded to S3: {url}")
|
||||
return bool(url)
|
||||
|
||||
+1
-2
@@ -1,11 +1,10 @@
|
||||
import copy
|
||||
import fnmatch
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
from dataclasses import dataclass, field
|
||||
from pathlib import Path, PurePosixPath
|
||||
from typing import Any, Iterable, List, Optional
|
||||
from typing import Any, List, Optional
|
||||
|
||||
from . import Artifact
|
||||
from .utils import Shell, Utils
|
||||
|
||||
@@ -6,7 +6,6 @@ import shlex
|
||||
import sys
|
||||
import traceback
|
||||
from pathlib import Path
|
||||
from typing import Dict
|
||||
|
||||
from . import Job, Workflow
|
||||
from ._environment import _Environment
|
||||
@@ -33,7 +32,7 @@ def _GH_Auth(force=False):
|
||||
return
|
||||
from .gh_auth import GHAuth
|
||||
|
||||
if force or not Shell.check(f"gh auth status", verbose=True):
|
||||
if force or not Shell.check("gh auth status", verbose=True):
|
||||
GHAuth.auth_from_settings()
|
||||
|
||||
|
||||
@@ -576,7 +575,7 @@ def _config_workflow(workflow: Workflow.Config, job_name) -> Result:
|
||||
# - all authors who contributed to the PR
|
||||
# - the original commit messages before GitHub's ephemeral merge commit
|
||||
commands = [
|
||||
f"git rev-parse --is-shallow-repository | grep -q true && git fetch --unshallow --prune --no-recurse-submodules --filter=tree:0 origin HEAD ||:",
|
||||
"git rev-parse --is-shallow-repository | grep -q true && git fetch --unshallow --prune --no-recurse-submodules --filter=tree:0 origin HEAD ||:",
|
||||
]
|
||||
if env.BASE_BRANCH and env.PR_NUMBER:
|
||||
commands.append(
|
||||
@@ -805,7 +804,7 @@ def _config_workflow(workflow: Workflow.Config, job_name) -> Result:
|
||||
workflow_config = CacheRunnerHooks.configure(workflow, skip_lookup=skip_lookup)
|
||||
files.append(RunConfig.file_name_static(workflow.name))
|
||||
res = True
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
res = False
|
||||
traceback.print_exc()
|
||||
info = traceback.format_exc()
|
||||
@@ -1097,7 +1096,7 @@ def _finish_workflow(workflow, job_name):
|
||||
)
|
||||
if not fast_test_failed and ready_for_merge_status != Result.Status.OK:
|
||||
print(
|
||||
f"NOTE: Revert PR detected - setting merge status to success despite failures"
|
||||
"NOTE: Revert PR detected - setting merge status to success despite failures"
|
||||
)
|
||||
ready_for_merge_status = Result.Status.OK
|
||||
ready_for_merge_description = "Revert PR"
|
||||
@@ -1110,7 +1109,7 @@ def _finish_workflow(workflow, job_name):
|
||||
description=ready_for_merge_description,
|
||||
url="",
|
||||
):
|
||||
print(f"ERROR: failed to set ReadyForMerge status")
|
||||
print("ERROR: failed to set ReadyForMerge status")
|
||||
env.add_workflow_error(ResultInfo.GH_STATUS_ERROR)
|
||||
|
||||
if update_final_report:
|
||||
@@ -1145,7 +1144,7 @@ if __name__ == "__main__":
|
||||
result = _finish_workflow(workflow, job_name)
|
||||
else:
|
||||
assert False, f"BUG, job name [{job_name}]"
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
error_traceback = traceback.format_exc()
|
||||
print("Failed with Exception:")
|
||||
print(error_traceback)
|
||||
|
||||
@@ -11,7 +11,7 @@ import time
|
||||
import traceback
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
from pathlib import Path
|
||||
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union
|
||||
from typing import Any, Dict, List, Optional, Union
|
||||
|
||||
from ._environment import _Environment
|
||||
from .event import Event
|
||||
|
||||
+14
-14
@@ -471,8 +471,8 @@ class Runner:
|
||||
print(f"Custom --count [{count}] will be passed to job's script")
|
||||
cmd += f" --count {count}"
|
||||
if debug:
|
||||
print(f"Custom --debug will be passed to job's script")
|
||||
cmd += f" --debug"
|
||||
print("Custom --debug will be passed to job's script")
|
||||
cmd += " --debug"
|
||||
if path:
|
||||
print(f"Custom --path [{path}] will be passed to job's script")
|
||||
cmd += f" --path {path}"
|
||||
@@ -490,7 +490,7 @@ class Runner:
|
||||
preserve_stdio=preserve_stdio,
|
||||
timeout_shell_cleanup=job.timeout_shell_cleanup,
|
||||
) as process:
|
||||
start_time = Utils.timestamp()
|
||||
Utils.timestamp()
|
||||
|
||||
exit_code = process.wait()
|
||||
|
||||
@@ -499,7 +499,7 @@ class Runner:
|
||||
# reading the result file or writing the host-side result, so that the
|
||||
# host user can open them without a PermissionError.
|
||||
if job.run_in_docker and not no_docker and from_root:
|
||||
print(f"--- Fixing file ownership after running docker as root")
|
||||
print("--- Fixing file ownership after running docker as root")
|
||||
uid = os.getuid()
|
||||
gid = os.getgid()
|
||||
chown_cmd = f"docker run --rm --user root --volume {host_dir_q}:{current_dir} --workdir={current_dir} {docker} chown -R {uid}:{gid} {Settings.TEMP_DIR}"
|
||||
@@ -584,7 +584,7 @@ class Runner:
|
||||
result.update_duration()
|
||||
result.set_files([Settings.RUN_LOG], strict=False)
|
||||
if job.force_success and not result.is_ok():
|
||||
print(f"NOTE: Job has force_success=True - overriding status to OK")
|
||||
print("NOTE: Job has force_success=True - overriding status to OK")
|
||||
result.set_status(Result.Status.OK)
|
||||
return result
|
||||
|
||||
@@ -761,7 +761,7 @@ class Runner:
|
||||
|
||||
# always in the end
|
||||
if workflow.enable_cache:
|
||||
print(f"Run CI cache hook")
|
||||
print("Run CI cache hook")
|
||||
if result.is_ok():
|
||||
CacheRunnerHooks.post_run(workflow, job)
|
||||
|
||||
@@ -797,11 +797,11 @@ class Runner:
|
||||
env.add_workflow_error(
|
||||
"Failed to post GH commit status for the job"
|
||||
)
|
||||
print(f"ERROR: Failed to post commit status for the job")
|
||||
print("ERROR: Failed to post commit status for the job")
|
||||
|
||||
# Always run report generation at the end to finalize workflow status with latest job result
|
||||
if workflow.enable_report:
|
||||
print(f"Run html report hook")
|
||||
print("Run html report hook")
|
||||
status_updated = HtmlRunnerHooks.post_run(workflow, job)
|
||||
if status_updated:
|
||||
print(f"Update GH commit status [{result.name}]: [{status_updated}]")
|
||||
@@ -845,7 +845,7 @@ class Runner:
|
||||
comment_tags_and_bodies={"summary": summary_body},
|
||||
only_update=True,
|
||||
):
|
||||
print(f"ERROR: failed to post CI summary")
|
||||
print("ERROR: failed to post CI summary")
|
||||
except Exception as e:
|
||||
print(f"ERROR: failed to post CI summary, ex: {e}")
|
||||
traceback.print_exc()
|
||||
@@ -1008,7 +1008,7 @@ class Runner:
|
||||
print(f"ERROR: Setup env script failed with exception [{e}]")
|
||||
traceback.print_exc()
|
||||
Info().store_traceback()
|
||||
print(f"=== Setup env finished ===\n\n")
|
||||
print("=== Setup env finished ===\n\n")
|
||||
else:
|
||||
self.generate_local_run_environment(
|
||||
workflow, job, pr=pr, sha=sha, branch=branch
|
||||
@@ -1037,7 +1037,7 @@ class Runner:
|
||||
print(f"ERROR: Pre-run script failed with exception [{e}]")
|
||||
traceback.print_exc()
|
||||
Info().store_traceback()
|
||||
print(f"=== Pre run finished ===\n\n")
|
||||
print("=== Pre run finished ===\n\n")
|
||||
|
||||
prehook_result = None
|
||||
if res and run_hooks and job.pre_hooks:
|
||||
@@ -1085,7 +1085,7 @@ class Runner:
|
||||
f"Job got terminated with an error, exit code [{run_code}]"
|
||||
).dump()
|
||||
|
||||
print(f"=== Run script finished ===\n\n")
|
||||
print("=== Run script finished ===\n\n")
|
||||
|
||||
if run_hooks:
|
||||
result = self._get_result_object(
|
||||
@@ -1106,7 +1106,7 @@ class Runner:
|
||||
result.results.append(
|
||||
Result.create_from(name="Post Hooks", results=results_, stopwatch=sw_)
|
||||
)
|
||||
print(f"=== Post hooks finished ===")
|
||||
print("=== Post hooks finished ===")
|
||||
|
||||
if not local_run:
|
||||
print(f"=== Post run script [{job.name}], workflow [{workflow.name}] ===")
|
||||
@@ -1114,7 +1114,7 @@ class Runner:
|
||||
result, workflow, job, run_code
|
||||
)
|
||||
res = res and post_res
|
||||
print(f"=== Post run script finished ===")
|
||||
print("=== Post run script finished ===")
|
||||
|
||||
result.dump()
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import json
|
||||
from dataclasses import dataclass
|
||||
from typing import Any, Dict, List
|
||||
|
||||
|
||||
+4
-4
@@ -4,7 +4,7 @@ import mimetypes
|
||||
import os
|
||||
import time
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict
|
||||
from typing import Dict
|
||||
from urllib.parse import quote
|
||||
|
||||
from ._environment import _Environment
|
||||
@@ -235,7 +235,7 @@ class S3:
|
||||
f"aws s3api put-object --bucket {bucket} --key {key} --body {local_path}"
|
||||
)
|
||||
if if_none_matched:
|
||||
command += f' --if-none-match "*"'
|
||||
command += ' --if-none-match "*"'
|
||||
if if_match:
|
||||
command += f' --if-match "{if_match}"'
|
||||
if metadata:
|
||||
@@ -622,7 +622,7 @@ class S3:
|
||||
if version == 0:
|
||||
# DESTRUCTIVE: Version 0 overwrites without conditions (NOT safe for concurrent use)
|
||||
print(
|
||||
f"Uploading file with version 0 (destructive reset) using boto3"
|
||||
"Uploading file with version 0 (destructive reset) using boto3"
|
||||
)
|
||||
client.upload_file(
|
||||
str(local_path), bucket, key, ExtraArgs=extra_args
|
||||
@@ -691,7 +691,7 @@ class S3:
|
||||
if version == 0:
|
||||
# DESTRUCTIVE: Version 0 uploads without conditions (NOT safe for concurrent use)
|
||||
print(
|
||||
f"Uploading file with version 0 (destructive reset) using AWS CLI"
|
||||
"Uploading file with version 0 (destructive reset) using AWS CLI"
|
||||
)
|
||||
result_uploaded = cls.put(
|
||||
s3_path=s3_path,
|
||||
|
||||
@@ -223,7 +223,7 @@ def _get_settings() -> _Settings:
|
||||
value = getattr(foo, setting)
|
||||
res.__setattr__(setting, value)
|
||||
# print(f"- read user defined setting [{setting} = {value}]")
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
# print(f"Exception while read user settings: {e}")
|
||||
pass
|
||||
|
||||
|
||||
@@ -304,7 +304,7 @@ class Shell:
|
||||
|
||||
# Force kill if still running
|
||||
if process.poll() is None:
|
||||
print(f"WARNING: Process still running after SIGTERM, sending SIGKILL")
|
||||
print("WARNING: Process still running after SIGTERM, sending SIGKILL")
|
||||
try:
|
||||
os.killpg(process.pid, signal.SIGKILL)
|
||||
except ProcessLookupError:
|
||||
@@ -417,7 +417,7 @@ class Shell:
|
||||
err in err_line for err_line in err_output for err in retry_errors
|
||||
):
|
||||
if verbose:
|
||||
print(f"No retryable errors found, stopping retries")
|
||||
print("No retryable errors found, stopping retries")
|
||||
break
|
||||
|
||||
if verbose:
|
||||
@@ -439,7 +439,7 @@ class Shell:
|
||||
else:
|
||||
print(f"Retry {retry+1}/{retries}: exception {e}")
|
||||
if retry == retries - 1:
|
||||
print(f"ERROR: Final attempt failed, no more retries left.")
|
||||
print("ERROR: Final attempt failed, no more retries left.")
|
||||
if proc:
|
||||
proc.kill()
|
||||
if retry == retries - 1:
|
||||
|
||||
@@ -34,7 +34,7 @@ class Validator:
|
||||
if Settings.USE_CUSTOM_GH_AUTH and not Settings.GH_AUTH_LAMBDA_NAME:
|
||||
cls.evaluate_check_simple(
|
||||
Settings.SECRET_GH_APP_ID and Settings.SECRET_GH_APP_PEM_KEY and Settings.SECRET_GH_APP_INSTALLATION_ID,
|
||||
f"Setting SECRET_GH_APP_ID, SECRET_GH_APP_PEM_KEY and SECRET_GH_APP_INSTALLATION_ID must be provided with USE_CUSTOM_GH_AUTH == True",
|
||||
"Setting SECRET_GH_APP_ID, SECRET_GH_APP_PEM_KEY and SECRET_GH_APP_INSTALLATION_ID must be provided with USE_CUSTOM_GH_AUTH == True",
|
||||
)
|
||||
|
||||
workflows = _get_workflows(_for_validation_check=True)
|
||||
@@ -174,26 +174,26 @@ class Validator:
|
||||
and Settings.DOCKER_BUILD_AMD_RUNS_ON
|
||||
and Settings.DOCKER_BUILD_ARM_RUNS_ON
|
||||
!= Settings.DOCKER_BUILD_AMD_RUNS_ON,
|
||||
f"Settings: DOCKER_MERGE_RUNS_ON, DOCKER_BUILD_ARM_RUNS_ON, DOCKER_BUILD_AMD_RUNS_ON must be provided and be different CPU architecture machines",
|
||||
"Settings: DOCKER_MERGE_RUNS_ON, DOCKER_BUILD_ARM_RUNS_ON, DOCKER_BUILD_AMD_RUNS_ON must be provided and be different CPU architecture machines",
|
||||
)
|
||||
else:
|
||||
cls.evaluate_check(
|
||||
Settings.DOCKER_MERGE_RUNS_ON,
|
||||
f"DOCKER_BUILD_AND_MERGE_RUNS_ON settings must be defined if workflow has dockers",
|
||||
"DOCKER_BUILD_AND_MERGE_RUNS_ON settings must be defined if workflow has dockers",
|
||||
workflow_name=workflow.name,
|
||||
)
|
||||
|
||||
if workflow.set_latest_for_docker_merged_manifest:
|
||||
cls.evaluate_check(
|
||||
workflow.enable_dockers_manifest_merge,
|
||||
f".set_latest_for_docker_merged_manifest workflow setting is applicable with .enable_dockers_manifest_merge=True",
|
||||
".set_latest_for_docker_merged_manifest workflow setting is applicable with .enable_dockers_manifest_merge=True",
|
||||
workflow_name=workflow.name,
|
||||
)
|
||||
|
||||
if workflow.enable_open_issues_check:
|
||||
cls.evaluate_check(
|
||||
workflow.enable_report,
|
||||
f".enable_open_issues_check workflow setting is applicable with .enable_report=True",
|
||||
".enable_open_issues_check workflow setting is applicable with .enable_report=True",
|
||||
workflow_name=workflow.name,
|
||||
)
|
||||
|
||||
@@ -229,7 +229,7 @@ class Validator:
|
||||
if workflow.enable_open_issues_check:
|
||||
cls.evaluate_check(
|
||||
workflow.enable_merge_ready_status,
|
||||
f".enable_open_issues_check workflow setting is applicable with .enable_merge_ready_status=True",
|
||||
".enable_open_issues_check workflow setting is applicable with .enable_merge_ready_status=True",
|
||||
workflow_name=workflow.name,
|
||||
)
|
||||
|
||||
@@ -390,7 +390,7 @@ class Validator:
|
||||
if check_ok:
|
||||
return
|
||||
else:
|
||||
print(f"ERROR: Validation failed:")
|
||||
print("ERROR: Validation failed:")
|
||||
for message in messages:
|
||||
print(" || " + message)
|
||||
raise
|
||||
|
||||
@@ -46,11 +46,9 @@ import sys
|
||||
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../.."))
|
||||
|
||||
import pytest
|
||||
from ci.praktika.job import Job
|
||||
from ci.praktika.native_jobs import _filter_unaffected_jobs
|
||||
from ci.praktika.runtime import RunConfig
|
||||
from ci.praktika.utils import Utils
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from praktika import Workflow
|
||||
|
||||
from ci.defs.defs import DOCKERS, SECRETS, ArtifactConfigs, ArtifactNames, JobNames
|
||||
from ci.defs.defs import DOCKERS, SECRETS, ArtifactConfigs, ArtifactNames
|
||||
from ci.defs.job_configs import JobConfigs
|
||||
|
||||
workflow = Workflow.Config(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from praktika import Workflow
|
||||
|
||||
from ci.defs.defs import BASE_BRANCH, DOCKERS, SECRETS, ArtifactConfigs, ArtifactNames
|
||||
from ci.defs.defs import BASE_BRANCH, DOCKERS, SECRETS, ArtifactConfigs
|
||||
from ci.defs.job_configs import JobConfigs
|
||||
|
||||
# TODO: add alert on workflow failure
|
||||
|
||||
@@ -7,7 +7,6 @@ from ci.defs.defs import (
|
||||
ArtifactConfigs,
|
||||
ArtifactNames,
|
||||
BuildTypes,
|
||||
RunnerLabels,
|
||||
)
|
||||
from ci.defs.job_configs import JobConfigs
|
||||
|
||||
|
||||
+16
-7
@@ -53,20 +53,29 @@ extend-exclude = [
|
||||
]
|
||||
|
||||
[tool.ruff.lint]
|
||||
# Start narrow: only rules that catch real bugs with low false-positive rate.
|
||||
# Each rule below was hand-picked because every hit was either a genuine bug
|
||||
# or an obviously dead reference (e.g. PR #105159: undefined name in an f-string
|
||||
# only evaluated on a diagnostic branch, masking the real failure).
|
||||
# The first batch (F402/F522/F523/F601/F632/F811/F821) was hand-picked because
|
||||
# every hit was either a genuine bug or an obviously dead reference (e.g.
|
||||
# PR #105159: undefined name in an f-string only evaluated on a diagnostic
|
||||
# branch, masking the real failure).
|
||||
#
|
||||
# Stylistic / unused-name rules (F401, F541, F841, F403, F405) are intentionally
|
||||
# off for now — they need a separate cleanup pass and would drown out the
|
||||
# bug-class signal.
|
||||
# The unused-name / star-import rules below (F401/F403/F405/F541/F841) were
|
||||
# enabled in a follow-up after a dedicated cleanup pass: unused imports and
|
||||
# variables removed (keeping side-effecting calls), placeholder-less f-strings
|
||||
# de-prefixed, and every `from module import *` expanded into explicit imports.
|
||||
# Eliminating the star imports also turned up a real bug — a call to an
|
||||
# undefined `execute_instant_query_with_http_api` in the prometheus presets
|
||||
# helper that the wildcard had been masking from F821.
|
||||
select = [
|
||||
"F401", # unused-import
|
||||
"F402", # import-shadowed-by-loop-var
|
||||
"F403", # undefined-local-with-import-star (`from module import *`)
|
||||
"F405", # undefined-local-with-import-star-usage
|
||||
"F522", # string-format-extra-named-arg
|
||||
"F523", # string-format-extra-positional-arg
|
||||
"F541", # f-string-missing-placeholders
|
||||
"F601", # multi-value-repeated-key-literal
|
||||
"F632", # is-literal (e.g. `x is "foo"`, always False under CPython)
|
||||
"F811", # redefined-while-unused (duplicate function/import definitions)
|
||||
"F821", # undefined-name (the PR #105159 class)
|
||||
"F841", # local-variable-assigned-but-never-used
|
||||
]
|
||||
|
||||
@@ -19,7 +19,7 @@ from pyiceberg.transforms import (
|
||||
)
|
||||
|
||||
try:
|
||||
from pyspark.sql.types import VariantType
|
||||
from pyspark.sql.types import VariantType # noqa: F401 (import probe)
|
||||
|
||||
HAS_VARIANT_TYPE = True
|
||||
except ImportError:
|
||||
|
||||
@@ -32,7 +32,7 @@ from pyspark.sql.types import (
|
||||
)
|
||||
|
||||
try:
|
||||
from pyspark.sql.types import VariantType, VariantVal
|
||||
from pyspark.sql.types import VariantType, VariantVal # noqa: F401 (import probe)
|
||||
|
||||
HAS_VARIANT_TYPE = True
|
||||
except ImportError:
|
||||
@@ -556,7 +556,7 @@ class LakeDataGenerator:
|
||||
spark,
|
||||
f"MERGE INTO {table.get_table_full_path()} AS t USING updates AS s ON t.{next_pick} = s.{next_pick}\
|
||||
WHEN MATCHED THEN {random.choice(match_options)}{' WHEN NOT MATCHED BY TARGET THEN INSERT *' if random.randint(1, 4) == 1 else ''}\
|
||||
{f' WHEN NOT MATCHED BY SOURCE THEN DELETE' if random.randint(1, 4) == 1 else ''};",
|
||||
{' WHEN NOT MATCHED BY SOURCE THEN DELETE' if random.randint(1, 4) == 1 else ''};",
|
||||
)
|
||||
|
||||
def delete_table(self, spark: SparkSession, table: SparkTable):
|
||||
|
||||
@@ -639,7 +639,7 @@ logger.jetty.level = warn
|
||||
elif storage == TableStorage.Azure:
|
||||
# For Azurite local emulation
|
||||
builder.config(
|
||||
f"spark.hadoop.fs.azure.storage.emulator.account.name",
|
||||
"spark.hadoop.fs.azure.storage.emulator.account.name",
|
||||
cluster.azurite_account,
|
||||
)
|
||||
builder.config(
|
||||
|
||||
@@ -2,7 +2,7 @@ import logging
|
||||
import random
|
||||
import traceback
|
||||
|
||||
from integration.helpers.kafka.common_direct import KafkaAdminClient
|
||||
from kafka import KafkaAdminClient
|
||||
import integration.helpers.kafka.common as k
|
||||
|
||||
|
||||
|
||||
@@ -428,7 +428,7 @@ if args.with_minio:
|
||||
os.environ["MINIO_SECRET_KEY"] = minio_secret_key
|
||||
with open(credentials_file.name, "w+") as file:
|
||||
file.write(
|
||||
f"[default]\naws_access_key_id = testing\naws_secret_access_key = testing\naws_session_token = testing\naws_region = us-east-1\naws_endpoint_url = http://localhost:3000\n"
|
||||
"[default]\naws_access_key_id = testing\naws_secret_access_key = testing\naws_session_token = testing\naws_region = us-east-1\naws_endpoint_url = http://localhost:3000\n"
|
||||
)
|
||||
os.environ["AWS_CONFIG_FILE"] = credentials_file.name
|
||||
os.environ["AWS_SHARED_CREDENTIALS_FILE"] = credentials_file.name
|
||||
@@ -535,7 +535,7 @@ if args.with_postgresql:
|
||||
ip=cluster.postgres_ip, port=cluster.postgres_port
|
||||
)
|
||||
cursor = postgres_conn.cursor()
|
||||
cursor.execute(f"CREATE DATABASE test")
|
||||
cursor.execute("CREATE DATABASE test")
|
||||
cursor.close()
|
||||
postgres_conn.close()
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ class ElOracloDeLeaks:
|
||||
self.snapshots.clear()
|
||||
baseline = self._get_memory_snapshot("baseline", cluster)
|
||||
if baseline is None:
|
||||
self.logger.error(f"Could not get baseline capture")
|
||||
self.logger.error("Could not get baseline capture")
|
||||
return
|
||||
self.snapshots.append(baseline)
|
||||
self._print_snapshot(baseline)
|
||||
@@ -114,7 +114,7 @@ class ElOracloDeLeaks:
|
||||
"""
|
||||
# Check baseline
|
||||
if len(self.snapshots) == 0:
|
||||
self.logger.error(f"No previous captures exist")
|
||||
self.logger.error("No previous captures exist")
|
||||
return
|
||||
leak_detected = False
|
||||
try:
|
||||
@@ -183,7 +183,7 @@ class ElOracloDeLeaks:
|
||||
or result2 == ""
|
||||
):
|
||||
self.logger.warning(
|
||||
f"Could not fetch number of merges or mutations"
|
||||
"Could not fetch number of merges or mutations"
|
||||
)
|
||||
return False
|
||||
|
||||
@@ -200,7 +200,7 @@ class ElOracloDeLeaks:
|
||||
"SELECT name FROM system.databases WHERE name NOT IN ('system', 'information_schema', 'INFORMATION_SCHEMA');"
|
||||
)
|
||||
if not isinstance(dbs_str, str) or dbs_str == "":
|
||||
self.logger.warning(f"Could not fetch databases")
|
||||
self.logger.warning("Could not fetch databases")
|
||||
return False
|
||||
fetched_dbs: list[str] = [line for line in dbs_str.split("\n") if line]
|
||||
for db_name in fetched_dbs:
|
||||
|
||||
@@ -27,8 +27,8 @@ class BackgroundWorker:
|
||||
def _handle_result(self, future):
|
||||
"""Handle task completion or errors"""
|
||||
try:
|
||||
result = future.result() # This will raise if the task failed
|
||||
self.logger.debug(f"Async task completed successfully")
|
||||
future.result() # This will raise if the task failed
|
||||
self.logger.debug("Async task completed successfully")
|
||||
except Exception as e:
|
||||
self.logger.exception(f"Async task failed: {e}")
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import sys
|
||||
import time
|
||||
from contextlib import contextmanager
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict, Iterator, List, Optional, Sequence, Tuple, Union
|
||||
from typing import Any, Iterator, List, Optional, Sequence, Tuple, Union
|
||||
|
||||
import requests
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ from datetime import date, datetime, timedelta
|
||||
from os import path as p
|
||||
from pathlib import Path
|
||||
from time import sleep
|
||||
from typing import Any, Callable, List, Optional, Tuple, Union
|
||||
from typing import Any, List, Optional, Tuple, Union
|
||||
|
||||
import github
|
||||
import requests
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ import json
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
from typing import Dict, List, Set, Union
|
||||
from typing import Dict, Union
|
||||
from urllib.parse import quote
|
||||
|
||||
from unidiff import PatchSet # type: ignore
|
||||
|
||||
@@ -9,7 +9,6 @@ anywhere. Label constants mirror `pr_info.Labels` and are kept local to avoid
|
||||
importing the heavyweight `cherry_pick` module.
|
||||
"""
|
||||
import unittest
|
||||
from typing import List, Set
|
||||
|
||||
from cherry_pick_branches import (
|
||||
backport_floor,
|
||||
|
||||
@@ -443,7 +443,7 @@ def main():
|
||||
for future in as_completed(futures):
|
||||
fuzzer = futures[future]
|
||||
try:
|
||||
result = future.result()
|
||||
future.result()
|
||||
logging.info("Thread for %s finished", fuzzer)
|
||||
except Exception as exc:
|
||||
logging.info("Thread for %s generated an exception: %s", fuzzer, exc)
|
||||
|
||||
@@ -8,7 +8,7 @@ from pathlib import Path
|
||||
|
||||
import pytest # pylint:disable=import-error; for style check
|
||||
|
||||
from helpers.cluster import is_port_free, run_and_check
|
||||
from helpers.cluster import run_and_check
|
||||
|
||||
# This is a workaround for a problem with logging in pytest [1].
|
||||
#
|
||||
|
||||
@@ -5,7 +5,7 @@ import time
|
||||
import uuid
|
||||
from dataclasses import dataclass
|
||||
from datetime import datetime, timezone
|
||||
from typing import Dict, List, Optional, Tuple
|
||||
from typing import Dict, List, Optional
|
||||
|
||||
import gcsfs
|
||||
import pyarrow as pa
|
||||
|
||||
@@ -59,11 +59,29 @@ from minio import Minio
|
||||
|
||||
from . import pytest_xdist_logging_to_separate_files
|
||||
from .client import Client, QueryRuntimeException
|
||||
from .config_cluster import *
|
||||
from .config_cluster import (
|
||||
dremio_pass,
|
||||
dremio_user,
|
||||
minio_access_key,
|
||||
minio_secret_key,
|
||||
mongo_pass,
|
||||
mongo_user,
|
||||
mysql_pass,
|
||||
mysql_user,
|
||||
nats_pass,
|
||||
nats_user,
|
||||
odbc_mysql_db,
|
||||
odbc_mysql_uid,
|
||||
odbc_psql_db,
|
||||
odbc_psql_user,
|
||||
pg_db,
|
||||
pg_pass,
|
||||
pg_user,
|
||||
)
|
||||
from .kazoo_client import KazooClientWithImplicitRetries
|
||||
from .random_settings import write_random_settings_config
|
||||
from .retry_decorator import retry
|
||||
from .test_tools import assert_eq_with_retry, exec_query_with_retry
|
||||
from .test_tools import exec_query_with_retry
|
||||
|
||||
HELPERS_DIR = p.dirname(__file__)
|
||||
CLICKHOUSE_ROOT_DIR = p.join(p.dirname(__file__), "../../..")
|
||||
@@ -600,7 +618,7 @@ class ClickHouseCluster:
|
||||
# [1]: https://github.com/ClickHouse/ClickHouse/issues/43426#issuecomment-1368512678
|
||||
self.env_variables["ASAN_OPTIONS"] = "use_sigaltstack=0"
|
||||
# In integration tests we spawn multiple servers, so let's aim to not more then 5GiB
|
||||
self.env_variables["TSAN_OPTIONS"] = f"use_sigaltstack=0 memory_limit_mb=5120"
|
||||
self.env_variables["TSAN_OPTIONS"] = "use_sigaltstack=0 memory_limit_mb=5120"
|
||||
self.env_variables["CLICKHOUSE_WATCHDOG_ENABLE"] = "0"
|
||||
self.env_variables["CLICKHOUSE_NATS_TLS_SECURE"] = "0"
|
||||
|
||||
@@ -928,7 +946,7 @@ class ClickHouseCluster:
|
||||
logging.debug(f"Removed :{self.instances_dir}")
|
||||
|
||||
if with_spark:
|
||||
import pyspark
|
||||
pass
|
||||
|
||||
# (
|
||||
# pyspark.sql.SparkSession.builder.appName("spark_test")
|
||||
@@ -1184,7 +1202,7 @@ class ClickHouseCluster:
|
||||
if unstopped_containers:
|
||||
logging.debug(f"Left unstopped containers: {unstopped_containers}")
|
||||
else:
|
||||
logging.debug(f"Unstopped containers killed.")
|
||||
logging.debug("Unstopped containers killed.")
|
||||
else:
|
||||
logging.debug(f"No running containers for project: {self.project_name}")
|
||||
except Exception as ex:
|
||||
@@ -3207,7 +3225,7 @@ class ClickHouseCluster:
|
||||
subprocess.check_call( # STYLE_CHECK_ALLOW_SUBPROCESS_CHECK_CALL
|
||||
self.base_kafka_cmd + ["logs"], stdout=f
|
||||
)
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
logging.debug("Unable to get logs from docker.")
|
||||
raise Exception("Kafka is not available")
|
||||
|
||||
@@ -3324,7 +3342,7 @@ class ClickHouseCluster:
|
||||
subprocess.check_call( # STYLE_CHECK_ALLOW_SUBPROCESS_CHECK_CALL
|
||||
self.base_minio_cmd + ["logs"], stdout=f
|
||||
)
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
logging.debug("Unable to get logs from docker.")
|
||||
|
||||
raise Exception("Can't wait Minio to start")
|
||||
@@ -3430,7 +3448,6 @@ class ClickHouseCluster:
|
||||
|
||||
start = time.time()
|
||||
sr_started = False
|
||||
sr_auth_started = False
|
||||
while time.time() - start < timeout:
|
||||
try:
|
||||
sr_client._send_request(sr_client.url)
|
||||
@@ -3576,7 +3593,7 @@ class ClickHouseCluster:
|
||||
|
||||
try:
|
||||
self.cleanup()
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
logging.warning("Cleanup failed:{e}")
|
||||
|
||||
try:
|
||||
@@ -3917,7 +3934,7 @@ class ClickHouseCluster:
|
||||
self.up_called = True
|
||||
self.rabbitmq_docker_id = self.get_instance_docker_id("rabbitmq1")
|
||||
time.sleep(2)
|
||||
logging.debug(f"RabbitMQ checking container try")
|
||||
logging.debug("RabbitMQ checking container try")
|
||||
self.wait_rabbitmq_to_start()
|
||||
|
||||
if self.with_nats and self.base_nats_cmd:
|
||||
@@ -4121,7 +4138,7 @@ class ClickHouseCluster:
|
||||
)
|
||||
run_and_check(arrowflight_start_cmd)
|
||||
|
||||
logging.error(f'Trying to connect to Arrowflight...')
|
||||
logging.error('Trying to connect to Arrowflight...')
|
||||
self.wait_arrowflight_to_start()
|
||||
|
||||
clickhouse_start_cmd = self.base_cmd + ["up", "-d", "--no-recreate"]
|
||||
@@ -4838,7 +4855,7 @@ class ClickHouseInstance:
|
||||
if pids_limit is not None:
|
||||
self.pids_limit = f"pids_limit: {pids_limit}"
|
||||
else:
|
||||
self.pids_limit = f"pids_limit: 5000"
|
||||
self.pids_limit = "pids_limit: 5000"
|
||||
|
||||
self.base_config_dir = (
|
||||
p.abspath(p.join(base_path, base_config_dir)) if base_config_dir else None
|
||||
@@ -5434,7 +5451,7 @@ class ClickHouseInstance:
|
||||
try:
|
||||
self.wait_start(start_wait_sec + start_time - time.time())
|
||||
return exec_id
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
logging.warning(
|
||||
f"Current start attempt failed. Will kill {pid} just in case."
|
||||
)
|
||||
@@ -5474,7 +5491,7 @@ class ClickHouseInstance:
|
||||
if time.time() > start_time + start_wait_sec:
|
||||
break
|
||||
logging.error(
|
||||
f"No time left to start. But process is still running. Will dump threads."
|
||||
"No time left to start. But process is still running. Will dump threads."
|
||||
)
|
||||
ps_clickhouse = self.exec_in_container(
|
||||
["bash", "-c", "ps -C clickhouse"], nothrow=True, user="root"
|
||||
@@ -5497,7 +5514,7 @@ class ClickHouseInstance:
|
||||
return
|
||||
time.sleep(1)
|
||||
logging.error(
|
||||
f"No time left to shutdown. Process is still running. Will dump threads."
|
||||
"No time left to shutdown. Process is still running. Will dump threads."
|
||||
)
|
||||
ps_clickhouse = self.exec_in_container(
|
||||
["bash", "-c", "ps -C clickhouse"], nothrow=True, user="root"
|
||||
@@ -5569,7 +5586,7 @@ class ClickHouseInstance:
|
||||
def grep_in_log(
|
||||
self, substring, from_host=False, filename="clickhouse-server.log", after=None, only_latest=False
|
||||
):
|
||||
logging.debug(f"grep in log called %s", substring)
|
||||
logging.debug("grep in log called %s", substring)
|
||||
if after is not None:
|
||||
after_opt = "-A{}".format(after)
|
||||
else:
|
||||
@@ -5782,7 +5799,7 @@ class ClickHouseInstance:
|
||||
# wait start
|
||||
time_left = begin_time + stop_start_wait_sec - time.time()
|
||||
if time_left <= 0:
|
||||
raise Exception(f"No time left during restart")
|
||||
raise Exception("No time left during restart")
|
||||
else:
|
||||
self.wait_start(time_left)
|
||||
|
||||
@@ -5863,7 +5880,7 @@ class ClickHouseInstance:
|
||||
# wait start
|
||||
time_left = begin_time + stop_start_wait_sec - time.time()
|
||||
if time_left <= 0:
|
||||
raise Exception(f"No time left during restart")
|
||||
raise Exception("No time left during restart")
|
||||
else:
|
||||
self.wait_start(time_left)
|
||||
|
||||
@@ -6081,7 +6098,7 @@ class ClickHouseInstance:
|
||||
delimiter = d
|
||||
break
|
||||
else:
|
||||
raise Exception(f"Couldn't find a suitable delimiter")
|
||||
raise Exception("Couldn't find a suitable delimiter")
|
||||
replace = shlex.quote(replace)
|
||||
replacement = shlex.quote(replacement)
|
||||
self.exec_in_container(
|
||||
@@ -6195,10 +6212,9 @@ class ClickHouseInstance:
|
||||
# If custom main config is used, do not apply random settings to it
|
||||
write_random_settings_config(Path(users_d_dir) / "0_random_settings.xml")
|
||||
|
||||
version = None
|
||||
version_parts = self.tag.split(".")
|
||||
if version_parts[0].isdigit() and version_parts[1].isdigit():
|
||||
version = {"major": int(version_parts[0]), "minor": int(version_parts[1])}
|
||||
{"major": int(version_parts[0]), "minor": int(version_parts[1])}
|
||||
|
||||
logging.debug("Generate and write macros file")
|
||||
macros = self.macros.copy()
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import os
|
||||
|
||||
import tempfile
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
def get_database_disk_name(node):
|
||||
|
||||
@@ -267,7 +267,6 @@ class DictionaryStructure(object):
|
||||
or_default = ""
|
||||
field_name = ""
|
||||
date_expr = ""
|
||||
def_for_get = ""
|
||||
else:
|
||||
what = "Get"
|
||||
|
||||
|
||||
@@ -253,7 +253,7 @@ class SourceMongo(ExternalSource):
|
||||
row_dict[cell_name] = self.converters[cell_name](cell_value)
|
||||
to_insert.append(row_dict)
|
||||
|
||||
result = tbl.insert_many(to_insert)
|
||||
tbl.insert_many(to_insert)
|
||||
|
||||
|
||||
class SourceMongoURI(SourceMongo):
|
||||
|
||||
@@ -4,7 +4,6 @@ import csv
|
||||
import socket
|
||||
import ssl
|
||||
import logging
|
||||
import signal
|
||||
from http.server import BaseHTTPRequestHandler, HTTPServer
|
||||
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ from pyspark.sql.types import (
|
||||
from pyspark.sql.window import Window
|
||||
from pyspark.sql.functions import expr
|
||||
|
||||
from helpers.cluster import ClickHouseCluster, ClickHouseInstance
|
||||
from helpers.cluster import ClickHouseCluster
|
||||
from helpers.s3_tools import (
|
||||
AzureUploader,
|
||||
LocalUploader,
|
||||
|
||||
@@ -1,5 +1,24 @@
|
||||
from .common_direct import *
|
||||
from .common_direct import _VarintBytes
|
||||
from contextlib import contextmanager
|
||||
import io
|
||||
import logging
|
||||
import os.path as p
|
||||
import random
|
||||
import socket
|
||||
import string
|
||||
import time
|
||||
|
||||
import avro.schema
|
||||
from confluent_kafka.avro.serializer.message_serializer import MessageSerializer
|
||||
from kafka import BrokerConnection, KafkaAdminClient, KafkaConsumer, KafkaProducer
|
||||
from kafka.admin import NewTopic
|
||||
import kafka.errors
|
||||
from kafka.protocol.admin import DescribeGroupsRequest_v1
|
||||
from kafka.protocol.group import MemberAssignment
|
||||
|
||||
from helpers.client import QueryRuntimeException
|
||||
from helpers.kafka import kafka_pb2, oneof_transaction_pb2, social_pb2
|
||||
from helpers.test_tools import TSV
|
||||
from google.protobuf.internal.encoder import _VarintBytes
|
||||
|
||||
|
||||
def get_kafka_producer(port, serializer, retries):
|
||||
@@ -235,7 +254,6 @@ def kafka_produce_protobuf_messages_protobuflist(
|
||||
def kafka_produce_protobuf_messages_no_delimiters(
|
||||
kafka_cluster, topic, start_index, num_messages
|
||||
):
|
||||
data = ""
|
||||
producer = KafkaProducer(
|
||||
bootstrap_servers="localhost:{}".format(kafka_cluster.kafka_port)
|
||||
)
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
import json
|
||||
import io
|
||||
import logging
|
||||
import math
|
||||
import os.path as p
|
||||
import random
|
||||
import socket
|
||||
import string
|
||||
import threading
|
||||
|
||||
import time
|
||||
from contextlib import contextmanager
|
||||
|
||||
import pytest
|
||||
|
||||
import avro.datafile
|
||||
import avro.io
|
||||
import avro.schema
|
||||
from confluent_kafka.avro.cached_schema_registry_client import (
|
||||
CachedSchemaRegistryClient,
|
||||
)
|
||||
|
||||
import kafka.errors
|
||||
from confluent_kafka.avro.serializer.message_serializer import MessageSerializer
|
||||
from kafka import BrokerConnection, KafkaAdminClient, KafkaConsumer, KafkaProducer
|
||||
from kafka.admin import NewTopic
|
||||
from kafka.protocol.admin import DescribeGroupsRequest_v1
|
||||
from kafka.protocol.group import MemberAssignment
|
||||
|
||||
from ..client import QueryRuntimeException
|
||||
from ..cluster import ClickHouseCluster
|
||||
from ..network import PartitionManager
|
||||
from ..test_tools import TSV, assert_eq_with_retry
|
||||
|
||||
from ..kafka import kafka_pb2, social_pb2, message_with_repeated_pb2, oneof_transaction_pb2
|
||||
|
||||
from google.protobuf.internal.encoder import _VarintBytes
|
||||
@@ -56,7 +56,7 @@ def generate_keeper_configs(configs_dir, clusters):
|
||||
f" </server>"
|
||||
)
|
||||
return (
|
||||
f"<clickhouse>\n"
|
||||
"<clickhouse>\n"
|
||||
+ (f"{storage_block}\n" if storage_block else "")
|
||||
+ f" <keeper_server>{snapshot_disk_line}\n"
|
||||
f" <tcp_port>9181</tcp_port>\n"
|
||||
@@ -73,9 +73,9 @@ def generate_keeper_configs(configs_dir, clusters):
|
||||
f"\n"
|
||||
f" <raft_configuration>\n"
|
||||
+ "\n".join(servers) + "\n"
|
||||
f" </raft_configuration>\n"
|
||||
f" </keeper_server>\n"
|
||||
f"</clickhouse>\n"
|
||||
" </raft_configuration>\n"
|
||||
" </keeper_server>\n"
|
||||
"</clickhouse>\n"
|
||||
)
|
||||
|
||||
os.makedirs(configs_dir, exist_ok=True)
|
||||
|
||||
@@ -8,7 +8,7 @@ import subprocess
|
||||
import time
|
||||
import struct
|
||||
from os import path as p
|
||||
from typing import Iterable, List, Optional, Sequence, Union
|
||||
from typing import List, Optional, Sequence, Union
|
||||
|
||||
from helpers.kazoo_client import KazooClientWithImplicitRetries
|
||||
from kazoo.exceptions import ConnectionLoss, OperationTimeoutError
|
||||
@@ -155,7 +155,7 @@ class KeeperClient(object):
|
||||
while True:
|
||||
events = self.poller.poll(timeout)
|
||||
if not events:
|
||||
raise TimeoutError(f"Keeper client returned no output")
|
||||
raise TimeoutError("Keeper client returned no output")
|
||||
|
||||
# Process stderr events before stdout to ensure errors are
|
||||
# collected before checking the stdout separator.
|
||||
|
||||
@@ -276,7 +276,7 @@ class NetThroughput(object):
|
||||
]
|
||||
).strip()
|
||||
break
|
||||
except Exception as ex:
|
||||
except Exception:
|
||||
print(f"No interface eth{i}")
|
||||
else:
|
||||
raise Exception(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import random
|
||||
import time
|
||||
from typing import List, Type
|
||||
from typing import Type
|
||||
|
||||
|
||||
def retry(
|
||||
|
||||
@@ -1,14 +1,8 @@
|
||||
import io
|
||||
import json
|
||||
import logging
|
||||
import random
|
||||
import string
|
||||
import time
|
||||
import uuid
|
||||
from multiprocessing.dummy import Pool
|
||||
import pytest
|
||||
from minio.deleteobjects import DeleteObject
|
||||
from helpers.cluster import ClickHouseCluster, ClickHouseInstance
|
||||
from helpers.config_cluster import minio_secret_key
|
||||
|
||||
DEFAULT_AUTH = ["'minio'", f"'{minio_secret_key}'"]
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
import glob
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
from enum import Enum
|
||||
|
||||
from minio import Minio
|
||||
|
||||
|
||||
class CloudUploader:
|
||||
|
||||
@@ -42,7 +42,7 @@ def wait_resolver(cluster):
|
||||
[
|
||||
"curl",
|
||||
"-s",
|
||||
f"http://resolver:8080/hostname",
|
||||
"http://resolver:8080/hostname",
|
||||
],
|
||||
nothrow=True,
|
||||
)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import time
|
||||
|
||||
from helpers.test_tools import assert_eq_with_retry
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ def test_alter_database_comment(started_cluster, engine):
|
||||
== modified_comment
|
||||
)
|
||||
|
||||
node1.query(f"DETACH DATABASE test ON CLUSTER test_cluster")
|
||||
node1.query("DETACH DATABASE test ON CLUSTER test_cluster")
|
||||
|
||||
assert (
|
||||
node1.query("SELECT count() FROM system.databases WHERE name='test'").strip()
|
||||
@@ -85,7 +85,7 @@ def test_alter_database_comment(started_cluster, engine):
|
||||
== "0"
|
||||
)
|
||||
|
||||
node1.query(f"ATTACH DATABASE test ON CLUSTER test_cluster")
|
||||
node1.query("ATTACH DATABASE test ON CLUSTER test_cluster")
|
||||
|
||||
assert (
|
||||
node1.query("SELECT comment FROM system.databases WHERE name='test'").strip()
|
||||
|
||||
@@ -235,7 +235,7 @@ def test_delete_race_leftovers(cluster):
|
||||
for i in range(100):
|
||||
known_remote_paths = set(
|
||||
node.query(
|
||||
f"SELECT remote_path FROM system.remote_data_paths WHERE disk_name = 's32'"
|
||||
"SELECT remote_path FROM system.remote_data_paths WHERE disk_name = 's32'"
|
||||
).splitlines()
|
||||
)
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user