miga-base 1.4.0.1 → 1.4.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/miga/cli/action/lair.rb +18 -1
- data/lib/miga/lair.rb +13 -3
- data/lib/miga/project/dataset.rb +10 -0
- data/lib/miga/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8866ced6da49edafc7b4c7467ef600e630a2e132f9b66831fe5ac49f8416ed9d
|
4
|
+
data.tar.gz: a1f20c0aa45b90ea8fce12340b4d4bb74b023f8d9f13105a6058aefcff1d6018
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ae42ebaf9102adbac2cd5380fb1c7035d8832ca430366f86a3e91d28396340c2bf7bc8a57c11f460a4f76b40da0e2806a2f1dbda2bb6ef43d3243420e8cd946
|
7
|
+
data.tar.gz: fee137f5c16869387d023444a65d286d539eae9795ddb85104504340061afd3dbb67a3a7c47552abf4d40dc95ee6558e74a125b1cb670dda313018e64ea14ee8
|
data/lib/miga/cli/action/lair.rb
CHANGED
@@ -33,6 +33,14 @@ class MiGA::Cli::Action::Lair < MiGA::Cli::Action
|
|
33
33
|
opt.on(
|
34
34
|
'--exclude-releases', 'Exclude projects with release metadata'
|
35
35
|
) { |v| cli[:exclude_releases] = v }
|
36
|
+
opt.on(
|
37
|
+
'--max-running INT', Integer,
|
38
|
+
'Maximum number of running projects at the same time',
|
39
|
+
'by default, unlimited'
|
40
|
+
) { |v| cli[:max_running] = v }
|
41
|
+
opt.on(
|
42
|
+
'--ignore-complete', 'Ignore fully-processed projects'
|
43
|
+
) { |v| cli[:ignore_complete] = v }
|
36
44
|
opt.on(
|
37
45
|
'--json PATH',
|
38
46
|
'Path to a custom daemon definition in json format'
|
@@ -55,6 +63,15 @@ class MiGA::Cli::Action::Lair < MiGA::Cli::Action
|
|
55
63
|
'--no-trust-timestamp',
|
56
64
|
'Check all results instead of trusting project timestamps'
|
57
65
|
) { |v| cli[:trust_timestamp] = v }
|
66
|
+
opt.on(
|
67
|
+
'--system-element',
|
68
|
+
'Default settings for a system element lair (consider --max-running)',
|
69
|
+
'Same as: --no-trust-timestamp --exclude-releases --ignore-complete'
|
70
|
+
) do |v|
|
71
|
+
cli[:trust_timestamp] = false
|
72
|
+
cli[:exclude_releases] = true
|
73
|
+
cli[:ignore_complete] = true
|
74
|
+
end
|
58
75
|
opt.on(
|
59
76
|
'--name STRING',
|
60
77
|
'A name for the chief daemon process'
|
@@ -90,7 +107,7 @@ class MiGA::Cli::Action::Lair < MiGA::Cli::Action
|
|
90
107
|
cli.ensure_par(path: '-p')
|
91
108
|
k_opts = %i[
|
92
109
|
json latency wait_for keep_inactive trust_timestamp name dry
|
93
|
-
exclude exclude_releases
|
110
|
+
exclude exclude_releases max_running ignore_complete
|
94
111
|
]
|
95
112
|
opts = Hash[k_opts.map { |k| [k, cli[k]] }]
|
96
113
|
lair = MiGA::Lair.new(cli[:path], opts)
|
data/lib/miga/lair.rb
CHANGED
@@ -33,6 +33,9 @@ class MiGA::Lair < MiGA::MiGA
|
|
33
33
|
# them
|
34
34
|
# - exclude: Array of project names to be excluded from the lair
|
35
35
|
# - exclude_releases: Exclude projects with release metadata from the lair
|
36
|
+
# - max_running: Run a maximum of this many projects at time
|
37
|
+
# - ignore_complete: Ignore projects that are complete based on their datasets
|
38
|
+
# reported metadata status
|
36
39
|
def initialize(path, opts = {})
|
37
40
|
@path = File.expand_path(path)
|
38
41
|
@options = opts
|
@@ -45,7 +48,9 @@ class MiGA::Lair < MiGA::MiGA
|
|
45
48
|
name: File.basename(@path),
|
46
49
|
dry: false,
|
47
50
|
exclude: [],
|
48
|
-
exclude_releases: false
|
51
|
+
exclude_releases: false,
|
52
|
+
max_running: nil,
|
53
|
+
ignore_complete: false
|
49
54
|
}.each { |k, v| @options[k] = v if @options[k].nil? }
|
50
55
|
end
|
51
56
|
|
@@ -139,16 +144,19 @@ class MiGA::Lair < MiGA::MiGA
|
|
139
144
|
##
|
140
145
|
# Traverse directories checking MiGA projects
|
141
146
|
def check_directories
|
147
|
+
active = 0
|
142
148
|
each_project do |project|
|
149
|
+
break if options[:max_running] && active >= options[:max_running]
|
150
|
+
|
143
151
|
d = project_daemon(project)
|
144
|
-
|
152
|
+
d.active? and active += 1 and next
|
145
153
|
|
146
154
|
l_alive = d.last_alive
|
147
155
|
unless l_alive.nil?
|
148
156
|
next if options[:trust_timestamp] && project.metadata.updated < l_alive
|
149
157
|
next if l_alive > Time.now - options[:wait_for]
|
150
158
|
end
|
151
|
-
launch_daemon(project)
|
159
|
+
launch_daemon(project) && active += 1
|
152
160
|
end
|
153
161
|
end
|
154
162
|
|
@@ -156,6 +164,8 @@ class MiGA::Lair < MiGA::MiGA
|
|
156
164
|
# Launch daemon for the MiGA::Project +project+ and returns the corresponding
|
157
165
|
# MiGA::Daemon object
|
158
166
|
def launch_daemon(project)
|
167
|
+
return if options[:ignore_complete] && project.complete?
|
168
|
+
|
159
169
|
say "Launching daemon: #{project.path}"
|
160
170
|
daemon = project_daemon(project)
|
161
171
|
daemon.runopts(:shutdown_when_done, true) unless options[:keep_inactive]
|
data/lib/miga/project/dataset.rb
CHANGED
@@ -175,6 +175,16 @@ module MiGA::Project::Dataset
|
|
175
175
|
end
|
176
176
|
end
|
177
177
|
|
178
|
+
##
|
179
|
+
# Are all datasets reportedly done based on their status, and the results
|
180
|
+
# from the project complete?
|
181
|
+
#
|
182
|
+
# If you need to actually check all results, use +done_preprocessing?+ instead
|
183
|
+
def complete?
|
184
|
+
each_dataset.all? { |d| d.metadata[:status] != 'incomplete' } &&
|
185
|
+
next_task.nil?
|
186
|
+
end
|
187
|
+
|
178
188
|
##
|
179
189
|
# Returns a two-dimensional matrix (Array of Array) where the first index
|
180
190
|
# corresponds to the dataset, the second index corresponds to the dataset
|
data/lib/miga/version.rb
CHANGED
@@ -12,7 +12,7 @@ module MiGA
|
|
12
12
|
# - String indicating release status:
|
13
13
|
# - rc* release candidate, not released as gem
|
14
14
|
# - [0-9]+ stable release, released as gem
|
15
|
-
VERSION = [1.4, 0,
|
15
|
+
VERSION = [1.4, 0, 3].freeze
|
16
16
|
|
17
17
|
##
|
18
18
|
# Nickname for the current major.minor version.
|