concurrent-ruby 1.3.1 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7841a791b1b148d8e8efea668fc70f3acc98c247f8d49fea58a4c672b45a62e6
4
- data.tar.gz: 380ca8252b5b9251f30cd925d8b08f2afae56db19a210a8726b44c7304e5cd84
3
+ metadata.gz: 1ca6244c1124d507f5422c42cc9376e46cb2a46f7ad07363731ee0957c410e98
4
+ data.tar.gz: 4c03cbe71e12804bf8d9b0c707895313206a9932be3e182f1674faa70568ca1f
5
5
  SHA512:
6
- metadata.gz: e479a5475e8d6dd7b3589a76300ccc73162cbceb8a15b721462394ff92f02054ba06e8ec5ee3ab08aa391a846d00492c708c893416b4c0c159c53d9b065f755f
7
- data.tar.gz: 52daa298a6820a10756bfbf472aff566f5b5508f4e014352aa7a8d2516873b1e69b6392cde1379c0feaeba7c054c6c6c919613c3e09ac4d2328939cde3f01444
6
+ metadata.gz: ceaab8640927f5f0bf5ecde7727705248d5dd5d0a5fe9b4baa8b8d259a2cf0ef9a5e8d636cfacd47588d358ea8c51cd1650f0939be6e3188647553e7158d536f
7
+ data.tar.gz: 216aed72a0d32b40a7e34303751d9c544594b4a51e38e9fd449f3922fcc30fd9a7549d22d7e3d1552b307806ede6c638acffdaded8cd016980a0ae0683b5495e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  ## Current
2
2
 
