rbbt-util 6.0.4 → 6.0.5

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.
@@ -1,35 +1,38 @@
1
- require 'rbbt/annotations'
2
- require 'rbbt/association'
3
- require 'rbbt/association/item'
4
- require 'rbbt/knowledge_base/entity'
5
- require 'rbbt/knowledge_base/query'
6
- require 'rbbt/knowledge_base/syndicate'
1
+ require_relative 'refactor'
2
+ Rbbt.require_instead 'scout/knowledge_base'
7
3
 
8
- class KnowledgeBase
9
-
10
- attr_accessor :namespace, :dir, :databases, :indices, :registry, :format, :entity_options
11
- def initialize(dir, namespace = nil)
12
- @dir = Path.setup(dir.dup)
13
-
14
- @namespace = namespace
15
- @format = IndiferentHash.setup({})
16
-
17
- @registry ||= IndiferentHash.setup({})
18
- @entity_options = IndiferentHash.setup({})
19
-
20
- @indices = IndiferentHash.setup({})
21
- @databases = IndiferentHash.setup({})
22
- @identifiers = IndiferentHash.setup({})
23
- @fields = {}
24
- @descriptions = {}
25
- @databases = {}
26
- end
27
-
28
- def self.load(dir)
29
- KnowledgeBase.new dir
30
- end
31
-
32
- def setup(name, matches, reverse = false)
33
- AssociationItem.setup matches, self, name, reverse
34
- end
35
- end
4
+ #require 'rbbt/annotations'
5
+ #require 'rbbt/association'
6
+ #require 'rbbt/association/item'
7
+ #require 'rbbt/knowledge_base/entity'
8
+ #require 'rbbt/knowledge_base/query'
9
+ #require 'rbbt/knowledge_base/syndicate'
10
+ #
11
+ #class KnowledgeBase
12
+ #
13
+ # attr_accessor :namespace, :dir, :databases, :indices, :registry, :format, :entity_options
14
+ # def initialize(dir, namespace = nil)
15
+ # @dir = Path.setup(dir.dup)
16
+ #
17
+ # @namespace = namespace
18
+ # @format = IndiferentHash.setup({})
19
+ #
20
+ # @registry ||= IndiferentHash.setup({})
21
+ # @entity_options = IndiferentHash.setup({})
22
+ #
23
+ # @indices = IndiferentHash.setup({})
24
+ # @databases = IndiferentHash.setup({})
25
+ # @identifiers = IndiferentHash.setup({})
26
+ # @fields = {}
27
+ # @descriptions = {}
28
+ # @databases = {}
29
+ # end
30
+ #
31
+ # def self.load(dir)
32
+ # KnowledgeBase.new dir
33
+ # end
34
+ #
35
+ # def setup(name, matches, reverse = false)
36
+ # AssociationItem.setup matches, self, name, reverse
37
+ # end
38
+ #end
@@ -2,7 +2,7 @@ module Rbbt
2
2
 
3
3
  def self.migrate_source_paths(path, resource = Rbbt, source = nil)
4
4
  if source
5
- lpath, *paths = Misc.ssh_run(source, <<-EOF).split("\n")
5
+ lpath, *paths = SSHLine.ruby(source, <<-EOF).split("\n")
6
6
  require 'rbbt-util'
7
7
  path = "#{path}"
8
8
  if Open.exists?(path)
@@ -11,7 +11,7 @@ else
11
11
  path = Path.setup(path)
12
12
  end
13
13
  puts path
14
- puts path.glob_all.collect{|p| File.directory?(p) ? p + "/" : p } * "\n"
14
+ puts path.find_all.collect{|p| File.directory?(p) ? p + "/" : p } * "\n"
15
15
  EOF
16
16
 
17
17
  [path, paths.collect{|p| [source, p] * ":"}, lpath]
@@ -36,7 +36,7 @@ puts path.glob_all.collect{|p| File.directory?(p) ? p + "/" : p } * "\n"
36
36
 
