mirror of
https://github.com/discourse/discourse.git
synced 2025-04-28 03:34:31 +08:00
DEV: Report runtime duration of each parallel test process (#32457)
This information is generally useful to know and it simple for us to instrument.
This commit is contained in:
parent
27ebf5f41a
commit
2dfafe3fd2
@ -163,8 +163,14 @@ module TurboTests
|
|||||||
end
|
end
|
||||||
|
|
||||||
def start_subprocess(env, extra_args, tests, process_id, record_runtime:)
|
def start_subprocess(env, extra_args, tests, process_id, record_runtime:)
|
||||||
|
exit_message = {
|
||||||
|
type: "exit",
|
||||||
|
process_id:,
|
||||||
|
start_time: Process.clock_gettime(Process::CLOCK_MONOTONIC),
|
||||||
|
}
|
||||||
|
|
||||||
if tests.empty?
|
if tests.empty?
|
||||||
@messages << { type: "exit", process_id: process_id }
|
@messages << exit_message
|
||||||
else
|
else
|
||||||
tmp_filename = "tmp/test-pipes/subprocess-#{process_id}"
|
tmp_filename = "tmp/test-pipes/subprocess-#{process_id}"
|
||||||
|
|
||||||
@ -221,7 +227,7 @@ module TurboTests
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@messages << { type: "exit", process_id: process_id }
|
@messages << exit_message
|
||||||
end
|
end
|
||||||
|
|
||||||
@threads << start_copy_thread(stdout, STDOUT)
|
@threads << start_copy_thread(stdout, STDOUT)
|
||||||
@ -296,7 +302,11 @@ module TurboTests
|
|||||||
exited += 1
|
exited += 1
|
||||||
|
|
||||||
if @reporter.formatters.any? { |f| f.is_a?(DocumentationFormatter) }
|
if @reporter.formatters.any? { |f| f.is_a?(DocumentationFormatter) }
|
||||||
@reporter.message("[#{message[:process_id]}] DONE (#{exited}/#{@num_processes + 1})")
|
duration = Process.clock_gettime(Process::CLOCK_MONOTONIC) - message[:start_time]
|
||||||
|
|
||||||
|
@reporter.message(
|
||||||
|
"[#{message[:process_id]}] DONE (#{exited}/#{@num_processes + 1}) #{duration.round(2)}s",
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
break if exited == @num_processes + 1
|
break if exited == @num_processes + 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user