Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package rubygem-parallel for
openSUSE:Factory checked in at 2022-05-02 16:24:43
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-parallel (Old)
and /work/SRC/openSUSE:Factory/.rubygem-parallel.new.1538 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-parallel"
Mon May 2 16:24:43 2022 rev:8 rq:974061 version:1.22.1
Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-parallel/rubygem-parallel.changes
2021-10-12 21:48:55.519834957 +0200
+++
/work/SRC/openSUSE:Factory/.rubygem-parallel.new.1538/rubygem-parallel.changes
2022-05-02 16:24:48.716787661 +0200
@@ -1,0 +2,6 @@
+Thu Apr 28 05:39:54 UTC 2022 - Stephan Kulow <[email protected]>
+
+updated to version 1.22.1
+ no changelog found
+
+-------------------------------------------------------------------
Old:
----
parallel-1.21.0.gem
New:
----
parallel-1.22.1.gem
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ rubygem-parallel.spec ++++++
--- /var/tmp/diff_new_pack.5F5rcz/_old 2022-05-02 16:24:49.484788515 +0200
+++ /var/tmp/diff_new_pack.5F5rcz/_new 2022-05-02 16:24:49.484788515 +0200
@@ -1,7 +1,7 @@
#
# spec file for package rubygem-parallel
#
-# Copyright (c) 2021 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -24,7 +24,7 @@
#
Name: rubygem-parallel
-Version: 1.21.0
+Version: 1.22.1
Release: 0
%define mod_name parallel
%define mod_full_name %{mod_name}-%{version}
++++++ parallel-1.21.0.gem -> parallel-1.22.1.gem ++++++
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/parallel/processor_count.rb
new/lib/parallel/processor_count.rb
--- old/lib/parallel/processor_count.rb 2021-09-13 06:47:27.000000000 +0200
+++ new/lib/parallel/processor_count.rb 2022-03-26 00:34:29.000000000 +0100
@@ -1,11 +1,10 @@
# frozen_string_literal: true
-require 'etc'
-
module Parallel
# TODO: inline this method into parallel.rb and kill
physical_processor_count in next major release
module ProcessorCount
# Number of processors seen by the OS, used for process scheduling
def processor_count
+ require 'etc'
@processor_count ||= Integer(ENV['PARALLEL_PROCESSOR_COUNT'] ||
Etc.nprocessors)
end
@@ -19,7 +18,7 @@
when /linux/
cores = {} # unique physical ID / core ID combinations
phy = 0
- IO.read("/proc/cpuinfo").scan(/^physical id.*|^core id.*/) do |ln|
+ File.read("/proc/cpuinfo").scan(/^physical id.*|^core id.*/) do
|ln|
if ln.start_with?("physical")
phy = ln[/\d+/]
elsif ln.start_with?("core")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/parallel/version.rb new/lib/parallel/version.rb
--- old/lib/parallel/version.rb 2021-09-13 06:47:27.000000000 +0200
+++ new/lib/parallel/version.rb 2022-03-26 00:34:29.000000000 +0100
@@ -1,4 +1,4 @@
# frozen_string_literal: true
module Parallel
- VERSION = Version = '1.21.0' # rubocop:disable Naming/ConstantName
+ VERSION = Version = '1.22.1' # rubocop:disable Naming/ConstantName
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/parallel.rb new/lib/parallel.rb
--- old/lib/parallel.rb 2021-09-13 06:47:27.000000000 +0200
+++ new/lib/parallel.rb 2022-03-26 00:34:29.000000000 +0100
@@ -264,6 +264,9 @@
elsif options[:in_threads]
method = :in_threads
size = options[method]
+ elsif options[:in_ractors]
+ method = :in_ractors
+ size = options[method]
else
method = :in_processes
if Process.respond_to?(:fork)
@@ -285,6 +288,8 @@
work_direct(job_factory, options, &block)
elsif method == :in_threads
work_in_threads(job_factory, options.merge(count: size), &block)
+ elsif method == :in_ractors
+ work_in_ractors(job_factory, options.merge(count: size), &block)
else
work_in_processes(job_factory, options.merge(count: size), &block)
end
@@ -382,6 +387,72 @@
exception || results
end
+ def work_in_ractors(job_factory, options)
+ exception = nil
+ results = []
+ results_mutex = Mutex.new # arrays are not thread-safe on jRuby
+
+ callback = options[:ractor]
+ if block_given? || !callback
+ raise ArgumentError, "pass the code you want to execute as `ractor:
[ClassName, :method_name]`"
+ end
+
+ # build
+ ractors = Array.new(options.fetch(:count)) do
+ Ractor.new do
+ loop do
+ got = receive
+ (klass, method_name), item, index = got
+ break if index == :break
+ begin
+ Ractor.yield [nil, klass.send(method_name, item), item, index]
+ rescue StandardError => e
+ Ractor.yield [e, nil, item, index]
+ end
+ end
+ end
+ end
+
+ # start
+ ractors.dup.each do |ractor|
+ if set = job_factory.next
+ item, index = set
+ instrument_start item, index, options
+ ractor.send [callback, item, index]
+ else
+ ractor.send([[nil, nil], nil, :break]) # stop the ractor
+ ractors.delete ractor
+ end
+ end
+
+ # replace with new items
+ while set = job_factory.next
+ item_next, index_next = set
+ done, (exception, result, item, index) = Ractor.select(*ractors)
+ if exception
+ ractors.delete done
+ break
+ end
+ instrument_finish item, index, result, options
+ results_mutex.synchronize { results[index] =
(options[:preserve_results] == false ? nil : result) }
+
+ instrument_start item_next, index_next, options
+ done.send([callback, item_next, index_next])
+ end
+
+ # finish
+ ractors.each do |ractor|
+ (new_exception, result, item, index) = ractor.take
+ exception ||= new_exception
+ next if new_exception
+ instrument_finish item, index, result, options
+ results_mutex.synchronize { results[index] =
(options[:preserve_results] == false ? nil : result) }
+ ractor.send([[nil, nil], nil, :break]) # stop the ractor
+ end
+
+ exception || results
+ end
+
def work_in_processes(job_factory, options, &blk)
workers = create_workers(job_factory, options, &blk)
results = []
@@ -426,6 +497,7 @@
end
end
end
+
exception || results
end
@@ -521,12 +593,20 @@
end
def with_instrumentation(item, index, options)
- on_start = options[:start]
- on_finish = options[:finish]
- options[:mutex].synchronize { on_start.call(item, index) } if on_start
+ instrument_start(item, index, options)
result = yield
- options[:mutex].synchronize { on_finish.call(item, index, result) } if
on_finish
+ instrument_finish(item, index, result, options)
result unless options[:preserve_results] == false
end
+
+ def instrument_finish(item, index, result, options)
+ return unless on_finish = options[:finish]
+ options[:mutex].synchronize { on_finish.call(item, index, result) }
+ end
+
+ def instrument_start(item, index, options)
+ return unless on_start = options[:start]
+ options[:mutex].synchronize { on_start.call(item, index) }
+ end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata 2021-09-13 06:47:27.000000000 +0200
+++ new/metadata 2022-03-26 00:34:29.000000000 +0100
@@ -1,14 +1,14 @@
--- !ruby/object:Gem::Specification
name: parallel
version: !ruby/object:Gem::Version
- version: 1.21.0
+ version: 1.22.1
platform: ruby
authors:
- Michael Grosser
autorequire:
bindir: bin
cert_chain: []
-date: 2021-09-13 00:00:00.000000000 Z
+date: 2022-03-25 00:00:00.000000000 Z
dependencies: []
description:
email: [email protected]
@@ -25,8 +25,8 @@
- MIT
metadata:
bug_tracker_uri: https://github.com/grosser/parallel/issues
- documentation_uri: https://github.com/grosser/parallel/blob/v1.21.0/Readme.md
- source_code_uri: https://github.com/grosser/parallel/tree/v1.21.0
+ documentation_uri: https://github.com/grosser/parallel/blob/v1.22.1/Readme.md
+ source_code_uri: https://github.com/grosser/parallel/tree/v1.22.1
wiki_uri: https://github.com/grosser/parallel/wiki
post_install_message:
rdoc_options: []
@@ -43,7 +43,7 @@
- !ruby/object:Gem::Version
version: '0'
requirements: []
-rubygems_version: 3.2.16
+rubygems_version: 3.1.6
signing_key:
specification_version: 4
summary: Run any kind of code in parallel processes