ci-queue
Advanced tools
+1
-1
| PATH | ||
| remote: . | ||
| specs: | ||
| ci-queue (0.90.0) | ||
| ci-queue (0.91.0) | ||
| logger | ||
@@ -6,0 +6,0 @@ |
@@ -9,2 +9,3 @@ # frozen_string_literal: true | ||
| attr_accessor :max_test_failed, :redis_ttl, :warnings_file, :debug_log, :max_missed_heartbeat_seconds | ||
| attr_writer :heartbeat_max_test_duration | ||
| attr_accessor :lazy_load, :lazy_load_stream_batch_size | ||
@@ -61,3 +62,3 @@ attr_writer :lazy_load_streaming_timeout | ||
| queue_init_timeout: nil, redis_ttl: 8 * 60 * 60, report_timeout: nil, inactive_workers_timeout: nil, | ||
| export_flaky_tests_file: nil, warnings_file: nil, debug_log: nil, max_missed_heartbeat_seconds: nil, | ||
| export_flaky_tests_file: nil, warnings_file: nil, debug_log: nil, max_missed_heartbeat_seconds: nil, heartbeat_max_test_duration: nil, | ||
| lazy_load: false, lazy_load_stream_batch_size: nil, lazy_load_streaming_timeout: nil, lazy_load_test_helpers: nil, | ||
@@ -91,2 +92,3 @@ skip_stale_tests: false) | ||
| @max_missed_heartbeat_seconds = max_missed_heartbeat_seconds | ||
| @heartbeat_max_test_duration = heartbeat_max_test_duration | ||
| @lazy_load = lazy_load | ||
@@ -159,2 +161,6 @@ @lazy_load_stream_batch_size = lazy_load_stream_batch_size || 5_000 | ||
| def heartbeat_max_test_duration | ||
| @heartbeat_max_test_duration || (timeout * 10 if max_missed_heartbeat_seconds) | ||
| end | ||
| def max_consecutive_failures=(max) | ||
@@ -161,0 +167,0 @@ if max |
@@ -66,3 +66,3 @@ # frozen_string_literal: true | ||
| ensure_heartbeat_thread_alive! | ||
| heartbeat_state.set(:tick, id, lease) | ||
| heartbeat_state.set(:tick, id, lease, Process.clock_gettime(Process::CLOCK_MONOTONIC)) | ||
| end | ||
@@ -390,2 +390,4 @@ | ||
| capped = false | ||
| loop do | ||
@@ -396,7 +398,21 @@ command = heartbeat_state.wait(1) # waits for max 1 second but wakes up immediately if we receive a command | ||
| when :tick | ||
| # command = [:tick, entry_id, lease_id] | ||
| next if capped | ||
| max_duration = config.heartbeat_max_test_duration | ||
| if max_duration | ||
| # command = [:tick, entry_id, lease_id, started_at] | ||
| # Use the absolute start time from when with_heartbeat was called so that | ||
| # the elapsed calculation is not skewed by heartbeat thread startup delay. | ||
| elapsed = Process.clock_gettime(Process::CLOCK_MONOTONIC) - command[3] | ||
| if elapsed >= max_duration | ||
| capped = true | ||
| next | ||
| end | ||
| end | ||
| # command = [:tick, entry_id, lease_id, started_at] | ||
| heartbeat_process.tick!(command[1], command[2]) | ||
| when :reset | ||
| # Test finished, stop ticking until next test starts | ||
| nil | ||
| capped = false | ||
| when :stop | ||
@@ -403,0 +419,0 @@ break |
@@ -5,3 +5,3 @@ # frozen_string_literal: true | ||
| module Queue | ||
| VERSION = '0.90.0' | ||
| VERSION = '0.91.0' | ||
| DEV_SCRIPTS_ROOT = ::File.expand_path('../../../../../redis', __FILE__) | ||
@@ -8,0 +8,0 @@ RELEASE_SCRIPTS_ROOT = ::File.expand_path('../redis', __FILE__) |
@@ -739,3 +739,13 @@ # frozen_string_literal: true | ||
| help = <<~EOS | ||
| Maximum duration in seconds that the heartbeat will tick for a single test. | ||
| If a test runs longer than this, the heartbeat stops and the test entry becomes | ||
| eligible for reclamation by another worker. | ||
| Defaults to timeout * 10 when heartbeat is enabled. | ||
| EOS | ||
| opts.on("--heartbeat-max-test-duration SECONDS", Float, help) do |seconds| | ||
| queue_config.heartbeat_max_test_duration = seconds | ||
| end | ||
| opts.on("-v", "--verbose", "Verbose. Show progress processing files.") do | ||
@@ -742,0 +752,0 @@ self.verbose = true |