rbbt-util 5.32.12 → 5.32.13

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
2
  SHA256:
3
- metadata.gz: 355cf2694fc6b449600580f6c09f2a0a6055013285b5c53ada6ad2f920d7f63c
4
- data.tar.gz: 26e430d330e39371b8fb59f3508b3e1eb215bf042bf2faa5262040fd19369e24
3
+ metadata.gz: 4c61ee9aa98e617b2cd43ea3c57b71439cbb5c2c65282ed7695fafd5c46ccbf3
4
+ data.tar.gz: e30e12b162f86ee74b4a4c33e44c7e976612a11e8219b2afd9c6cc0ea520fe24
5
5
  SHA512:
6
- metadata.gz: ecec79da1a0b8ecdbcec6e600965d6cc8a336f6d33a4dd3ada4a75e2c6ae8d98300a210bc17eec7bb16639c4d73b4a6efe7bceb043037fa0aeaf76d3da20b172
7
- data.tar.gz: 3af9d791b8423f99c67c473541fcc6b685c2cb4ca454423ff0b69d686442b40574d337df749dcf811369b81d68c648ff733dcf3c4e2e655953aba0f4569b85b1
6
+ metadata.gz: abee1a9322982a9da1cca62f7c36e47a7517a6c8066177f5155f8bfc17e6bc19054bfc1b8068c67e58fb0bf4a1c7585c3d493c2ca70d600391348e03f61ebab6
7
+ data.tar.gz: 80e3f811802c5e33cefd1c7c9561a9bdfcc2cfbfa97f300babd3c095de1d5bfb14a88e2e52918c4be9e869f9bf2722df68a493895077101e42b2f4ee57e9427c
@@ -174,6 +174,8 @@ module TSV
174
174
  if Hash === @monitor
175
175
  desc = @monitor[:desc] if @monitor.include? :desc
176
176
  step = @monitor[:step] if @monitor.include? :step
177
+ elsif String === @monitor
178
+ desc = @monitor
177
179
  end
178
180
  progress_monitor = Log::ProgressBar.new_bar(size, :desc => desc)
179
181
  end
data/lib/rbbt/util/R.rb CHANGED
@@ -41,7 +41,7 @@ source('#{UTIL}');
41
41
 
42
42
  if monitor
43
43
  #io = CMD.cmd('R --no-save --quiet', options.merge(:in => cmd, :pipe => true, :log => true))
44
- io = CMD.cmd('R --no-save --quiet', options.merge(:in => cmd, :pipe => true, :log => true, :xvfb => true))
44
+ io = CMD.cmd('R --no-save --quiet', options.merge(:in => cmd, :pipe => true, :log => true, :xvfb => options[:xvfb]))
45
45
  while line = io.gets
46
46
  case monitor
47
47
  when Proc
@@ -52,7 +52,7 @@ source('#{UTIL}');
52
52
  end
53
53
  nil
54
54
  else
55
- CMD.cmd('R --no-save --slave --quiet', options.merge(:in => cmd, :xvfb => true))
55
+ CMD.cmd('R --no-save --slave --quiet', options.merge(:in => cmd, :xvfb => options[:xvfb]))
56
56
  end
57
57
  end
58
58
 
@@ -3,10 +3,17 @@ require 'pycall/import'
3
3
 
4
4
  module RbbtPython
5
5
  extend PyCall::Import
6
+
7
+ def self.exec(script)
8
+ PyCall.exec(script)
9
+ end
10
+
6
11
  def self.run(mod = nil, imports = nil, &block)
7
12
  if mod
8
- if imports
13
+ if Array === imports
9
14
  pyfrom mod, :import => imports
15
+ elsif Hash === imports
16
+ pyimport mod, imports
10
17
  else
11
18
  pyimport mod
12
19
  end
@@ -17,8 +24,10 @@ module RbbtPython
17
24
 
18
25
  def self.run_log(mod = nil, imports = nil, severity = 0, severity_err = nil, &block)
19
26
  if mod
20
- if imports
27
+ if Array === imports
21
28
  pyfrom mod, :import => imports
29
+ elsif Hash === imports
30
+ pyimport mod, imports
22
31
  else
23
32
  pyimport mod
24
33
  end
@@ -31,8 +40,10 @@ module RbbtPython
31
40
 
32
41
  def self.run_log_stderr(mod = nil, imports = nil, severity = 0, &block)
33
42
  if mod
34
- if imports
43
+ if Array === imports
35
44
  pyfrom mod, :import => imports
45
+ elsif Hash === imports
46
+ pyimport mod, imports
36
47
  else
37
48
  pyimport mod
38
49
  end
@@ -49,4 +60,14 @@ module RbbtPython
49
60
  end
50
61
  end
51
62
 
63
+ def self.add_paths(paths)
64
+ self.run 'sys' do
65
+ paths.each do |path|
66
+ sys.path.append path
67
+ end
68
+ end
69
+ end
70
+
71
+ RbbtPython.add_paths Rbbt.python.find_all
72
+ RbbtPython.pyimport "rbbt"
52
73
  end
