autoflow 0.9.2 → 0.9.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 03a2fce5cddce218e8903d7b7cff49acd3c6962c
4
- data.tar.gz: 1c2019a7d65d8710bc37baa649301c43a1b61585
2
+ SHA256:
3
+ metadata.gz: 03720c11e2c6d967b2907823e0de305e34f8e141a792f6f4291ce6db41b3083b
4
+ data.tar.gz: cf00a1b7ef0f26e6a82c4044792d68b8e66783efe652bff50956c6c706bfa785
5
5
  SHA512:
6
- metadata.gz: a52c86fde55c4854e587710c1969e62c282d7fbdd51f645c9a94ce1454882097cecf8f58566f1711cd6c6f4fb92fc02f6e4aef9a3fa46154453b6c09b8a01c6e
7
- data.tar.gz: 1d8efc8bd847a2c1fea463497a0a02637582cd744d4654951551759a0e425dd74839622ec23f25a94b938c0a21e35edec129188a04409d9f84079c6171345486
6
+ metadata.gz: 6feeef52e7c4e92f630c2ad9e01d3d08b056a588c562fb87cae587e58dcf213fda8b86e7e61d72df6b507827ec6cb48360c25a3ce8e56fb2c4ed9be899057d52
7
+ data.tar.gz: 1b27d3309c7e1a30a2e31f01dde55b7b35d9be32bf4ef13c683b002941df60f61bb6385bb57bc6e226325c863f6eceae21170e5d8797f5e2623608da65bf48ce
data/autoflow.gemspec CHANGED
@@ -19,11 +19,11 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_runtime_dependency 'net-ssh', '>= 2.8.0'
22
- spec.add_runtime_dependency 'git', '>= 1.3.0'
22
+ spec.add_runtime_dependency 'git', '>= 0.8.1'
23
23
  spec.add_runtime_dependency 'win32console', '>= 1.3.2' if !ENV['OS'].nil? && ENV['OS'].downcase.include?('windows')
24
- spec.add_runtime_dependency 'colorize', '~> 0.7.3'
25
- spec.add_runtime_dependency 'terminal-table', '~> 1.6.0'
26
- spec.add_runtime_dependency 'openssl', '>= 2.0.6'
27
- spec.add_development_dependency "bundler", "~> 1.3"
24
+ spec.add_runtime_dependency 'colorize', '>= 0.7.3'
25
+ spec.add_runtime_dependency 'terminal-table', '>= 2.0.0'
26
+ spec.add_runtime_dependency 'openssl', '>= 2.2.0'
27
+ spec.add_development_dependency "bundler", ">= 2.2.7"
28
28
  spec.add_development_dependency "rake"
29
29
  end
data/bin/AutoFlow CHANGED
@@ -9,7 +9,7 @@ require 'optparse'
9
9
  require 'autoflow'
10
10
  require 'io/console'
11
11
  require 'net/ssh'
12
- require 'queue_manager'
12
+ #require 'queue_manager'
13
13
  require 'fileutils'
14
14
  require 'git'
15
15
 
@@ -108,6 +108,11 @@ optparse = OptionParser.new do |opts|
108
108
  options[:external_dependencies] = external_dependencies.split(',')
109
109
  end
110
110
 
111
+ options[:extended_logging] = false
112
+ opts.on( '-e', '--extended_logging', 'If set the command /usr/bin/time will be used instead of shell built-in version. Data will be saved in process_data file of task folder' ) do
113
+ options[:extended_logging] = true
114
+ end
115
+
111
116
  options[:retry] = false
112
117
  opts.on( '-f', '--force', 'Execute all jobs, including any job commented with %' ) do
113
118
  options[:retry] = true
@@ -342,7 +347,6 @@ if !options[:graph].nil?
342
347
  stack.draw(template_file, options[:graph])
343
348
  else
344
349
  stack.inspect if options[:verbose]
345
- stack.comment_main_command if options[:comment]
346
350
  options[:write_sh] = true # Set in flow logger to FALSE, it is used for relaunch failed jobs
347
351
  manager = QueueManager.select_queue_manager(stack.exec_folder, options, stack.jobs, stack.persist_variables)
348
352
  manager.exec
