miga-base 0.7.16.5 → 0.7.16.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/miga +4 -1
- data/lib/miga/cli/action/daemon.rb +1 -0
- data/lib/miga/cli/action/run.rb +7 -1
- data/lib/miga/cli/action/wf.rb +1 -1
- data/lib/miga/cli/opt_helper.rb +5 -4
- data/lib/miga/daemon.rb +4 -2
- data/lib/miga/remote_dataset.rb +6 -4
- 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: 7a5ac8da23d463724b4c9d056fee6d8a2ec19fbb7c5734d68c834ccd1e654bb8
|
4
|
+
data.tar.gz: 46c0a01f19e30edf4af734fedb5e8c0decf848cf2cfd3a40a8a19772d7040618
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c36c082efdc4aabe6e6af023517029b718e9658c3fa34b2f9734793b79c6a6676d761e1efd03aa9e1ee91393c1f34747a49add8608fcd0d67268a83acd3d50a
|
7
|
+
data.tar.gz: 9137f435f69e0cad7485eca2aa595b1063f8cc31752bd3497e041c7e891c5f0606c1c5bc29bc654d276f6c4a25227ac81a566a46a240c3a011b3de74b260ea34
|
data/bin/miga
CHANGED
@@ -4,7 +4,10 @@
|
|
4
4
|
# @license Artistic-2.0
|
5
5
|
|
6
6
|
$LOAD_PATH.push File.expand_path('../../lib', __FILE__)
|
7
|
+
$LOAD_PATH.push File.expand_path('../../lib', File.realpath(__FILE__))
|
8
|
+
|
7
9
|
require 'miga'
|
8
10
|
require 'miga/cli'
|
9
11
|
|
10
|
-
MiGA::Cli.new(ARGV).launch
|
12
|
+
MiGA::Cli.new(ARGV).launch(true)
|
13
|
+
|
@@ -73,6 +73,7 @@ class MiGA::Cli::Action::Daemon < MiGA::Cli::Action
|
|
73
73
|
end
|
74
74
|
|
75
75
|
def perform
|
76
|
+
cli.operation or raise 'Please specify a daemon operation'
|
76
77
|
p = cli.load_project
|
77
78
|
d = MiGA::Daemon.new(p, cli[:json])
|
78
79
|
dopts = %i[latency maxjobs nodelist ppn shutdown_when_done]
|
data/lib/miga/cli/action/run.rb
CHANGED
@@ -8,7 +8,7 @@ class MiGA::Cli::Action::Run < MiGA::Cli::Action
|
|
8
8
|
def parse_cli
|
9
9
|
cli.defaults = { try_load: false, thr: 1, env: false }
|
10
10
|
cli.parse do |opt|
|
11
|
-
cli.opt_object(opt, [:project, :dataset_opt, :
|
11
|
+
cli.opt_object(opt, [:project, :dataset_opt, :result_opt])
|
12
12
|
opt.on(
|
13
13
|
'-t', '--threads INT', Integer,
|
14
14
|
"Threads to use in the local run (by default: #{cli[:thr]})"
|
@@ -37,12 +37,18 @@ class MiGA::Cli::Action::Run < MiGA::Cli::Action
|
|
37
37
|
cli[:thr] ||= ENV['CORES'].to_i unless ENV['CORES'].nil?
|
38
38
|
cli[:result] = File.basename(cli[:result].to_s, '.bash').to_sym
|
39
39
|
end
|
40
|
+
%i[project dataset result].each do |i|
|
41
|
+
cli[i] = nil if cli[i].nil? || cli[i].empty?
|
42
|
+
end
|
40
43
|
|
41
44
|
# Unset dataset if the requested result is for projects
|
42
45
|
if (MiGA::Project.RESULT_DIRS.keys + [:p]).include? cli[:result]
|
43
46
|
cli[:dataset] = nil
|
44
47
|
end
|
45
48
|
|
49
|
+
# Use virtual result if not explicitly passed
|
50
|
+
cli[:result] ||= cli[:dataset] ? :d : :p
|
51
|
+
|
46
52
|
# Load project
|
47
53
|
p = cli.load_project
|
48
54
|
|
data/lib/miga/cli/action/wf.rb
CHANGED
@@ -184,7 +184,7 @@ module MiGA::Cli::Action::Wf
|
|
184
184
|
def call_cli(cmd)
|
185
185
|
cmd << '-v' if cli[:verbose]
|
186
186
|
MiGA::MiGA.DEBUG "Cli::Action::Wf.call_cli #{cmd}"
|
187
|
-
MiGA::Cli.new(cmd.map(&:to_s)).launch
|
187
|
+
MiGA::Cli.new(cmd.map(&:to_s)).launch(true)
|
188
188
|
end
|
189
189
|
|
190
190
|
def run_daemon
|
data/lib/miga/cli/opt_helper.rb
CHANGED
@@ -56,10 +56,11 @@ module MiGA::Cli::OptHelper
|
|
56
56
|
# - :project_type To allow (optionally) a type of project
|
57
57
|
# - :project_type_req To require a type of project
|
58
58
|
# - :result To require a type of project or dataset result
|
59
|
+
# - :result_opt To allow (optionally) a type of result
|
59
60
|
# - :result_dataset To require a type of dataset result
|
60
61
|
# - :result_project To require a type of project result
|
61
|
-
# The options :result, :result_dataset, and :result_project
|
62
|
-
# exclusive
|
62
|
+
# The options :result, :result_opt, :result_dataset, and :result_project
|
63
|
+
# are mutually exclusive
|
63
64
|
def opt_object(opt, what = [:project, :dataset])
|
64
65
|
what.each do |w|
|
65
66
|
case w
|
@@ -82,10 +83,10 @@ module MiGA::Cli::OptHelper
|
|
82
83
|
"#{req}Type of #{obj}. Recognized types include:",
|
83
84
|
*klass.KNOWN_TYPES.map { |k, v| "~ #{k}: #{v[:description]}" }
|
84
85
|
) { |v| self[:type] = v.downcase.to_sym }
|
85
|
-
when :result
|
86
|
+
when :result, :result_opt
|
86
87
|
opt.on(
|
87
88
|
'-r', '--result STRING',
|
88
|
-
|
89
|
+
"#{"(Mandatory) " if w == :result}Name of the result",
|
89
90
|
'Recognized names for dataset-specific results include:',
|
90
91
|
*MiGA::Dataset.RESULT_DIRS.keys.map { |n| " ~ #{n}" },
|
91
92
|
'Recognized names for project-wide results include:',
|
data/lib/miga/daemon.rb
CHANGED
@@ -309,11 +309,13 @@ class MiGA::Daemon < MiGA::MiGA
|
|
309
309
|
job[:hostk] = hostk
|
310
310
|
job[:cmd] = job[:cmd].miga_variables(host: nodelist[hostk])
|
311
311
|
job[:pid] = spawn job[:cmd]
|
312
|
-
|
312
|
+
MiGA::MiGA.DEBUG "Detaching PID: #{job[:pid]}"
|
313
|
+
Process.detach(job[:pid]) unless [nil, '', 0].include?(job[:pid])
|
313
314
|
when 'bash'
|
314
315
|
# Local job
|
315
316
|
job[:pid] = spawn job[:cmd]
|
316
|
-
|
317
|
+
MiGA::MiGA.DEBUG "Detaching PID: #{job[:pid]}"
|
318
|
+
Process.detach(job[:pid]) unless [nil, '', 0].include?(job[:pid])
|
317
319
|
else
|
318
320
|
# Schedule cluster job (qsub, msub, slurm)
|
319
321
|
job[:pid] = `#{job[:cmd]}`.chomp
|
data/lib/miga/remote_dataset.rb
CHANGED
@@ -156,10 +156,12 @@ class MiGA::RemoteDataset < MiGA::MiGA
|
|
156
156
|
return nil unless metadata[:ncbi_asm]
|
157
157
|
|
158
158
|
ncbi_asm_id = self.class.ncbi_asm_acc2id metadata[:ncbi_asm]
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
159
|
+
txt = nil
|
160
|
+
3.times do
|
161
|
+
txt = self.class.download(:ncbi_summary, :assembly, ncbi_asm_id, :json)
|
162
|
+
txt.empty? ? sleep(1) : break
|
163
|
+
end
|
164
|
+
doc = MiGA::Json.parse(txt, symbolize: false, contents: true)
|
163
165
|
@_ncbi_asm_json_doc = doc['result'][ doc['result']['uids'].first ]
|
164
166
|
end
|
165
167
|
|
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, 16,
|
11
|
+
VERSION = [0.7, 16, 11]
|
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(2020,
|
19
|
+
VERSION_DATE = Date.new(2020, 12, 10)
|
20
20
|
|
21
21
|
##
|
22
22
|
# 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.7.16.
|
4
|
+
version: 0.7.16.11
|
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-
|
11
|
+
date: 2020-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: daemons
|