class ActiveSupport::Testing::ParallelizeExecutor
Experimental RBS support (using type sampling data from the type_fusion
project).
# sig/active_support/testing/parallelize_executor.rbs class ActiveSupport::Testing::ParallelizeExecutor def <<: (Array[Class] work) -> Thread::Queue def execution_info: () -> String def initialize: (size: Integer, with: Symbol, threshold: Integer) -> void def parallelized?: () -> nil def should_parallelize?: () -> false def show_execution_info: () -> nil def shutdown: () -> nil def start: () -> nil def tests_count: () -> Integer end
:nodoc:
def <<(work)
Experimental RBS support (using type sampling data from the type_fusion
project).
def <<: (String | DRb::DRbObject work) -> Thread::Queue
This signature was generated using 1 sample from 1 application.
def <<(work) parallel_executor << work if parallelized? end
def build_parallel_executor
def build_parallel_executor case parallelize_with when :processes Testing::Parallelization.new(size) when :threads ActiveSupport::TestCase.lock_threads = false if defined?(ActiveSupport::TestCase.lock_threads) Minitest::Parallel::Executor.new(size) else raise ArgumentError, "#{parallelize_with} is not a supported parallelization executor." end end
def execution_info
Experimental RBS support (using type sampling data from the type_fusion
project).
def execution_info: () -> String
This signature was generated using 3 samples from 1 application.
def execution_info if parallelized? "Running #{tests_count} tests in parallel using #{parallel_executor.size} #{parallelize_with}" else "Running #{tests_count} tests in a single process (parallelization threshold is #{threshold})" end end
def initialize(size:, with:, threshold: ActiveSupport.test_parallelization_threshold)
Experimental RBS support (using type sampling data from the type_fusion
project).
def initialize: (size: Integer, with: Symbol, threshold: Integer) -> void
This signature was generated using 2 samples from 1 application.
def initialize(size:, with:, threshold: ActiveSupport.test_parallelization_threshold) @size = size @parallelize_with = with @threshold = threshold end
def parallel_executor
def parallel_executor @parallel_executor ||= build_parallel_executor end
def parallelize
def parallelize @parallelized = true Minitest::Test.parallelize_me! end
def parallelized?
Experimental RBS support (using type sampling data from the type_fusion
project).
def parallelized?: () -> nil
This signature was generated using 6 samples from 1 application.
def parallelized? @parallelized if defined?(@parallelized) end
def should_parallelize?
Experimental RBS support (using type sampling data from the type_fusion
project).
def should_parallelize?: () -> false
This signature was generated using 3 samples from 1 application.
def should_parallelize? ENV["PARALLEL_WORKERS"] || tests_count > threshold end
def show_execution_info
Experimental RBS support (using type sampling data from the type_fusion
project).
def show_execution_info: () -> nil
This signature was generated using 3 samples from 1 application.
def show_execution_info puts execution_info end
def shutdown
Experimental RBS support (using type sampling data from the type_fusion
project).
def shutdown: () -> nil
This signature was generated using 2 samples from 1 application.
def shutdown parallel_executor.shutdown if parallelized? end
def start
Experimental RBS support (using type sampling data from the type_fusion
project).
def start: () -> nil
This signature was generated using 2 samples from 1 application.
def start parallelize if should_parallelize? show_execution_info parallel_executor.start if parallelized? end
def tests_count
Experimental RBS support (using type sampling data from the type_fusion
project).
def tests_count: () -> Integer
This signature was generated using 6 samples from 1 application.
def tests_count @tests_count ||= Minitest::Runnable.runnables.sum { |runnable| runnable.runnable_methods.size } end