miga-base 0.7.18.0 → 0.7.18.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/miga/cli/action/run.rb +1 -1
- data/lib/miga/common.rb +6 -3
- data/lib/miga/common/with_daemon.rb +1 -1
- data/lib/miga/daemon.rb +5 -4
- data/lib/miga/dataset.rb +6 -1
- data/lib/miga/dataset/result.rb +7 -2
- data/lib/miga/version.rb +2 -2
- data/scripts/miga.bash +8 -8
- data/utils/cleanup-databases.rb +8 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a0c77da5b4e0cfaee8d470f669d0589f00949c686868780c9c8ee2eb68cd9cd
|
4
|
+
data.tar.gz: 9f78d665d2559eacc0a19dd16d8b3cd712a512909db8c1a7af1dcb0edd7302d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f2ad1f0efb0712fac07ffb62198695be09a27a0f2e3346c97532331973cae21cbede3002c8e0c935945cccdcbbf6027e6297f2621fe8add53f4b47b3fbb2e18
|
7
|
+
data.tar.gz: 31e5c848db45f20b5a5358b602ee08ad285ba44bb40f20265792a8331067ba51c1cba4e78b6f260264a6bd480d95447e10031005e3b8d18a336ad93f467695c7
|
data/lib/miga/cli/action/run.rb
CHANGED
@@ -59,7 +59,7 @@ class MiGA::Cli::Action::Run < MiGA::Cli::Action
|
|
59
59
|
"MIGA=#{miga.shellescape}", "CORES=#{cli[:thr]}"]
|
60
60
|
obj = cli.load_project_or_dataset
|
61
61
|
klass = obj.class
|
62
|
-
virtual_task = [
|
62
|
+
virtual_task = %i[p d maintenance].include?(cli[:result])
|
63
63
|
cmd << "DATASET=#{obj.name.shellescape}" if obj.is_a? MiGA::Dataset
|
64
64
|
if klass.RESULT_DIRS[cli[:result]].nil? and not virtual_task
|
65
65
|
raise "Unsupported #{klass.to_s.sub(/.*::/, '')} result: #{cli[:result]}."
|
data/lib/miga/common.rb
CHANGED
@@ -74,10 +74,13 @@ class MiGA::MiGA
|
|
74
74
|
@_advance_time[:n] = n
|
75
75
|
|
76
76
|
# Report
|
77
|
-
adv_vals = [100.0 * n / total, num_suffix(n, bin), num_suffix(total, bin)]
|
78
77
|
adv =
|
79
|
-
total.nil?
|
80
|
-
('
|
78
|
+
if total.nil?
|
79
|
+
(n == 0 ? '' : num_suffix(n, bin))
|
80
|
+
else
|
81
|
+
vals = [100.0 * n / total, num_suffix(n, bin), num_suffix(total, bin)]
|
82
|
+
('%.1f%% (%s/%s)' % vals)
|
83
|
+
end
|
81
84
|
left =
|
82
85
|
if @_advance_time[:avg].nil?
|
83
86
|
''
|
@@ -158,7 +158,7 @@ module MiGA::Common::WithDaemon
|
|
158
158
|
# Returns the status of the daemon with +opts+
|
159
159
|
def status(opts = [], wait = true)
|
160
160
|
if active?
|
161
|
-
say "Running with pid #{File.read(pid_file)}"
|
161
|
+
say "Running with pid #{File.size?(pid_file) ? File.read(pid_file) : '?'}"
|
162
162
|
else
|
163
163
|
say 'Not running'
|
164
164
|
end
|
data/lib/miga/daemon.rb
CHANGED
@@ -182,6 +182,7 @@ class MiGA::Daemon < MiGA::MiGA
|
|
182
182
|
unless show_log?
|
183
183
|
n = project.dataset_names.count
|
184
184
|
k = jobs_to_run.size + jobs_running.size
|
185
|
+
k -= 1 unless get_job(:maintenance).nil?
|
185
186
|
advance('Datasets:', n - k, n, false)
|
186
187
|
miga_say if k == 0
|
187
188
|
end
|
@@ -274,10 +275,10 @@ class MiGA::Daemon < MiGA::MiGA
|
|
274
275
|
# Avoid single datasets hogging resources
|
275
276
|
@jobs_to_run.rotate! rand(jobs_to_run.size)
|
276
277
|
|
277
|
-
# Prioritize
|
278
|
-
|
279
|
-
|
280
|
-
|
278
|
+
# Prioritize: Project-wide > MiGA Online queries > Other datasets
|
279
|
+
@jobs_to_run.sort_by! do |job|
|
280
|
+
job[:ds].nil? ? 1 : job[:ds_name] =~ /^qG_/ ? 2 : 3
|
281
|
+
end
|
281
282
|
|
282
283
|
# Launch as many +jobs_to_run+ as possible
|
283
284
|
while (hostk = next_host)
|
data/lib/miga/dataset.rb
CHANGED
@@ -7,7 +7,11 @@ require 'miga/metadata'
|
|
7
7
|
require 'miga/dataset/result'
|
8
8
|
require 'miga/dataset/status'
|
9
9
|
require 'miga/dataset/hooks'
|
10
|
-
|
10
|
+
|
11
|
+
# This library is only required by +#closest_relatives+, so it is now
|
12
|
+
# being loaded on call instead to allow most of miga-base to work without
|
13
|
+
# issue in systems with problematic SQLite3 installations.
|
14
|
+
# require 'miga/sqlite'
|
11
15
|
|
12
16
|
##
|
13
17
|
# Dataset representation in MiGA
|
@@ -190,6 +194,7 @@ class MiGA::Dataset < MiGA::MiGA
|
|
190
194
|
r = result(ref_project ? :taxonomy : :distances)
|
191
195
|
return nil if r.nil?
|
192
196
|
|
197
|
+
require 'miga/sqlite'
|
193
198
|
MiGA::SQLite.new(r.file_path(:aai_db)).run(
|
194
199
|
'SELECT seq2, aai FROM aai WHERE seq2 != ? ' \
|
195
200
|
'GROUP BY seq2 ORDER BY aai DESC LIMIT ?', [name, how_many]
|
data/lib/miga/dataset/result.rb
CHANGED
@@ -1,8 +1,12 @@
|
|
1
|
-
require 'miga/sqlite'
|
2
1
|
require 'miga/result'
|
3
2
|
require 'miga/dataset/base'
|
4
3
|
require 'miga/common/with_result'
|
5
4
|
|
5
|
+
# This library is only required by +#cleanup_distances!+, so it is now
|
6
|
+
# being loaded on call instead to allow most of miga-base to work without
|
7
|
+
# issue in systems with problematic SQLite3 installations.
|
8
|
+
# require 'miga/sqlite'
|
9
|
+
|
6
10
|
##
|
7
11
|
# Helper module including specific functions to add dataset results
|
8
12
|
module MiGA::Dataset::Result
|
@@ -144,9 +148,10 @@ module MiGA::Dataset::Result
|
|
144
148
|
# the project as reference datasets.
|
145
149
|
def cleanup_distances!
|
146
150
|
r = get_result(:distances)
|
147
|
-
ref = project.datasets.select(&:ref?).select(&:active?).map(&:name)
|
148
151
|
return if r.nil?
|
149
152
|
|
153
|
+
require 'miga/sqlite'
|
154
|
+
ref = project.datasets.select(&:ref?).select(&:active?).map(&:name)
|
150
155
|
%i[haai_db aai_db ani_db].each do |db_type|
|
151
156
|
db = r.file_path(db_type)
|
152
157
|
next if db.nil? || !File.size?(db)
|
data/lib/miga/version.rb
CHANGED
@@ -8,7 +8,7 @@ module MiGA
|
|
8
8
|
# - Float representing the major.minor version.
|
9
9
|
# - Integer representing gem releases of the current version.
|
10
10
|
# - Integer representing minor changes that require new version number.
|
11
|
-
VERSION = [0.7, 18,
|
11
|
+
VERSION = [0.7, 18, 4]
|
12
12
|
|
13
13
|
##
|
14
14
|
# Nickname for the current major.minor version.
|
@@ -16,7 +16,7 @@ module MiGA
|
|
16
16
|
|
17
17
|
##
|
18
18
|
# Date of the current gem release.
|
19
|
-
VERSION_DATE = Date.new(
|
19
|
+
VERSION_DATE = Date.new(2021, 1, 1)
|
20
20
|
|
21
21
|
##
|
22
22
|
# Reference of MiGA.
|
data/scripts/miga.bash
CHANGED
@@ -11,17 +11,17 @@ function exists { [[ -e "$1" ]] ; }
|
|
11
11
|
function fx_exists { [[ $(type -t "$1") == "function" ]] ; }
|
12
12
|
|
13
13
|
if [[ "$SCRIPT" != "d" && "$SCRIPT" != "p" ]] ; then
|
14
|
-
echo
|
15
|
-
echo
|
16
|
-
echo "
|
17
|
-
echo "
|
18
|
-
echo "
|
19
|
-
echo "Project: $PROJECT"
|
14
|
+
echo ""
|
15
|
+
echo "######[ $SCRIPT ]######"
|
16
|
+
echo "# Date: $(miga date)"
|
17
|
+
echo "# Host: $(hostname)"
|
18
|
+
echo "# MiGA: $MIGA"
|
19
|
+
echo "# Project: $PROJECT"
|
20
20
|
if [[ -n $DATASET ]] ; then
|
21
|
-
echo "Dataset: $DATASET"
|
21
|
+
echo "# Dataset: $DATASET"
|
22
22
|
miga edit -P "$PROJECT" -D "$DATASET" -m "_step=$SCRIPT"
|
23
23
|
fi
|
24
|
-
echo '
|
24
|
+
echo '#------------'
|
25
25
|
fi
|
26
26
|
|
27
27
|
true
|
data/utils/cleanup-databases.rb
CHANGED
@@ -5,21 +5,17 @@ require 'miga'
|
|
5
5
|
|
6
6
|
ARGV[1] or abort "Usage: #{$0} path/to/project threads"
|
7
7
|
|
8
|
-
$stderr.puts 'Cleaning databases...'
|
9
8
|
p = MiGA::Project.load(ARGV[0])
|
10
|
-
|
9
|
+
dsn = p.dataset_names
|
11
10
|
thr = ARGV[1].to_i
|
12
11
|
|
13
|
-
|
14
|
-
|
12
|
+
m = MiGA::MiGA.new
|
13
|
+
m.say 'Cleaning Databases'
|
15
14
|
|
16
15
|
(0..thr - 1).each do |t|
|
17
16
|
fork do
|
18
|
-
|
19
|
-
|
20
|
-
$stderr.print '#'
|
21
|
-
pc.shift
|
22
|
-
end
|
17
|
+
dsn.each_with_index do |i, idx|
|
18
|
+
m.advance('Dataset:', dsn.size, idx + 1) if t == 0
|
23
19
|
next unless (idx % thr) == t
|
24
20
|
|
25
21
|
d = p.dataset(i)
|
@@ -30,4 +26,6 @@ $stderr.puts (('.' * 9 + '|') * 10) + ' 100%'
|
|
30
26
|
end
|
31
27
|
end
|
32
28
|
Process.waitall
|
33
|
-
|
29
|
+
m.advance('Dataset:', dsn.size, dsn.size)
|
30
|
+
m.say
|
31
|
+
|
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: 0.7.18.
|
4
|
+
version: 0.7.18.4
|
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:
|
11
|
+
date: 2021-01-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: daemons
|