Class: ActiveSupport::Testing::ParallelizeExecutor
- Defined in:
- activesupport/lib/active_support/testing/parallelize_executor.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#parallelize_with ⇒ Object
readonly
Returns the value of attribute parallelize_with.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#threshold ⇒ Object
readonly
Returns the value of attribute threshold.
-
#work_stealing ⇒ Object
readonly
Returns the value of attribute work_stealing.
Instance Method Summary collapse
- #<<(work) ⇒ Object
-
#initialize(size:, with:, threshold: ActiveSupport.test_parallelization_threshold, work_stealing: false) ⇒ ParallelizeExecutor
constructor
A new instance of ParallelizeExecutor.
- #shutdown ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(size:, with:, threshold: ActiveSupport.test_parallelization_threshold, work_stealing: false) ⇒ ParallelizeExecutor
Returns a new instance of ParallelizeExecutor.
8 9 10 11 12 13 14 |
# File 'activesupport/lib/active_support/testing/parallelize_executor.rb', line 8 def initialize(size:, with:, threshold: ActiveSupport.test_parallelization_threshold, work_stealing: false) @size = size @parallelize_with = with @threshold = threshold @work_stealing = work_stealing @parallelized = false end |
Instance Attribute Details
#parallelize_with ⇒ Object (readonly)
Returns the value of attribute parallelize_with.
6 7 8 |
# File 'activesupport/lib/active_support/testing/parallelize_executor.rb', line 6 def parallelize_with @parallelize_with end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
6 7 8 |
# File 'activesupport/lib/active_support/testing/parallelize_executor.rb', line 6 def size @size end |
#threshold ⇒ Object (readonly)
Returns the value of attribute threshold.
6 7 8 |
# File 'activesupport/lib/active_support/testing/parallelize_executor.rb', line 6 def threshold @threshold end |
#work_stealing ⇒ Object (readonly)
Returns the value of attribute work_stealing.
6 7 8 |
# File 'activesupport/lib/active_support/testing/parallelize_executor.rb', line 6 def work_stealing @work_stealing end |
Instance Method Details
#<<(work) ⇒ Object
23 24 25 |
# File 'activesupport/lib/active_support/testing/parallelize_executor.rb', line 23 def <<(work) parallel_executor << work if parallelized? end |
#shutdown ⇒ Object
27 28 29 |
# File 'activesupport/lib/active_support/testing/parallelize_executor.rb', line 27 def shutdown parallel_executor.shutdown if parallelized? end |
#start ⇒ Object
16 17 18 19 20 21 |
# File 'activesupport/lib/active_support/testing/parallelize_executor.rb', line 16 def start parallelize if should_parallelize? show_execution_info parallel_executor.start if parallelized? end |