37
37
  def self.migrate_target_path(path, search_path = 'user', resource = Rbbt, target = nil)
38
38
  if target
39
- Misc.ssh_run(target, <<-EOF).split("\n").first
39
+ SSHLine.ruby(target, <<-EOF).split("\n").first
40
40
  require 'rbbt-util'
41
41
  path = "#{path}"
42
42
  resource = #{resource.to_s}
@@ -94,7 +94,7 @@ job = wf.job(task, jobname, job_inputs)
94
94
  STDOUT.write res.to_json
95
95
  EOF
96
96
 
97
- json = Misc.ssh_run(server, script)
97
+ json = SSHLine.ruby(server, script)
98
98
  Log.debug "JSON (#{ url }): #{json}" if RBBT_DEBUG_REMOTE_JSON
99
99
  JSON.parse(json)
100
100
  end
@@ -107,7 +107,7 @@ STDOUT.write res.to_json
107
107
  STDOUT.write res
108
108
  EOF
109
109
 
110
- Misc.ssh_run(server, script)
110
+ SSHLine.ruby(server, script)
111
111
  end
112
112
 
113
113
  def self.post_job(url, inputs_id, jobname = nil)
@@ -119,7 +119,7 @@ STDOUT.write res
119
119
  job.init_info
120
120
  STDOUT.write job.path
121
121
  EOF
122
- Misc.ssh_run(server, script)
122
+ SSHLine.ruby(server, script)
123
123
  end
124
124
 
125
125
  def self.run_job(url, input_id, jobname = nil)
@@ -133,7 +133,7 @@ job.clean if job.error? and job.recoverable_error?
133
133
  job.run unless job.done? || job.error?
134
134
  STDOUT.write job.path
135
135
  EOF
136
- Misc.ssh_run(server, script)
136
+ SSHLine.ruby(server, script)
137
137
  end
138
138
 
139
139
  def self.run_batch_job(url, input_id, jobname = nil, batch_options = {})
@@ -149,7 +149,7 @@ job.clean if job.error? and job.recoverable_error?
149
149
  HPC::BATCH_MODULE.run_job(job, batch_options) unless job.done? || job.error?
150
150
  STDOUT.write job.path
151
151
  EOF
152
- Misc.ssh_run(server, script)
152
+ SSHLine.ruby(server, script)
153
153
  end
154
154
 
155
155
  def self.orchestrate_batch_job(url, input_id, jobname = nil, batch_options = {})
@@ -165,7 +165,7 @@ job.clean if job.error? and job.recoverable_error?
165
165
  HPC::BATCH_MODULE.orchestrate_job(job, batch_options) unless job.done? || job.error?
166
166
  STDOUT.write job.path
167
167
  EOF
168
- Misc.ssh_run(server, script)
168
+ SSHLine.ruby(server, script)
169
169
  end
170
170
 
171
171
  def self.clean(url, input_id, jobname = nil)
@@ -175,7 +175,7 @@ STDOUT.write job.path
175
175
  script +=<<-EOF
176
176
  job.clean
177
177
  EOF
178
- Misc.ssh_run(server, script)
178
+ SSHLine.ruby(server, script)
179
179
  end
180
180
 
181
181
  def self.upload_inputs(server, inputs, input_types, input_id)
@@ -234,7 +234,7 @@ job.clean
234
234
  all_deps.each do |dep,jobs|
235
235
  next if dep.done?
236
236
  next if job_list.include?(dep)
237
- Log.medium "Producing #{dep.workflow}:#{dep.short_path} dependency for #{Misc.fingerprint jobs}"
237
+ Log.medium "Producing #{dep.workflow}:#{dep.short_path} dependency for #{Log.fingerprint jobs}"
238
238
  dep.produce
239
239
  missing_deps << dep
240
240
  end if produce_dependencies
@@ -243,7 +243,7 @@ job.clean
243
243
 
244
244
  #migrate_dependencies = all_deps.keys.collect{|d| [d] + d.rec_dependencies + d.input_dependencies }.flatten.select{|d| d.done? }.collect{|d| d.path }
245
245
  migrate_dependencies = all_deps.keys.collect{|d| [d] + d.input_dependencies }.flatten.select{|d| d.done? }.collect{|d| d.path }
246
- Log.low "Migrating #{migrate_dependencies.length} dependencies from #{Misc.fingerprint job_list} to #{ server }"
246
+ Log.low "Migrating #{migrate_dependencies.length} dependencies from #{Log.fingerprint job_list} to #{ server }"
247
247
  Step.migrate(migrate_dependencies, search_path, :target => server) if migrate_dependencies.any?
248
248
  end
249
249
 
@@ -287,7 +287,7 @@ job.clean
287
287
 
288
288
  if options[:migrate]
289
289
  rjob.produce
290
- Step.migrate(Rbbt.identify(job.path), 'user', :source => server)
290
+ Step.migrate(Path.identify(job.path), 'user', :source => server)
291
291
  end
292
292
 
293
293
  rjob
@@ -337,7 +337,7 @@ job.clean
337
337
  if options[:migrate]
338
338
  rjobs_job.each do |rjob,job|
339
339
  rjob.produce
340
- Step.migrate(Rbbt.identify(job.path), 'user', :source => server)
340
+ Step.migrate(Path.identify(job.path), 'user', :source => server)
341
341
  end
342
342
  end
343
343
 
@@ -289,7 +289,7 @@ class RemoteStep < Step
289
289
 
290
290
  stream = true if res.respond_to? :read
291
291
  join unless stream
292
- result_type ||= self.result_type
292
+ result_type ||= self.type
293
293
 
294
294
  case result_type.to_sym
295
295
  when :string
@@ -5,7 +5,8 @@ class RemoteWorkflow
5
5
 
6
6
  attr_accessor :url, :name, :exec_exports, :synchronous_exports, :asynchronous_exports, :stream_exports
7
7
 
8
- def initialize(url, name)
8
+ def initialize(url, name = nil)
9
+ name = File.basename(url) if name.nil?
9
10
  Log.debug{ "Loading remote workflow #{ name }: #{ url }" }
10
11
  @url, @name = url, name
11
12
 
data/lib/rbbt.rb CHANGED
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift File.join(__dir__, '../../lib')
3
3
 
4
4
  require 'scout/path'
5
5
  require 'scout/resource'
6
- Path.add_path :rbbt_util, File.join(Path.caller_lib_dir(__FILE__), "{TOPLEVEL}/{SUBPATH}")
6
+ Path.add_path :rbbt_util_lib, File.join(Path.caller_lib_dir(__FILE__), "{TOPLEVEL}/{SUBPATH}")
7
7
  module Rbbt
8
8
  extend Resource
9
9
 
@@ -338,7 +338,7 @@ workdir.glob("**/command.batch").sort_by{|f| File.mtime(f)}.each do |fcmd|
338
338
  step_path = step_line.split(": ").last.strip
339
339
  step = Step.new step_path
340
340
  has_bar = false
341
- (step.rec_dependencies + [step]).reverse.each do |j|
341
+ (step.rec_dependencies + [step]).to_a.reverse.each do |j|
342
342
  next if j.done?
343
343
  if j.file(:progress).exists?
344
344
  bar = Log::ProgressBar.new
@@ -338,7 +338,7 @@ workdir.glob("**/command.batch").sort_by{|f| File.mtime(f)}.each do |fcmd|
338
338
  step_path = step_line.split(": ").last.strip
339
339
  step = Step.new step_path
340
340
  has_bar = false
341
- (step.rec_dependencies + [step]).reverse.each do |j|
341
+ (step.rec_dependencies + [step]).to_a.reverse.each do |j|
342
342
  next if j.done?
343
343
  if j.file(:progress).exists?
344
344
  bar = Log::ProgressBar.new
@@ -338,7 +338,7 @@ workdir.glob("**/command.batch").sort_by{|f| File.mtime(f)}.each do |fcmd|
338
338
  step_path = step_line.split(": ").last.strip
339
339
  step = Step.new step_path
340
340
  has_bar = false
341
- (step.rec_dependencies + [step]).reverse.each do |j|
341
+ (step.rec_dependencies + [step]).to_a.reverse.each do |j|
342
342
  next if j.done?
343
343
  if j.file(:progress).exists?
344
344
  bar = Log::ProgressBar.new
@@ -74,7 +74,7 @@ end if resource
74
74
 
75
75
  path = (resource || Rbbt)[path]
76
76
 
77
- if where.nil? || where == 'all' || path.search_paths.include?(where.to_sym)
77
+ if where.nil? || where == 'all' || path.map_maps.include?(where.to_sym)
78
78
  location = path.find(where)
79
79
 
80
80
  if Array === location
@@ -338,7 +338,7 @@ workdir.glob("**/command.batch").sort_by{|f| File.mtime(f)}.each do |fcmd|
338
338
  step_path = step_line.split(": ").last.strip
339
339
  step = Step.new step_path
340
340
  has_bar = false
341
- (step.rec_dependencies + [step]).reverse.each do |j|
341
+ (step.rec_dependencies + [step]).to_a.reverse.each do |j|
342
342
  next if j.done?
343
343
  if j.file(:progress).exists?
344
344
  bar = Log::ProgressBar.new
@@ -36,7 +36,7 @@ inputs = (options[:inputs] || "").split(",")
36
36
  info_fields = (options[:info_fields] || "").split(",")
37
37
 
38
38
  def pid_msg(pid)
39
- color = if pid and Misc.pid_exists? pid
39
+ color = if pid and Misc.pid_alive? pid
40
40
  :green
41
41
  else
42
42
  :red
@@ -211,7 +211,7 @@ workflows.sort.each do |workflow,tasks|
211
211
  status = :missing if status == :done and not (Open.exist?(file) && ! Open.broken_link?(file))
212
212
  status = :broken if Open.broken_link?(file)
213
213
  status = status.to_s
214
- if status != "done" and pid and not Misc.pid_exists?(pid)
214
+ if status != "done" and pid and not Misc.pid_alive?(pid)
215
215
  if File.exist? file
216
216
  status << Log.color(:red, " (out of sync)")
217
217
  else
@@ -56,7 +56,7 @@ def status_msg(status)
56
56
  end
57
57
 
58
58
  def pid_msg(pid, done = false)
59
- color = if pid and (done or Misc.pid_exists? pid)
59
+ color = if pid and (done or Misc.pid_alive? pid)
60
60
  :green
61
61
  else
62
62
  :red
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbbt-util
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.4
4
+ version: 6.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-03-31 00:00:00.000000000 Z
10
+ date: 2025-06-10 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: scout-gear
@@ -374,6 +374,7 @@ files:
374
374
  - lib/rbbt/workflow/util/orchestrator.rb
375
375
  - lib/rbbt/workflow/util/provenance.rb
376
376
  - lib/rbbt/workflow/util/trace.rb
377
+ - python/rbbt/'/Users/miki/config/tmp/undodir'/%Users%miki%git%rbbt-util%python%rbbt%__init__.py
377
378
  - python/rbbt/__init__.py
378
379
  - python/rbbt/workflow.py
379
380
  - python/rbbt/workflow/remote.py
@@ -517,7 +518,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
517
518
  - !ruby/object:Gem::Version
518
519
  version: '0'
519
520
  requirements: []
520
- rubygems_version: 3.6.5
521
+ rubygems_version: 3.6.6
521
522
  specification_version: 4
522
523
  summary: Utilities for the Ruby Bioinformatics Toolkit (rbbt)
523
524
  test_files: []