mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-09 17:14:47 +00:00
Add reset to Stopwatch, improve codebrowser report
This commit is contained in:
parent
56a48037ba
commit
ee5ca7337e
@ -87,25 +87,37 @@ def main():
|
||||
|
||||
report_path = result_path / "html_report"
|
||||
logging.info("Report path %s", report_path)
|
||||
|
||||
s3_path_prefix = "codebrowser"
|
||||
index_template = (
|
||||
f'<a href="{S3_DOWNLOAD}/{S3_TEST_REPORTS_BUCKET}/{s3_path_prefix}/index.html">'
|
||||
"{}</a>"
|
||||
)
|
||||
additional_logs = [path.absolute() for path in result_path.glob("*.log")]
|
||||
test_results = [
|
||||
TestResult(
|
||||
index_template.format("Generate codebrowser site"),
|
||||
state,
|
||||
stopwatch.duration_seconds,
|
||||
additional_logs,
|
||||
)
|
||||
]
|
||||
|
||||
if state == "success":
|
||||
stopwatch.reset()
|
||||
_ = s3_helper.fast_parallel_upload_dir(
|
||||
report_path, s3_path_prefix, S3_TEST_REPORTS_BUCKET
|
||||
)
|
||||
|
||||
index_html = (
|
||||
f'<a href="{S3_DOWNLOAD}/{S3_TEST_REPORTS_BUCKET}/codebrowser/index.html">'
|
||||
"Generate codebrowser site</a>"
|
||||
)
|
||||
|
||||
additional_logs = [path.absolute() for path in result_path.glob("*.log")]
|
||||
|
||||
test_results = [
|
||||
TestResult(index_html, state, stopwatch.duration_seconds, additional_logs)
|
||||
]
|
||||
test_results.append(
|
||||
TestResult(
|
||||
index_template.format("Upload codebrowser site"),
|
||||
state,
|
||||
stopwatch.duration_seconds,
|
||||
)
|
||||
)
|
||||
|
||||
# Check if the run log contains `FATAL Error:`, that means the code problem
|
||||
stopwatch = Stopwatch()
|
||||
stopwatch.reset()
|
||||
fatal_error = "FATAL Error:"
|
||||
logging.info("Search for '%s' in %s", fatal_error, run_log_path)
|
||||
with open(run_log_path, "r", encoding="utf-8") as rlfd:
|
||||
|
@ -5,8 +5,7 @@ import datetime
|
||||
|
||||
class Stopwatch:
|
||||
def __init__(self):
|
||||
self.start_time = datetime.datetime.utcnow()
|
||||
self.start_time_str_value = self.start_time.strftime("%Y-%m-%d %H:%M:%S")
|
||||
self.reset()
|
||||
|
||||
@property
|
||||
def duration_seconds(self) -> float:
|
||||
@ -15,3 +14,7 @@ class Stopwatch:
|
||||
@property
|
||||
def start_time_str(self) -> str:
|
||||
return self.start_time_str_value
|
||||
|
||||
def reset(self) -> None:
|
||||
self.start_time = datetime.datetime.utcnow()
|
||||
self.start_time_str_value = self.start_time.strftime("%Y-%m-%d %H:%M:%S")
|
||||
|
Loading…
Reference in New Issue
Block a user