miga-base 0.5.7.3 → 0.5.10.0
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/ls.rb +41 -12
- data/lib/miga/cli/objects_helper.rb +16 -9
- data/lib/miga/cli/opt_helper.rb +4 -0
- data/lib/miga/common/format.rb +2 -1
- data/lib/miga/dataset/result.rb +9 -2
- data/lib/miga/version.rb +2 -2
- 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: a3fc33951911397d8c6305f0bf893cbc373c7ca09f55531c95adf15439e9a938
|
4
|
+
data.tar.gz: e1fd8f3d96c50770d2dc029fd9285ff79e536df888097d89705087d3a2c9a5d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be1241558fc879d2c6e5e6c2cb36432c004b7b4264116d3a2ff9ddc1cf5354efdfe001362a23145a6cc341ee9133d00e181184624a6adf4e40199e0d22b6ffb9
|
7
|
+
data.tar.gz: f2f14e380a596510f7d2803cac7c41069bbe0a9e2b5d1fd565d57daebbaebfdcd9bf71d1065fb92dfca63e278ff9647cc032abeaea3302ef79c790f481b90bfd
|
data/lib/miga/cli/action/ls.rb
CHANGED
@@ -18,11 +18,19 @@ class MiGA::Cli::Action::Ls < MiGA::Cli::Action
|
|
18
18
|
'-p', '--processing',
|
19
19
|
'Print information on processing advance'
|
20
20
|
) { |v| cli[:processing] = v }
|
21
|
+
opt.on(
|
22
|
+
'-t', '--task-status',
|
23
|
+
'Print the status of each processing step'
|
24
|
+
) { |v| cli[:taskstatus] = v }
|
21
25
|
opt.on(
|
22
26
|
'-m', '--metadata STRING',
|
23
27
|
'Print name and metadata field only',
|
24
|
-
'If set, ignores
|
28
|
+
'If set, ignores --info and forces --tab (without header)'
|
25
29
|
) { |v| cli[:datum] = v }
|
30
|
+
opt.on(
|
31
|
+
'-f', '--fields STR1,STR2,STR3', Array,
|
32
|
+
'Comma-delimited metadata fields to print'
|
33
|
+
) { |v| cli[:fields] = v }
|
26
34
|
opt.on(
|
27
35
|
'--tab',
|
28
36
|
'Return a tab-delimited table'
|
@@ -41,24 +49,45 @@ class MiGA::Cli::Action::Ls < MiGA::Cli::Action
|
|
41
49
|
def perform
|
42
50
|
ds = cli.load_and_filter_datasets(cli[:silent])
|
43
51
|
exit(ds.empty? ? 1 : 0) if cli[:silent]
|
44
|
-
io = cli[:output].nil? ? $stdout : File.open(cli[:output], 'w')
|
45
52
|
if !cli[:datum].nil?
|
46
|
-
|
47
|
-
|
48
|
-
|
53
|
+
cli[:tabular] = true
|
54
|
+
format_table(ds, [nil,nil]) { |d| [d.name, d.metadata[cli[:datum]]] }
|
55
|
+
elsif !cli[:fields].nil?
|
56
|
+
format_table(ds, [:name] + cli[:fields]) do |d|
|
57
|
+
[d.name] + cli[:fields].map { |f| d.metadata[f] }
|
49
58
|
end
|
50
59
|
elsif cli[:info]
|
51
|
-
|
60
|
+
format_table(ds, Dataset.INFO_FIELDS) { |d| d.info }
|
52
61
|
elsif cli[:processing]
|
53
62
|
comp = %w[- done queued]
|
54
|
-
|
55
|
-
[
|
56
|
-
|
57
|
-
|
58
|
-
)
|
63
|
+
format_table(ds, [:name] + MiGA::Dataset.PREPROCESSING_TASKS) do |d|
|
64
|
+
[d.name] + d.profile_advance.map { |i| comp[i] }
|
65
|
+
end
|
66
|
+
elsif cli[:taskstatus]
|
67
|
+
format_table(ds, [:name] + MiGA::Dataset.PREPROCESSING_TASKS) do |d|
|
68
|
+
[d.name] + d.results_status.values
|
69
|
+
end
|
59
70
|
else
|
60
|
-
|
71
|
+
cli[:tabular] = true
|
72
|
+
format_table(ds, [nil]) { |d| [d.name] }
|
61
73
|
end
|
74
|
+
end
|
75
|
+
|
76
|
+
private
|
77
|
+
|
78
|
+
def format_table(ds, header, &blk)
|
79
|
+
io = cli[:output].nil? ? $stdout : File.open(cli[:output], 'w')
|
80
|
+
cli.say 'Collecting metadata'
|
81
|
+
k = 0
|
82
|
+
cli.table(
|
83
|
+
header,
|
84
|
+
ds.map do |d|
|
85
|
+
cli.advance('Datasets:', k += 1, ds.size, false)
|
86
|
+
blk[d]
|
87
|
+
end,
|
88
|
+
io
|
89
|
+
)
|
90
|
+
cli.say ''
|
62
91
|
io.close unless cli[:output].nil?
|
63
92
|
end
|
64
93
|
end
|
@@ -16,14 +16,14 @@ module MiGA::Cli::ObjectsHelper
|
|
16
16
|
##
|
17
17
|
# Load the dataset defined in the CLI
|
18
18
|
# If +silent=true+, it allows failures silently
|
19
|
-
def load_dataset(silent = false)
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
if !silent && @objects[:dataset].nil?
|
24
|
-
raise "Cannot load dataset: #{self[:dataset]}"
|
19
|
+
def load_dataset(silent = false, name = nil)
|
20
|
+
if name.nil?
|
21
|
+
ensure_par(dataset: '-D')
|
22
|
+
name = self[:dataset]
|
25
23
|
end
|
26
|
-
|
24
|
+
d = load_project.dataset(name)
|
25
|
+
raise "Cannot load dataset: #{self[:dataset]}" if !silent && d.nil?
|
26
|
+
return d
|
27
27
|
end
|
28
28
|
|
29
29
|
##
|
@@ -38,8 +38,15 @@ module MiGA::Cli::ObjectsHelper
|
|
38
38
|
def load_and_filter_datasets(silent = false)
|
39
39
|
return @objects[:filtered_datasets] unless @objects[:filtered_datasets].nil?
|
40
40
|
say 'Listing datasets'
|
41
|
-
ds = self[:dataset].nil?
|
42
|
-
|
41
|
+
ds = if ! self[:dataset].nil?
|
42
|
+
[load_dataset(silent)].compact
|
43
|
+
elsif ! self[:ds_list].nil?
|
44
|
+
File.readlines(self[:ds_list]).map do |i|
|
45
|
+
load_dataset(silent, i.chomp)
|
46
|
+
end.compact
|
47
|
+
else
|
48
|
+
load_project.datasets
|
49
|
+
end
|
43
50
|
k = 0
|
44
51
|
n = ds.size
|
45
52
|
ds.select! do |d|
|
data/lib/miga/cli/opt_helper.rb
CHANGED
@@ -143,6 +143,10 @@ module MiGA::Cli::OptHelper
|
|
143
143
|
raise "Internal error: Unrecognized option: #{w}"
|
144
144
|
end
|
145
145
|
end
|
146
|
+
opt.on(
|
147
|
+
'--ds-list FILE',
|
148
|
+
'File containing a list of dataset names, one per line'
|
149
|
+
) { |v| self[:ds_list] = v }
|
146
150
|
opt.on(
|
147
151
|
'--dataset-k INTEGER', Integer,
|
148
152
|
'Use only the k-th dataset in the list'
|
data/lib/miga/common/format.rb
CHANGED
@@ -9,7 +9,8 @@ module MiGA::Common::Format
|
|
9
9
|
# Tabulates an +values+, and Array of Arrays, all with the same number of
|
10
10
|
# entries as +header+. Returns an Array of String, one per line.
|
11
11
|
def tabulate(header, values, tabular = false)
|
12
|
-
fields = [
|
12
|
+
fields = []
|
13
|
+
fields << header.map(&:to_s) unless tabular && header.all?(&:nil?)
|
13
14
|
fields << fields.first.map { |h| h.gsub(/\S/, '-') } unless tabular
|
14
15
|
fields += values.map { |r| r.map { |cell| cell.nil? ? '?' : cell.to_s } }
|
15
16
|
clen = tabular ? Array.new(header.size, 0) :
|
data/lib/miga/dataset/result.rb
CHANGED
@@ -64,7 +64,7 @@ module MiGA::Dataset::Result
|
|
64
64
|
# execution order). This typically corresponds to the result used as the
|
65
65
|
# initial input. Passes +save+ to #add_result.
|
66
66
|
def first_preprocessing(save = false)
|
67
|
-
@@PREPROCESSING_TASKS.find do |t|
|
67
|
+
@first_processing ||= @@PREPROCESSING_TASKS.find do |t|
|
68
68
|
not ignore_task?(t) and not add_result(t, save).nil?
|
69
69
|
end
|
70
70
|
end
|
@@ -126,6 +126,8 @@ module MiGA::Dataset::Result
|
|
126
126
|
|
127
127
|
##
|
128
128
|
# Returns the status of +task+. The status values are symbols:
|
129
|
+
# - -: the task is upstream from the initial input
|
130
|
+
# - ignore_empty: the dataset has no data
|
129
131
|
# - ignore_inactive: the dataset is inactive
|
130
132
|
# - ignore_force: forced to ignore by metadata
|
131
133
|
# - ignore_project: incompatible project
|
@@ -136,8 +138,13 @@ module MiGA::Dataset::Result
|
|
136
138
|
# - complete: a task with registered results
|
137
139
|
# - pending: a task queued to be performed
|
138
140
|
def result_status(task)
|
139
|
-
if
|
141
|
+
if first_preprocessing.nil?
|
142
|
+
:ignore_empty
|
143
|
+
elsif not get_result(task).nil?
|
140
144
|
:complete
|
145
|
+
elsif @@PREPROCESSING_TASKS.index(task) <
|
146
|
+
@@PREPROCESSING_TASKS.index(first_preprocessing)
|
147
|
+
:-
|
141
148
|
elsif ignore_task?(task)
|
142
149
|
if not is_active?
|
143
150
|
:ignore_inactive
|
data/lib/miga/version.rb
CHANGED
@@ -10,7 +10,7 @@ module MiGA
|
|
10
10
|
# - Float representing the major.minor version.
|
11
11
|
# - Integer representing gem releases of the current version.
|
12
12
|
# - Integer representing minor changes that require new version number.
|
13
|
-
VERSION = [0.5,
|
13
|
+
VERSION = [0.5, 10, 0]
|
14
14
|
|
15
15
|
##
|
16
16
|
# Nickname for the current major.minor version.
|
@@ -18,7 +18,7 @@ module MiGA
|
|
18
18
|
|
19
19
|
##
|
20
20
|
# Date of the current gem release.
|
21
|
-
VERSION_DATE = Date.new(2020, 2,
|
21
|
+
VERSION_DATE = Date.new(2020, 2, 25)
|
22
22
|
|
23
23
|
##
|
24
24
|
# Reference 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: 0.5.
|
4
|
+
version: 0.5.10.0
|
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: 2020-02-
|
11
|
+
date: 2020-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: daemons
|