3
+ ## Release v1.3.3 (9 June 2024)
4
+
5
+ * (#1053) Improve the speed of `Concurrent.physical_processor_count` on Windows.
6
+
7
+ ## Release v1.3.2, edge v0.7.1 (7 June 2024)
8
+
9
+ concurrent-ruby:
10
+
11
+ * (#1051) Remove dependency on `win32ole`.
12
+
13
+ concurrent-ruby-edge:
14
+
15
+ * (#1052) Fix dependency on `concurrent-ruby` to allow the latest release.
16
+
3
17
  ## Release v1.3.1 (29 May 2024)
4
18
 
5
19
  * Release 1.3.0 was broken when pushed to RubyGems. 1.3.1 is a packaging fix.
@@ -7,7 +21,7 @@
7
21
  ## Release v1.3.0 (28 May 2024)
8
22
 
9
23
  * (#1042) Align Java Executor Service behavior for `shuttingdown?`, `shutdown?`
10
- * (#1038) Add `Concurrent.usable_processor_count` that is cgroups aware.
24
+ * (#1038) Add `Concurrent.available_processor_count` that is cgroups aware.
11
25
 
12
26
  ## Release v1.2.3 (16 Jan 2024)
13
27
 
data/Rakefile CHANGED
@@ -28,6 +28,10 @@ unless Concurrent.on_jruby? || Concurrent.on_truffleruby?
28
28
  end
29
29
  end
30
30
 
31
+ def which?(executable)
32
+ !`which #{executable} 2>/dev/null`.empty?
33
+ end
34
+
31
35
  require 'rake_compiler_dock'
32
36
  namespace :repackage do
33
37
  desc '* with Windows fat distributions'
@@ -42,12 +46,19 @@ namespace :repackage do
42
46
  Rake::Task['lib/concurrent-ruby/concurrent/concurrent_ruby.jar'].invoke
43
47
 
44
48
  # build all gem files
49
+ rack_compiler_dock_kwargs = {}
50
+ if which?('podman') and (!which?('docker') || `docker --version`.include?('podman'))
51
+ # podman and only podman available, so RakeCompilerDock will use podman, otherwise it uses docker
52
+ rack_compiler_dock_kwargs = {
53
+ options: ['--privileged'], # otherwise the directory in the image is empty
54
+ runas: false
55
+ }
56
+ end
45
57
  %w[x86-mingw32 x64-mingw32].each do |plat|
46
58
  RakeCompilerDock.sh(
47
59
  "bundle install --local && bundle exec rake native:#{plat} gem --trace",
48
60
  platform: plat,
49
- options: ['--privileged'], # otherwise the directory in the image is empty
50
- runas: false)
61
+ **rack_compiler_dock_kwargs)
51
62
  end
52
63
  end
53
64
  end
@@ -256,10 +267,12 @@ namespace :release do
256
267
 
257
268
  Bundler.with_original_env do
258
269
  sh 'ruby -v'
270
+ sh 'bundle install'
259
271
  sh 'bundle exec rake spec:installed'
260
272
 
261
- env = { "PATH" => "#{ENV['CONCURRENT_JRUBY_HOME']}/bin:#{ENV['PATH']}" }
273
+ env = { "PATH" => "#{ENV.fetch('CONCURRENT_JRUBY_HOME')}/bin:#{ENV['PATH']}" }
262
274
  sh env, 'ruby -v'
275
+ sh env, 'bundle install'
263
276
  sh env, 'bundle exec rake spec:installed'
264
277
  end
265
278
 
@@ -271,8 +284,8 @@ namespace :release do
271
284
  task :publish => ['publish:ask', 'publish:tag', 'publish:rubygems', 'publish:post_steps']
272
285
 
273
286
  namespace :publish do
274
- publish_base = true
275
- publish_edge = false
287
+ publish_base = nil
288
+ publish_edge = nil
276
289
 
277
290
  task :ask do
278
291
  begin
@@ -280,8 +293,15 @@ namespace :release do
280
293
  input = STDIN.gets.strip.downcase
281
294
  end until %w(y n).include?(input)
282
295
  exit 1 if input == 'n'
296
+
297
+ begin
298
+ STDOUT.puts 'Do you want to publish `concurrent-ruby`? (y/n)'
299
+ input = STDIN.gets.strip.downcase
300
+ end until %w(y n).include?(input)
301
+ publish_base = input == 'y'
302
+
283
303
  begin
284
- STDOUT.puts 'It will publish `concurrent-ruby`. Do you want to publish `concurrent-ruby-edge`? (y/n)'
304
+ STDOUT.puts 'Do you want to publish `concurrent-ruby-edge`? (y/n)'
285
305
  input = STDIN.gets.strip.downcase
286
306
  end until %w(y n).include?(input)
287
307
  publish_edge = input == 'y'
@@ -68,10 +68,20 @@ module Concurrent
68
68
  end
69
69
  cores.count
70
70
  when /mswin|mingw/
71
- require 'win32ole'
72
- result_set = WIN32OLE.connect("winmgmts://").ExecQuery(
73
- "select NumberOfCores from Win32_Processor")
74
- result_set.to_enum.collect(&:NumberOfCores).reduce(:+)
71
+ # Get-CimInstance introduced in PowerShell 3 or earlier: https://learn.microsoft.com/en-us/previous-versions/powershell/module/cimcmdlets/get-ciminstance?view=powershell-3.0
72
+ result = run('powershell -command "Get-CimInstance -ClassName Win32_Processor -Property NumberOfCores | Select-Object -Property NumberOfCores"')
73
+ if !result || $?.exitstatus != 0
74
+ # fallback to deprecated wmic for older systems
75
+ result = run("wmic cpu get NumberOfCores")
76
+ end
77
+ if !result || $?.exitstatus != 0
78
+ # Bail out if both commands returned something unexpected
79
+ processor_count
80
+ else
81
+ # powershell: "\nNumberOfCores\n-------------\n 4\n\n\n"
82
+ # wmic: "NumberOfCores \n\n4 \n\n\n\n"
83
+ result.scan(/\d+/).map(&:to_i).reduce(:+)
84
+ end
75
85
  else
76
86
  processor_count
77
87
  end
@@ -81,6 +91,11 @@ module Concurrent
81
91
  return 1
82
92
  end
83
93
 
94
+ def run(command)
95
+ IO.popen(command, &:read)
96
+ rescue Errno::ENOENT
97
+ end
98
+
84
99
  def compute_cpu_quota
85
100
  if RbConfig::CONFIG["target_os"].include?("linux")
86
101
  if File.exist?("/sys/fs/cgroup/cpu.max")
@@ -1,3 +1,3 @@
1
1
  module Concurrent
2
- VERSION = '1.3.1'
2
+ VERSION = '1.3.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: concurrent-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jerry D'Antonio
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2024-05-29 00:00:00.000000000 Z
13
+ date: 2024-06-09 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: |
16
16
  Modern concurrency tools including agents, futures, promises, thread pools, actors, supervisors, and more.