@@ -0,0 +1,31 @@
1
+ require 'rbbt/workflow'
2
+ require 'rbbt/workflow/examples'
3
+
4
+ module Workflow
5
+ module Data
6
+ def data(directory)
7
+ @@data_directory = directory
8
+ end
9
+
10
+ def get_datadir(clean_name)
11
+ data_dir = File.join(@@data_directory, clean_name)
12
+ raise "Data dir not found #{data_dir}" unless File.directory?(data_dir)
13
+ if Path === @@data_directory
14
+ @@data_directory.annotate data_dir
15
+ else
16
+ Path.setup(data_dir)
17
+ end
18
+ end
19
+
20
+ def data_task(name, workflow, oname, *rest, &block)
21
+ dep_task(name, workflow, oname, *rest) do |jobname, options|
22
+ data_dir = self.get_datadir(jobname)
23
+ task_info = workflow.task_info(oname)
24
+ dir_options = Workflow.load_inputs(data_dir.options, task_info[:inputs], task_info[:input_types])
25
+ data_options = block.call data_dir, dir_options, task_info
26
+ {:inputs => data_options.merge(options)}
27
+ end
28
+ end
29
+ end
30
+
31
+ end
data/python/rbbt.py ADDED
@@ -0,0 +1,3 @@
1
+ def rbbt():
2
+ print("Rbbt")
3
+
@@ -499,7 +499,7 @@ install_jar(){
499
499
  local url="$2"
500
500
 
501
501
  [ -d "$OPT_DIR/$name/" ] || mkdir -p "$OPT_DIR/$name/"
502
- wget "$url" -O "$OPT_DIR/jars/$name.jar" || wget "$url" -O "$OPT_DIR/jars/$name.jar" --no-check-certificate || (rm "$OPT_DIR/jars/$name.jar"; exit -1)
502
+ wget "$url" -O "$OPT_DIR/$name/$name.jar" || wget "$url" -O "$OPT_DIR/$name/$name.jar" --no-check-certificate || (rm "$OPT_DIR/$name/$name.jar"; exit -1)
503
503
  link "$OPT_DIR/$name/$name.jar" "$OPT_JAR_DIR/$name.jar"
504
504
  }
505
505
 
@@ -2,6 +2,7 @@ require File.join(File.expand_path(File.dirname(__FILE__)), '../..', 'test_helpe
2
2
  require 'rbbt/util/python'
3
3
 
4
4
  class TestPython < Test::Unit::TestCase
5
+
5
6
  def test_python
6
7
  TmpFile.with_file do |tmpdir|
7
8
  code =<<-EOF
@@ -67,7 +68,7 @@ def python_print():
67
68
 
68
69
  def test_keras
69
70
  defined = RbbtPython.run do
70
- pyimport "keras.models", as: :km
71
+ pyimport "tensorflow.keras.models", as: :km
71
72
  defined?(km.Sequential)
72
73
  end
73
74
  assert defined
@@ -75,7 +76,7 @@ def python_print():
75
76
 
76
77
  def test_keras_import
77
78
  defined = RbbtPython.run do
78
- pyfrom "keras.models", import: :Sequential
79
+ pyfrom "tensorflow.keras.models", import: :Sequential
79
80
  defined?(self::Sequential)
80
81
  end
81
82
  assert defined
@@ -0,0 +1,35 @@
1
+ require File.join(File.expand_path(File.dirname(__FILE__)), '../../..', 'test_helper.rb')
2
+ require 'rbbt/workflow/util/data'
3
+
4
+ module TestDataWF
5
+ extend Workflow
6
+ extend Workflow::Data
7
+
8
+ input :name, :string
9
+ input :salutation, :string
10
+ task :salute => :string do |name,salutation|
11
+ "Hi #{name}: #{salutation}"
12
+ end
13
+
14
+ data_task :salute_data, TestDataWF, :salute do |directory,options|
15
+ options.merge({:salutation => directory.salutation.read})
16
+ end
17
+ end
18
+
19
+ class TestWorkflowData < Test::Unit::TestCase
20
+ def test_workflow_data
21
+ TmpFile.with_file do |tmpdir|
22
+ tmpdir = Path.setup(tmpdir.dup)
23
+
24
+ Open.write(tmpdir.TestDir.options.name, "Miguel")
25
+ Open.write(tmpdir.TestDir.salutation, "My salutations")
26
+
27
+ TestDataWF.data tmpdir
28
+
29
+ job = TestDataWF.job(:salute_data, "TestDir")
30
+ job.recursive_clean.run
31
+ ppp job.run
32
+ end
33
+ end
34
+ end
35
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbbt-util
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.32.12
4
+ version: 5.32.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-25 00:00:00.000000000 Z
11
+ date: 2021-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -344,9 +344,11 @@ files:
344
344
  - lib/rbbt/workflow/task.rb
345
345
  - lib/rbbt/workflow/usage.rb
346
346
  - lib/rbbt/workflow/util/archive.rb
347
+ - lib/rbbt/workflow/util/data.rb
347
348
  - lib/rbbt/workflow/util/orchestrator.rb
348
349
  - lib/rbbt/workflow/util/provenance.rb
349
350
  - lib/rbbt/workflow/util/trace.rb
351
+ - python/rbbt.py
350
352
  - share/Rlib/plot.R
351
353
  - share/Rlib/svg.R
352
354
  - share/Rlib/util.R
@@ -549,6 +551,7 @@ files:
549
551
  - test/rbbt/workflow/test_step.rb
550
552
  - test/rbbt/workflow/test_task.rb
551
553
  - test/rbbt/workflow/util/test_archive.rb
554
+ - test/rbbt/workflow/util/test_data.rb
552
555
  - test/rbbt/workflow/util/test_orchestrator.rb
553
556
  - test/test_helper.rb
554
557
  homepage: http://github.com/mikisvaz/rbbt-util
@@ -579,6 +582,7 @@ test_files:
579
582
  - test/rbbt/workflow/test_remote_workflow.rb
580
583
  - test/rbbt/workflow/util/test_archive.rb
581
584
  - test/rbbt/workflow/util/test_orchestrator.rb
585
+ - test/rbbt/workflow/util/test_data.rb
582
586
  - test/rbbt/workflow/test_doc.rb
583
587
  - test/rbbt/workflow/test_schedule.rb
584
588
  - test/rbbt/workflow/test_step.rb