enparallel-bin 1.0.9 → 1.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/enparallel +5 -5
- data/lib/enparallel/cli.rb +1 -1
- data/lib/enparallel/log_group.rb +4 -3
- data/lib/enparallel/logger.rb +1 -1
- data/lib/enparallel/task.rb +4 -3
- data/lib/enparallel/thread_pool.rb +6 -5
- data/lib/enparallel/version.rb +1 -1
- data/lib/enparallel.rb +1 -1
- metadata +18 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 41b497f7ab752ec2100b78f0966c191277afa65f1d645482697d38eb4d13e28d
|
4
|
+
data.tar.gz: ce25b5ec3b39bc60ff067e235eacb192f31666ce8f3d49943be0c8647868ffdc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 760618db0069de59d547f04c08aafd8564ae6a9b20f767d635b888ec798e8685e966dd1122e04cc895bb65863b8179c458b97c18b6850cad29c2c55acbdc3407
|
7
|
+
data.tar.gz: 597fae7122f8bf27884df72b8c57c8464fb05cab168be927b2859e40d48c8092d66a8488e3bf90e6e5dd533bd76ece5a8102e5599bfea18881dba6948c396e94
|
data/bin/enparallel
CHANGED
@@ -4,7 +4,7 @@ include Enparallel
|
|
4
4
|
|
5
5
|
class Main
|
6
6
|
def self.run
|
7
|
-
cli = CLI.parse(ARGV,
|
7
|
+
cli = CLI.parse(ARGV, $stdin)
|
8
8
|
tasks = cli.inputs.map { |input| Task.new(cli.command, input) }
|
9
9
|
pool = ThreadPool.new(tasks, cli.workers, cli.pick)
|
10
10
|
new(pool).run
|
@@ -35,7 +35,7 @@ class Main
|
|
35
35
|
|
36
36
|
def finish
|
37
37
|
puts
|
38
|
-
puts
|
38
|
+
puts 'Tasks complete'
|
39
39
|
puts
|
40
40
|
puts "#{@pool.succeeded_tasks.length.to_s.green.bold} tasks succeeded"
|
41
41
|
puts "#{@pool.failed_tasks.length.to_s.red.bold} tasks failed"
|
@@ -52,7 +52,7 @@ class Main
|
|
52
52
|
|
53
53
|
def render
|
54
54
|
print "\r" + @pool.render
|
55
|
-
sleep
|
55
|
+
sleep(0.1)
|
56
56
|
end
|
57
57
|
|
58
58
|
def all_paths_available(paths)
|
@@ -83,14 +83,14 @@ class Main
|
|
83
83
|
log_groups.each do |log_group|
|
84
84
|
type = log_group.type
|
85
85
|
path = paths[type]
|
86
|
-
puts 'Written %s log: %s (%s)' % [type,
|
86
|
+
puts 'Written %s log: %s (%s)' % [type, path, log_group.write(path)]
|
87
87
|
end
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
91
91
|
begin
|
92
92
|
Main.run
|
93
|
-
rescue Docopt::Exit
|
93
|
+
rescue Docopt::Exit
|
94
94
|
puts CLI.usage
|
95
95
|
exit 2
|
96
96
|
end
|
data/lib/enparallel/cli.rb
CHANGED
data/lib/enparallel/log_group.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
module Enparallel
|
2
2
|
class LogGroup
|
3
|
-
attr_reader :type
|
3
|
+
attr_reader :type
|
4
|
+
attr_reader :tasks
|
4
5
|
|
5
6
|
def initialize(type, tasks)
|
6
7
|
@type = type
|
@@ -11,13 +12,13 @@ module Enparallel
|
|
11
12
|
tasks.join("\n\n") + "\n"
|
12
13
|
end
|
13
14
|
|
14
|
-
def
|
15
|
+
def tasks?
|
15
16
|
tasks.length > 0
|
16
17
|
end
|
17
18
|
|
18
19
|
def write(path)
|
19
20
|
size = File.write(path, to_soml)
|
20
|
-
|
21
|
+
Util.bytes_to_human(size)
|
21
22
|
end
|
22
23
|
|
23
24
|
def self.of(type, pool)
|
data/lib/enparallel/logger.rb
CHANGED
data/lib/enparallel/task.rb
CHANGED
@@ -30,7 +30,7 @@ module Enparallel
|
|
30
30
|
'R'
|
31
31
|
elsif @exit_status.nil?
|
32
32
|
'S'
|
33
|
-
elsif
|
33
|
+
elsif succeeded?
|
34
34
|
'D'.green
|
35
35
|
else
|
36
36
|
'F'.red
|
@@ -41,7 +41,7 @@ module Enparallel
|
|
41
41
|
@running = true
|
42
42
|
@ran_at = Time.now
|
43
43
|
|
44
|
-
Open3.popen3(command_line_safe) do |
|
44
|
+
Open3.popen3(command_line_safe) do |_stdin, stdout, stderr, thread|
|
45
45
|
@stdout = stdout.read.chomp
|
46
46
|
@stderr = stderr.read.chomp
|
47
47
|
@exit_status = thread.value.exitstatus
|
@@ -53,8 +53,9 @@ module Enparallel
|
|
53
53
|
@running = false
|
54
54
|
end
|
55
55
|
|
56
|
-
def
|
56
|
+
def succeeded?
|
57
57
|
raise 'Task not resolved' if @ran_at.nil?
|
58
|
+
|
58
59
|
@exit_status == 0
|
59
60
|
end
|
60
61
|
|
@@ -16,7 +16,7 @@ module Enparallel
|
|
16
16
|
def drain
|
17
17
|
@workers = @worker_count.times.map do
|
18
18
|
Thread.new do
|
19
|
-
while task = @picker.next
|
19
|
+
while (task = @picker.next)
|
20
20
|
task.run
|
21
21
|
end
|
22
22
|
end
|
@@ -32,17 +32,18 @@ module Enparallel
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def succeeded_tasks
|
35
|
-
@tasks.select(&:
|
35
|
+
@tasks.select(&:succeeded?)
|
36
36
|
end
|
37
37
|
|
38
38
|
def failed_tasks
|
39
|
-
@tasks.reject(&:
|
39
|
+
@tasks.reject(&:succeeded?)
|
40
40
|
end
|
41
41
|
|
42
42
|
def tasks_of(type)
|
43
|
-
|
43
|
+
case type
|
44
|
+
when :success
|
44
45
|
succeeded_tasks
|
45
|
-
|
46
|
+
when :failure
|
46
47
|
failed_tasks
|
47
48
|
end
|
48
49
|
end
|
data/lib/enparallel/version.rb
CHANGED
data/lib/enparallel.rb
CHANGED
metadata
CHANGED
@@ -1,57 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enparallel-bin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- crdx
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-10-
|
11
|
+
date: 2021-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: colorize
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 0.8.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 0.8.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: docopt
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.6.1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.6.1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: require_all
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0
|
47
|
+
version: '3.0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0
|
54
|
+
version: '3.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: soml
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,19 +67,19 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 1.0.1
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: '13.0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: '13.0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rspec
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -95,19 +95,19 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '3.8'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: simplecov
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: 0.21.0
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: 0.21.0
|
111
111
|
description:
|
112
112
|
email:
|
113
113
|
executables:
|
@@ -138,7 +138,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
138
138
|
requirements:
|
139
139
|
- - ">="
|
140
140
|
- !ruby/object:Gem::Version
|
141
|
-
version: '0'
|
141
|
+
version: '3.0'
|
142
142
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
143
|
requirements:
|
144
144
|
- - ">="
|