-
-
Save anonymous/ce3fdb19a8abc235cd6d5454ae3cd66d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def self.set_threads(num_threads) | |
# puts "Creating thread pool with #{num_threads} threads" | |
@thread_pool = Concurrent::FixedThreadPool.new(num_threads) | |
end | |
... | |
for index in 0..(samples.size - samples_to_mix) do | |
futures.push Concurrent::Future.new( | |
# arguments for Future construction | |
{ | |
# @thread_pool must already be set | |
:executor => @thread_pool, | |
# these args will be passed to the Proc upon execution | |
# failure to properly pass the args will result in the Proc sharing | |
# values between multple Futures | |
:args => [index, samples_to_mix, samples[index]] | |
} | |
) { |index, samples_to_mix, sample| | |
MixtureMaker.mix_and_count_recursive( \ | |
index + 1, \ | |
samples_to_mix - 1, \ | |
sample | |
) | |
}.execute | |
end | |
futures.each_with_index { |future, index| | |
temp_allele_counts_by_locus, temp_max_alleles_total, temp_different_maxes, temp_dropin_total = future.value | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment