miga-base 1.4.0.1 → 1.4.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d4b67bd0a5a151b1aa8598c56df2db8e286382dec6a43714b04e41bc3fd03302
4
- data.tar.gz: 8e52fcc9cdd873467318854b8048503374354fb71026cc66c52cf835511259ff
3
+ metadata.gz: 89632a79a0801cd74a67f37390872ba90b30689f43da76d233c83de2b1db6f58
4
+ data.tar.gz: d7eca23c6be21fb737f6c4c9e04ee433800f09536c48ae4d6fd3eba7953de980
5
5
  SHA512:
6
- metadata.gz: b1f9746da7cc703094dd602ebb91482930b78031cfcd6249d0e1bd5efbfa39c122adc1c30133e3791e66b0651d5e057b8df397e2f542938e74829afc5d0c955c
7
- data.tar.gz: 0b37cf54c49dbac3c81d118e9b2ccded9b11ee13b073847ddf6f7bd187102067e850bdf9a7b912a8bbdece6f0e581aeebf6b1689f45d79b83b5f381b20f93c51
6
+ metadata.gz: d4da7811ccdc35c231933e6151c6f81f0f3aaaf292226ee6439220beb3cfd3a8f98c945f58ff222f8c908f879c8164ccd4cc8e1cd549e1907b5e5a86c2cf0a0c
7
+ data.tar.gz: c4c82c1d28c14523d84033390f7499667915a251e48649795f76f992a06ee1b8ad440cd41d5377b1d630f708cacd77fcefda65b9039803daafa3b0d9bd52b961
@@ -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'
@@ -90,7 +98,7 @@ class MiGA::Cli::Action::Lair < MiGA::Cli::Action
90
98
  cli.ensure_par(path: '-p')
91
99
  k_opts = %i[
92
100
  json latency wait_for keep_inactive trust_timestamp name dry
93
- exclude exclude_releases
101
+ exclude exclude_releases max_running ignore_complete
94
102
  ]
95
103
  opts = Hash[k_opts.map { |k| [k, cli[k]] }]
96
104
  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
- next if d.active?
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]
@@ -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, 1].freeze
15
+ VERSION = [1.4, 0, 2].freeze
16
16
 
17
17
  ##
18
18
  # Nickname for the current major.minor version.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: miga-base
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0.1
4
+ version: 1.4.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luis M. Rodriguez-R