data/bin/flow_logger CHANGED
@@ -7,11 +7,8 @@ $: << File.expand_path(File.join(ROOT_PATH, "..", "lib", "autoflow", "queue_mana
7
7
  require 'autoflow'
8
8
  require 'optparse'
9
9
  require 'colorize'
10
- require 'logging'
11
10
  require 'json'
12
11
  require 'terminal-table'
13
- require 'queue_manager'
14
- require 'program'
15
12
  require 'erb'
16
13
 
17
14
  #################################################################################################
@@ -296,6 +293,15 @@ OptionParser.new do |opts|
296
293
  opts.on("-H", "--html", "Make a workflow execution full report in html format") do |opt|
297
294
  options[:html] = true
298
295
  end
296
+
297
+ # Set a banner, displayed at the top of the help screen.
298
+ opts.banner = "Usage: flow_logger [options] \n\n"
299
+
300
+ # This displays the help screen
301
+ opts.on( '-h', '--help', 'Display this screen' ) do
302
+ puts opts
303
+ exit
304
+ end
299
305
  end.parse!
300
306
 
301
307
  #################################################################################################
@@ -1,4 +1,3 @@
1
- require 'logging'
2
1
  require 'json'
3
2
  class QueueManager
4
3
 
@@ -15,6 +14,8 @@ class QueueManager
15
14
  @write_sh = options[:write_sh]
16
15
  @external_dependencies = options[:external_dependencies]
17
16
  @active_jobs = []
17
+ @extended_logging = options[:extended_logging]
18
+ @comment = options[:comment]
18
19
  end
19
20
 
20
21
  ########################################################################################
@@ -35,6 +36,7 @@ class QueueManager
35
36
  else
36
37
  queue_manager = select_manager(options)
37
38
  end
39
+ warn("Selected queue manager: #{queue_manager}")
38
40
  return queue_manager.new(exec_folder, options, jobs, persist_variables)
39
41
  end
40
42
 
@@ -267,7 +269,17 @@ class QueueManager
267
269
 
268
270
  def write_job(job, sh_name)
269
271
  write_file(sh_name, job.initialization) if !job.initialization.nil?
270
- write_file(sh_name, 'time ' + job.parameters)
272
+ if @comment
273
+ cmd = '#' + job.parameters
274
+ else
275
+ if @extended_logging
276
+ log_command = '/usr/bin/time -o process_data -v '
277
+ else
278
+ log_command = 'time '
279
+ end
280
+ cmd = log_command + job.parameters
281
+ end
282
+ write_file(sh_name, cmd)
271
283
  end
272
284
 
273
285
  def get_dependencies(job, id = nil)
@@ -0,0 +1,66 @@
1
+ require 'queue_manager'
2
+ class SlurmManager2 < QueueManager
3
+ # SLURM 20 or greater
4
+ def parse_additional_options(string, attribs)
5
+ expresions = %w[%C %T %M %N ]
6
+ values = [attribs[:cpu], attribs[:time], attribs[:mem], attribs[:node]]
7
+ new_string = string.dup
8
+ expresions.each_with_index do |exp, i|
9
+ new_string.gsub!(exp, "#{values[i]}")
10
+ end
11
+ return new_string
12
+ end
13
+
14
+ def write_header(id, job, sh_name)
15
+ if !job.attrib[:ntask]
16
+ write_file(sh_name, "#SBATCH --cpus-per-task=#{job.attrib[:cpu]}")
17
+ else
18
+ write_file(sh_name, "#SBATCH --ntasks=#{job.attrib[:cpu]}")
19
+ write_file(sh_name, "#SBATCH --nodes=#{job.attrib[:multinode]}") if job.attrib[:multinode] > 0
20
+ end
21
+ write_file(sh_name, "#SBATCH --mem=#{job.attrib[:mem]}")
22
+ write_file(sh_name, "#SBATCH --time=#{job.attrib[:time]}")
23
+ write_file(sh_name, "#SBATCH --constraint=#{job.attrib[:node]}") if !job.attrib[:node].nil?
24
+ write_file(sh_name, '#SBATCH --error=job.%J.err')
25
+ write_file(sh_name, '#SBATCH --output=job.%J.out')
26
+ write_file(sh_name, "#SBATCH --#{job.attrib[:additional_job_options][0]}=#{parse_additional_options(job.attrib[:additional_job_options][1], job.attrib)}") if !job.attrib[:additional_job_options].nil?
27
+ if job.attrib[:ntask]
28
+ write_file(sh_name, 'srun hostname -s > workers') if job.attrib[:cpu_asign] == 'list'
29
+ end
30
+ end
31
+
32
+
33
+ def submit_job(job, ar_dependencies)
34
+ final_dep = get_all_deps(ar_dependencies)
35
+ dependencies = nil
36
+ dependencies='--dependency=afterok:'+final_dep.join(':') if !final_dep.empty?
37
+ cmd = "sbatch #{dependencies} #{job.name}.sh"
38
+ STDOUT.puts cmd if @show_submit
39
+ queue_id = get_queue_system_id(system_call(cmd, job.attrib[:exec_folder]))
40
+ return queue_id
41
+ end
42
+
43
+ def get_queue_system_id(shell_output)
44
+ queue_id = nil
45
+ shell_output.chomp!
46
+ shell_output =~ /Submitted batch job (\d+)/
47
+ queue_id = $1
48
+ raise("A queue id cannot be obtained. The queue manager has given this message:#{shell_output}") if queue_id.nil?
49
+ return queue_id
50
+ end
51
+
52
+ def self.available?(options)
53
+ available = false
54
+ shell_output = system_call("type 'sbatch'", nil, options[:remote], options[:ssh])
55
+ if !shell_output.empty?
56
+ shell_output = system_call("sbatch --version", nil, options[:remote], options[:ssh])
57
+ slurm_version = shell_output.split(' ').last.split('.').first.to_i # "slurm 17.11.4"
58
+ available = true if slurm_version >= 20
59
+ end
60
+ return available
61
+ end
62
+
63
+ def self.priority
64
+ return 100
65
+ end
66
+ end
@@ -42,19 +42,24 @@ class SlurmManager < QueueManager
42
42
  def get_queue_system_id(shell_output)
43
43
  queue_id = nil
44
44
  shell_output.chomp!
45
- fields = shell_output.split(' ')
46
- queue_id = fields[3]
45
+ shell_output =~ /Submitted batch job (\d+)/
46
+ queue_id = $1
47
+ raise("A queue id cannot be obtained. The queue manager has given this message:#{shell_output}") if queue_id.nil?
47
48
  return queue_id
48
49
  end
49
50
 
50
51
  def self.available?(options)
51
- available = true
52
+ available = false
52
53
  shell_output = system_call("type 'sbatch'", nil, options[:remote], options[:ssh])
53
- available = false if shell_output.empty?
54
+ if !shell_output.empty?
55
+ shell_output = system_call("sbatch --version", nil, options[:remote], options[:ssh])
56
+ slurm_version = shell_output.split(' ').last.split('.').first.to_i # "slurm 17.11.4"
57
+ available = true if slurm_version < 20
58
+ end
54
59
  return available
55
60
  end
56
61
 
57
62
  def self.priority
58
- return 100
63
+ return 120
59
64
  end
60
65
  end
@@ -1,5 +1,5 @@
1
- require 'program'
2
- require 'batch'
1
+ #require 'program'
2
+ #require 'batch'
3
3
 
4
4
  require 'win32console' if !ENV['OS'].nil? && ENV['OS'].downcase.include?('windows')
5
5
  require 'colorize'
@@ -77,8 +77,10 @@ class Stack
77
77
  line.gsub!(/\s/,'')
78
78
  pairs = line.split(',')
79
79
  pairs.each do |pair|
80
- pair =~ /(.+)=(.+)/
81
- variable_type[$1] = $2
80
+ #pair =~ /(.+)=(.+)/
81
+ #variable_type[$1] = $2
82
+ var, value = pair.split('=', 2)
83
+ variable_type[var] = value
82
84
  end
83
85
  end
84
86
  end
@@ -223,11 +225,6 @@ class Stack
223
225
  return hash
224
226
  end
225
227
 
226
- def comment_main_command
227
- @jobs.each do |name, job|
228
- job.parameters = "##{job.parameters}"
229
- end
230
- end
231
228
  ##########################################################################################
232
229
  ## WORKFLOW REPRESENTATION
233
230
  ##########################################################################################
@@ -1,3 +1,3 @@
1
1
  module Autoflow
2
- VERSION = "0.9.2"
2
+ VERSION = "0.9.9"
3
3
  end
data/lib/autoflow.rb CHANGED
@@ -1,6 +1,10 @@
1
1
 
2
2
  require "autoflow/version"
3
3
  require "autoflow/stack"
4
+ require "autoflow/queue_manager"
5
+ require "autoflow/program"
6
+ require "autoflow/batch"
7
+ require "autoflow/logging"
4
8
 
5
9
  module Autoflow
6
10
  # Your code goes here...
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autoflow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pedro Seoane
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-24 00:00:00.000000000 Z
11
+ date: 2022-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-ssh
@@ -30,70 +30,70 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 1.3.0
33
+ version: 0.8.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 1.3.0
40
+ version: 0.8.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: colorize
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: 0.7.3
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: 0.7.3
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: terminal-table
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: 1.6.0
61
+ version: 2.0.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: 1.6.0
68
+ version: 2.0.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: openssl
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: 2.0.6
75
+ version: 2.2.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: 2.0.6
82
+ version: 2.2.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: bundler
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: '1.3'
89
+ version: 2.2.7
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: '1.3'
96
+ version: 2.2.7
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rake
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -136,6 +136,7 @@ files:
136
136
  - lib/autoflow/program.rb
137
137
  - lib/autoflow/queue_manager.rb
138
138
  - lib/autoflow/queue_managers/bash_manager.rb
139
+ - lib/autoflow/queue_managers/slurm2_manager.rb
139
140
  - lib/autoflow/queue_managers/slurm_manager.rb
140
141
  - lib/autoflow/stack.rb
141
142
  - lib/autoflow/version.rb
@@ -145,7 +146,7 @@ homepage: ''
145
146
  licenses:
146
147
  - MIT
147
148
  metadata: {}
148
- post_install_message:
149
+ post_install_message:
149
150
  rdoc_options: []
150
151
  require_paths:
151
152
  - lib
@@ -160,9 +161,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
160
161
  - !ruby/object:Gem::Version
161
162
  version: '0'
162
163
  requirements: []
163
- rubyforge_project:
164
- rubygems_version: 2.6.14
165
- signing_key:
164
+ rubygems_version: 3.2.15
165
+ signing_key:
166
166
  specification_version: 4
167
167
  summary: '"This gem take a pipeline and launch it on a queue system"'
168
168
  test_files: