miga-base 1.0.0.1 → 1.0.5.0

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: b4d9aad1ec5368e6cce82c4385a1d40839e948115e7749709a51e9c517d762f0
4
- data.tar.gz: dc7b6500cbd85a1c50ef92fd41c0436dbbc16273ad245f730f8c2beb684db587
3
+ metadata.gz: bc2d6a45a59d47e3490d1e6bbe728961abfc28002c945c0fc371b24277f7abcd
4
+ data.tar.gz: c20265a37c53e403858c592a72b2de801ab6ce12e48f0fe88d886cea41a94413
5
5
  SHA512:
6
- metadata.gz: 5973a0b393ff61b1065b74ae36f580be0e80467c8c5b281e82541539b9a97d37b553d82d4d284ec041be72937f7de1274cfa94f2f1c8593a3dcb4c97d3820eff
7
- data.tar.gz: 60388895b6d864154ff94cd70ae7959f2ac80688a6f46c1d092fc8b08c7597ef3814bdf947bcc05a9832a9a54136c61a4a1970c4aefa3b05d57ad9c6bb670c1d
6
+ metadata.gz: 91804137814911287b5f1395e79b28e2805a0584dfb5ff234ca51a2366d17d497acf8a88ee80e18a1b8dd27a1b159ab3433471f82b389fd741825a1f5da57da5
7
+ data.tar.gz: 97d932379e302a22b2c0f489b5dd6cdd5efe4408c77e9cd32bb3b89efff3bc5f3787d167bc8f46720777dcc4d2efa06fb9b82f77e1903735a4b6e631e20be6f9
@@ -74,6 +74,11 @@ class MiGA::Cli::Action::Daemon < MiGA::Cli::Action
74
74
 
75
75
  def perform
76
76
  cli.operation or raise 'Please specify a daemon operation'
77
+
78
+ # Cleanup environment
79
+ %w[PROJECT RUNTYPE CORES DATASET].each { |i| ENV[i] = nil }
80
+
81
+ # Configure and run daemon
77
82
  p = cli.load_project
78
83
  d = MiGA::Daemon.new(p, cli[:json])
79
84
  dopts = %i[latency maxjobs nodelist ppn shutdown_when_done]
@@ -0,0 +1,26 @@
1
+ # @package MiGA
2
+ # @license Artistic-2.0
3
+
4
+ require 'miga/cli/action'
5
+
6
+ class MiGA::Cli::Action::Env < MiGA::Cli::Action
7
+ def parse_cli
8
+ cli.parse { |_| }
9
+ end
10
+
11
+ def perform
12
+ puts <<~BASH
13
+ MIGA="#{MiGA::MiGA.root_path}"
14
+ MIGA_HOME=${MIGA_HOME:-"$HOME"}
15
+ . "$MIGA_HOME/.miga_rc"
16
+ # Ensure MiGA & submodules are first in PATH
17
+ export PATH="$MIGA/bin:$PATH"
18
+ for util in enveomics/Scripts FastAAI/FastAAI multitrim ; do
19
+ export PATH="$MIGA/utils/$util:$PATH"
20
+ done
21
+ BASH
22
+ end
23
+
24
+ def empty_action
25
+ end
26
+ end
@@ -34,7 +34,7 @@ class MiGA::Cli::Action::Run < MiGA::Cli::Action
34
34
  if cli[:env]
35
35
  cli[:project] ||= ENV['PROJECT']
36
36
  cli[:dataset] ||= ENV['DATASET']
37
- cli[:thr] ||= ENV['CORES'].to_i unless ENV['CORES'].nil?
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
40
  %i[project dataset result].each do |i|
@@ -183,6 +183,7 @@ module MiGA::Cli::Action::Wf
183
183
  cmd += ['--json', cli[:daemon_json]] unless cli[:daemon_json].nil?
184
184
  cmd += ['--max-jobs', cli[:jobs]] unless cli[:jobs].nil?
185
185
  cmd += ['--ppn', cli[:threads]] unless cli[:threads].nil?
186
+ cmd += ['--debug', MiGA::MiGA.debug_trace? ? '2' : '1'] if MiGA::MiGA.debug?
186
187
  cwd = Dir.pwd
187
188
  call_cli(cmd)
188
189
  Dir.chdir(cwd)
data/lib/miga/cli/base.rb CHANGED
@@ -41,6 +41,7 @@ module MiGA::Cli::Base
41
41
  lair: 'Control groups of daemons for several MiGA projects',
42
42
  date: 'Return the current date in standard MiGA format',
43
43
  console: 'Open an IRB console with MiGA',
44
+ env: 'Shell code to load MiGA environment',
44
45
  # Taxonomy
45
46
  tax_set: 'Register taxonomic information for datasets',
46
47
  tax_test: 'Return test of taxonomic distributions for query datasets',
@@ -29,10 +29,18 @@ class MiGA::MiGA
29
29
  ##
30
30
  # Send debug message
31
31
  def DEBUG(*args)
32
- $stderr.puts(*args) if @@DEBUG
32
+ $stderr.puts(*args) if debug?
33
33
  $stderr.puts(
34
34
  caller.map { |v| v.gsub(/^/, ' ') }.join("\n")
35
- ) if @@DEBUG_TRACE
35
+ ) if debug_trace?
36
+ end
37
+
38
+ def debug?
39
+ @@DEBUG ||= false
40
+ end
41
+
42
+ def debug_trace?
43
+ @@DEBUG_TRACE ||= false
36
44
  end
37
45
  end
38
46
  end
data/lib/miga/daemon.rb CHANGED
@@ -329,6 +329,7 @@ class MiGA::Daemon < MiGA::MiGA
329
329
  def launch_job(job, hostk = nil)
330
330
  # Execute job
331
331
  job[:cmd] = job_cmd(job)
332
+ MiGA::MiGA.DEBUG "CMD: #{job[:cmd]}"
332
333
  case runopts(:type)
333
334
  when 'ssh'
334
335
  # Remote job
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.0, 0, 1].freeze
15
+ VERSION = [1.0, 5, 0].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 release.
23
- VERSION_DATE = Date.new(2021, 4, 13)
23
+ VERSION_DATE = Date.new(2021, 8, 26)
24
24
 
25
25
  ##
26
26
  # References of MiGA
data/scripts/miga.bash CHANGED
@@ -1,21 +1,21 @@
1
1
  #!/bin/bash
2
2
 
3
+ ###
3
4
  # Setup environment
4
5
  set -e
5
- MIGA_HOME=${MIGA_HOME:-"$HOME"}
6
+ eval "$("$MIGA/bin/miga" env)"
6
7
  SCRIPT=${SCRIPT:-$(basename "$0" .bash)}
7
- # shellcheck source=/dev/null
8
- . "$MIGA_HOME/.miga_rc"
9
-
10
- # Ensure MiGA & submodules are first in PATH
11
- export PATH="$MIGA/bin:$PATH"
12
- for util in enveomics/Scripts FastAAI/FastAAI multitrim ; do
13
- export PATH="$MIGA/utils/$util:$PATH"
14
- done
15
8
 
9
+ ###
16
10
  # Ancillary functions
11
+
12
+ # Evaluates if the first passed argument is an existing file
17
13
  function exists { [[ -e "$1" ]] ; }
14
+
15
+ # Evaluates if the first passed argument is a function
18
16
  function fx_exists { [[ $(type -t "$1") == "function" ]] ; }
17
+
18
+ # Initiate a project-wide run
19
19
  function miga_start_project_step {
20
20
  local dir="$1"
21
21
  local dir_r="${dir}.running"
@@ -24,6 +24,8 @@ function miga_start_project_step {
24
24
  cd "$dir_r"
25
25
  miga date > "miga-project.start"
26
26
  }
27
+
28
+ # Finalize a project-wide run
27
29
  function miga_end_project_step {
28
30
  local dir="$1"
29
31
  local dir_r="${dir}.running"
@@ -17,10 +17,10 @@ module MiGA::SubcladeRunner::Pipeline
17
17
  metric_res = project.result(par[0]) or raise "Incomplete step #{par[0]}"
18
18
  Zlib::GzipReader.open(metric_res.file_path(:matrix)) do |ifh|
19
19
  ifh.each_line do |ln|
20
- next if ln =~ /^metric\t/
20
+ next if ln =~ /^a\tb\tvalue\t/
21
21
 
22
22
  r = ln.chomp.split("\t")
23
- ofh.puts "G>#{r[1]}\tG>#{r[2]}\t#{r[3]}" if r[3].to_f >= par[1]
23
+ ofh.puts "G>#{r[0]}\tG>#{r[1]}\t#{r[2]}" if r[2].to_f >= par[1]
24
24
  end
25
25
  end
26
26
  ofh.close
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.0.0.1
4
+ version: 1.0.5.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: 2021-04-13 00:00:00.000000000 Z
11
+ date: 2021-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: daemons
@@ -141,6 +141,7 @@ files:
141
141
  - lib/miga/cli/action/doctor.rb
142
142
  - lib/miga/cli/action/doctor/base.rb
143
143
  - lib/miga/cli/action/edit.rb
144
+ - lib/miga/cli/action/env.rb
144
145
  - lib/miga/cli/action/files.rb
145
146
  - lib/miga/cli/action/find.rb
146
147
  - lib/miga/cli/action/generic.rb