miga-base 1.4.0.0 → 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: 5525ee26722f9be06bf3d8ddd8a94909457c55d8e2ac9d8f137bf44e15cf2035
4
- data.tar.gz: ce4036f422bb2cc4e5da887d0dfaea6de89a73f152f63269c5894644f8a92127
3
+ metadata.gz: 89632a79a0801cd74a67f37390872ba90b30689f43da76d233c83de2b1db6f58
4
+ data.tar.gz: d7eca23c6be21fb737f6c4c9e04ee433800f09536c48ae4d6fd3eba7953de980
5
5
  SHA512:
6
- metadata.gz: 8b3393571b1f4425a243181ba50117829b264022c02ac251717721bb6ef092ac81f323b8ccb1f4ea1989fe77d61b9f224115f0758f81a0963503127938b59b3f
7
- data.tar.gz: d6dd244f7ea5261900d4fc8329398e5bb07a44e28e0ddf8706c546798546814735142c0179831193a4a48d8b3c2bdc93745bd0a021ee31df7ec385f7ef58c4fe
6
+ metadata.gz: d4da7811ccdc35c231933e6151c6f81f0f3aaaf292226ee6439220beb3cfd3a8f98c945f58ff222f8c908f879c8164ccd4cc8e1cd549e1907b5e5a86c2cf0a0c
7
+ data.tar.gz: c4c82c1d28c14523d84033390f7499667915a251e48649795f76f992a06ee1b8ad440cd41d5377b1d630f708cacd77fcefda65b9039803daafa3b0d9bd52b961
@@ -30,6 +30,17 @@ class MiGA::Cli::Action::Lair < MiGA::Cli::Action
30
30
  '--exclude NAME1,NAME2,NAME3', Array,
31
31
  'Exclude these projects (identified by name) from the lair'
32
32
  ) { |v| cli[:exclude] = v }
33
+ opt.on(
34
+ '--exclude-releases', 'Exclude projects with release metadata'
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 }
33
44
  opt.on(
34
45
  '--json PATH',
35
46
  'Path to a custom daemon definition in json format'
@@ -86,7 +97,8 @@ class MiGA::Cli::Action::Lair < MiGA::Cli::Action
86
97
  def perform
87
98
  cli.ensure_par(path: '-p')
88
99
  k_opts = %i[
89
- json latency wait_for keep_inactive trust_timestamp name dry exclude
100
+ json latency wait_for keep_inactive trust_timestamp name dry
101
+ exclude exclude_releases max_running ignore_complete
90
102
  ]
91
103
  opts = Hash[k_opts.map { |k| [k, cli[k]] }]
92
104
  lair = MiGA::Lair.new(cli[:path], opts)
data/lib/miga/lair.rb CHANGED
@@ -32,6 +32,10 @@ class MiGA::Lair < MiGA::MiGA
32
32
  # - dry: Only report when daemons would be launched, but don't actually launch
33
33
  # them
34
34
  # - exclude: Array of project names to be excluded from the lair
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
35
39
  def initialize(path, opts = {})
36
40
  @path = File.expand_path(path)
37
41
  @options = opts
@@ -43,7 +47,10 @@ class MiGA::Lair < MiGA::MiGA
43
47
  trust_timestamp: true,
44
48
  name: File.basename(@path),
45
49
  dry: false,
46
- exclude: []
50
+ exclude: [],
51
+ exclude_releases: false,
52
+ max_running: nil,
53
+ ignore_complete: false
47
54
  }.each { |k, v| @options[k] = v if @options[k].nil? }
48
55
  end
49
56
 
@@ -116,8 +123,10 @@ class MiGA::Lair < MiGA::MiGA
116
123
  if MiGA::Project.exist? f
117
124
  project = MiGA::Project.load(f)
118
125
  raise "Cannot load project: #{f}" if project.nil?
126
+ next if options[:exclude].include?(project.name)
127
+ next if options[:exclude_releases] && project.metadata[:release]
119
128
 
120
- yield(project) unless options[:exclude].include?(project.name)
129
+ yield(project)
121
130
  elsif Dir.exist? f
122
131
  each_project(f) { |p| yield(p) }
123
132
  end
@@ -135,16 +144,19 @@ class MiGA::Lair < MiGA::MiGA
135
144
  ##
136
145
  # Traverse directories checking MiGA projects
137
146
  def check_directories
147
+ active = 0
138
148
  each_project do |project|
149
+ break if options[:max_running] && active >= options[:max_running]
150
+
139
151
  d = project_daemon(project)
140
- next if d.active?
152
+ d.active? and active += 1 and next
141
153
 
142
154
  l_alive = d.last_alive
143
155
  unless l_alive.nil?
144
156
  next if options[:trust_timestamp] && project.metadata.updated < l_alive
145
157
  next if l_alive > Time.now - options[:wait_for]
146
158
  end
147
- launch_daemon(project)
159
+ launch_daemon(project) && active += 1
148
160
  end
149
161
  end
150
162
 
@@ -152,6 +164,8 @@ class MiGA::Lair < MiGA::MiGA
152
164
  # Launch daemon for the MiGA::Project +project+ and returns the corresponding
153
165
  # MiGA::Daemon object
154
166
  def launch_daemon(project)
167
+ return if options[:ignore_complete] && project.complete?
168
+
155
169
  say "Launching daemon: #{project.path}"
156
170
  daemon = project_daemon(project)
157
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, 0].freeze
15
+ VERSION = [1.4, 0, 2].freeze
16
16
 
17
17
  ##
18
18
  # Nickname for the current major.minor version.
@@ -20,7 +20,7 @@ module MiGA
20
20
 
21
21
  ##
22
22
  # Date of the current gem relese.
23
- VERSION_DATE = Date.new(2025, 9, 23)
23
+ VERSION_DATE = Date.new(2025, 10, 10)
24
24
 
25
25
  ##
26
26
  # References of MiGA
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: miga-base
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0.0
4
+ version: 1.4.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luis M. Rodriguez-R
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-09-23 00:00:00.000000000 Z
11
+ date: 2025-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: daemons