t2-server 1.0.0 → 1.1.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.
- data/.gitignore +8 -0
- data/.travis.yml +6 -0
- data/CHANGES.rdoc +24 -0
- data/Gemfile +35 -0
- data/LICENCE.rdoc +1 -1
- data/README.rdoc +35 -12
- data/Rakefile +4 -41
- data/bin/t2-run-workflow +18 -3
- data/bin/t2-server-admin +12 -2
- data/bin/t2-server-info +11 -1
- data/lib/t2-server.rb +6 -13
- data/lib/t2-server/exceptions.rb +3 -2
- data/lib/t2-server/interaction.rb +1 -2
- data/lib/t2-server/run.rb +89 -7
- data/lib/t2-server/server.rb +95 -33
- data/lib/t2-server/{xml/rexml.rb → version.rb} +9 -49
- data/lib/t2-server/xml.rb +36 -0
- data/lib/t2-server/xml/{xml.rb → fragments.rb} +1 -45
- data/lib/t2-server/xml/{libxml.rb → methods.rb} +14 -2
- data/lib/t2-server/xml/{nokogiri.rb → namespaces.rb} +13 -50
- data/t2-server.gemspec +63 -125
- data/test/tc_run.rb +66 -9
- data/test/tc_server_version.rb +82 -0
- data/test/ts_t2server.rb +8 -7
- data/version.yml +1 -1
- metadata +39 -49
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/CHANGES.rdoc
CHANGED
@@ -1,5 +1,29 @@
|
|
1
1
|
= Changes log for the T2 Ruby Gem
|
2
2
|
|
3
|
+
== Version 1.1.0
|
4
|
+
|
5
|
+
* Remove hirb as a runtime dependency.
|
6
|
+
* t2-server-admin: Minor fix for readability.
|
7
|
+
* Add a gem version badge from badge.fury.io.
|
8
|
+
* Use bundler and stop using jeweler.
|
9
|
+
* Update dependencies.
|
10
|
+
* Add travis configuration.
|
11
|
+
* Separate out the version code from the main include file.
|
12
|
+
* If in travis, don't wait for a server address.
|
13
|
+
* Update note about SemVer in readme.
|
14
|
+
* Add travis badge and update ruby testing info.
|
15
|
+
* Refactor out rexml and nokogiri xml support.
|
16
|
+
* Setup rubygems and bundler in the main require file.
|
17
|
+
* t2-run-workflow: Fix baclava output option.
|
18
|
+
* Fix error in exception caused by chunked response.
|
19
|
+
* Add provenance capture and retrieval functionality.
|
20
|
+
* Can now toggle provenance generation on and off.
|
21
|
+
* Implement a comparable version class.
|
22
|
+
* Restrict provenance functionality to correct server versions.
|
23
|
+
* Remove Server#version_components from the docs.
|
24
|
+
* Tighten ratom version and move libxml-ruby to runtime list.
|
25
|
+
* Align baclava output method names with the prov ones.
|
26
|
+
|
3
27
|
== Version 1.0.0
|
4
28
|
|
5
29
|
* Remove deprecated methods.
|
data/Gemfile
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# Copyright (c) 2014 The University of Manchester, UK.
|
2
|
+
#
|
3
|
+
# All rights reserved.
|
4
|
+
#
|
5
|
+
# Redistribution and use in source and binary forms, with or without
|
6
|
+
# modification, are permitted provided that the following conditions are met:
|
7
|
+
#
|
8
|
+
# * Redistributions of source code must retain the above copyright notice,
|
9
|
+
# this list of conditions and the following disclaimer.
|
10
|
+
#
|
11
|
+
# * Redistributions in binary form must reproduce the above copyright notice,
|
12
|
+
# this list of conditions and the following disclaimer in the documentation
|
13
|
+
# and/or other materials provided with the distribution.
|
14
|
+
#
|
15
|
+
# * Neither the names of The University of Manchester nor the names of its
|
16
|
+
# contributors may be used to endorse or promote products derived from this
|
17
|
+
# software without specific prior written permission.
|
18
|
+
#
|
19
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
20
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
21
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
22
|
+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
23
|
+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
24
|
+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
25
|
+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
26
|
+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
27
|
+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
28
|
+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
29
|
+
# POSSIBILITY OF SUCH DAMAGE.
|
30
|
+
#
|
31
|
+
# Author: Robert Haines
|
32
|
+
|
33
|
+
source "https://rubygems.org"
|
34
|
+
|
35
|
+
gemspec
|
data/LICENCE.rdoc
CHANGED
data/README.rdoc
CHANGED
@@ -4,9 +4,11 @@ Authors:: Robert Haines
|
|
4
4
|
Contact:: mailto:support@mygrid.org.uk
|
5
5
|
URL:: http://www.taverna.org.uk/
|
6
6
|
Licence:: BSD (See LICENCE or http://www.opensource.org/licenses/bsd-license.php)
|
7
|
-
Copyright:: (c) 2010-
|
7
|
+
Copyright:: (c) 2010-2014 The University of Manchester, UK
|
8
8
|
|
9
|
+
{<img src="https://badge.fury.io/rb/t2-server.png" alt="Gem Version" />}[http://badge.fury.io/rb/t2-server]
|
9
10
|
{<img src="https://codeclimate.com/github/myGrid/t2-server-gem.png" />}[https://codeclimate.com/github/myGrid/t2-server-gem]
|
11
|
+
{<img src="https://travis-ci.org/myGrid/t2-server-gem.svg?branch=master" alt="Build Status" />}[https://travis-ci.org/myGrid/t2-server-gem]
|
10
12
|
|
11
13
|
== Synopsis
|
12
14
|
|
@@ -28,9 +30,7 @@ https://github.com/myGrid/t2-server-gem
|
|
28
30
|
|
29
31
|
== Compatibility
|
30
32
|
|
31
|
-
|
32
|
-
{Semantic Versioning}[http://semver.org/]. Until that point there may be
|
33
|
-
breaking changes to the API, although these will be kept to a minimum.
|
33
|
+
This gem uses {Semantic Versioning}[http://semver.org/].
|
34
34
|
|
35
35
|
=== Taverna Server
|
36
36
|
|
@@ -52,18 +52,24 @@ Server, but if that is not possible right now then these are the recommended
|
|
52
52
|
version pairings:
|
53
53
|
* pre Taverna Server 2.3, use version 0.6.1 of the gem
|
54
54
|
* 2.3, use version 0.9.3
|
55
|
-
* 2.4 and up, use version 1.0.0
|
55
|
+
* 2.4 and up, use version 1.0.0 and up.
|
56
56
|
|
57
57
|
=== Ruby
|
58
58
|
|
59
59
|
This library is known to work with the following versions of Ruby:
|
60
|
-
* 1.8.7
|
61
60
|
* 1.9.2
|
62
|
-
* 1.9.3
|
63
|
-
* 2.0.0
|
61
|
+
* 1.9.3 +*
|
62
|
+
* 2.0.0 +*
|
63
|
+
* 2.1.0 +
|
64
64
|
|
65
|
-
Those marked with an asterisk (*) are supported and bugs found against
|
66
|
-
will be fixed. Other versions may work but are not tested or supported.
|
65
|
+
Those marked with an asterisk (*) are fully supported and bugs found against
|
66
|
+
them will be fixed. Other versions may work but are not tested or supported.
|
67
|
+
|
68
|
+
Those marked with a plus (+) are tested in
|
69
|
+
{https://travis-ci.org/myGrid/t2-server-gem}[Travis].
|
70
|
+
|
71
|
+
Ruby 1.8.7 is no longer supported as it reached its end of life at the end of
|
72
|
+
June 2013.
|
67
73
|
|
68
74
|
== Usage
|
69
75
|
|
@@ -233,12 +239,29 @@ supported:
|
|
233
239
|
But make sure you request baclava output *before* starting the run. Baclava
|
234
240
|
output can be downloaded into memory or saved directly to a file.
|
235
241
|
|
236
|
-
run.
|
242
|
+
run.generate_baclava_output
|
237
243
|
run.start
|
238
244
|
run.wait
|
239
245
|
output = run.baclava_output # download to memory
|
240
246
|
run.baclava_output("/path/to/output.baclava") # save to a file
|
241
247
|
|
248
|
+
Later versions of Taverna Server can generate a complete provenance log of a
|
249
|
+
workflow run in {Taverna-PROV}[https://github.com/myGrid/taverna-prov] format.
|
250
|
+
The generation of provenance data must be requested *before* starting the run.
|
251
|
+
|
252
|
+
run.generate_provenance
|
253
|
+
run.start
|
254
|
+
...
|
255
|
+
provenance = run.provenance # download to memory
|
256
|
+
run.provenance("/path/to/provenance.zip") # save to a file
|
257
|
+
|
258
|
+
The resultant provenance bundle is a zip file containing all input, output and
|
259
|
+
intermediate values as separate files, along with the provenance of
|
260
|
+
the workflow run. The bundle is based on the
|
261
|
+
{Research Object Bundle specification}[http://wf4ever.github.io/ro/bundle/],
|
262
|
+
and complies with the
|
263
|
+
{W3C PROV-O provenance specification}[http://www.w3.org/TR/prov-o/].
|
264
|
+
|
242
265
|
The log from Taverna Server can be downloaded in a similar way to zip files or
|
243
266
|
Baclava documents.
|
244
267
|
|
@@ -246,7 +269,7 @@ Baclava documents.
|
|
246
269
|
run.log("/path/to/log.txt") # save to a file
|
247
270
|
|
248
271
|
When downloading outputs the underlying stream can be accessed by supplying a
|
249
|
-
block to the value, zip_output, baclava_output or log methods:
|
272
|
+
block to the value, zip_output, provenance, baclava_output or log methods:
|
250
273
|
|
251
274
|
run.output_port("port_name").value do |data|
|
252
275
|
print data
|
data/Rakefile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2010-
|
1
|
+
# Copyright (c) 2010-2014 The University of Manchester, UK.
|
2
2
|
#
|
3
3
|
# All rights reserved.
|
4
4
|
#
|
@@ -30,49 +30,12 @@
|
|
30
30
|
#
|
31
31
|
# Author: Robert Haines
|
32
32
|
|
33
|
-
require
|
34
|
-
require
|
35
|
-
require
|
36
|
-
require 'rake/tasklib'
|
37
|
-
require 'rdoc/task'
|
38
|
-
require 'jeweler'
|
39
|
-
|
40
|
-
# we need to add lib to the path because we're not installed yet!
|
41
|
-
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), "lib")
|
42
|
-
require 't2-server'
|
33
|
+
require "bundler/gem_tasks"
|
34
|
+
require "rake/testtask"
|
35
|
+
require "rdoc/task"
|
43
36
|
|
44
37
|
task :default => [:test]
|
45
38
|
|
46
|
-
Jeweler::Tasks.new do |s|
|
47
|
-
s.name = "t2-server"
|
48
|
-
s.version = T2Server::Version::STRING
|
49
|
-
s.authors = ["Robert Haines", "Finn Bacall"]
|
50
|
-
s.email = ["support@mygrid.org.uk"]
|
51
|
-
s.homepage = "http://www.taverna.org.uk/"
|
52
|
-
s.platform = Gem::Platform::RUBY
|
53
|
-
s.summary = "Support for interacting with Taverna 2 Server."
|
54
|
-
s.description = "This gem provides access to the Taverna 2 Server " +
|
55
|
-
"REST interface from Ruby."
|
56
|
-
s.require_path = "lib"
|
57
|
-
s.bindir = "bin"
|
58
|
-
s.executables = ["t2-delete-runs", "t2-run-workflow", "t2-server-info",
|
59
|
-
"t2-get-output", "t2-server-admin"]
|
60
|
-
s.test_file = "test/ts_t2server.rb"
|
61
|
-
s.has_rdoc = true
|
62
|
-
s.extra_rdoc_files = ["README.rdoc", "LICENCE.rdoc", "CHANGES.rdoc"]
|
63
|
-
s.rdoc_options = ["-N", "--tab-width=2", "--main=README.rdoc"]
|
64
|
-
s.add_development_dependency('rake', '~> 0.9.2')
|
65
|
-
s.add_development_dependency('libxml-ruby', '>= 1.1.4')
|
66
|
-
s.add_development_dependency('nokogiri', '>= 1.5.0')
|
67
|
-
s.add_development_dependency('rdoc', '>= 3.9.4')
|
68
|
-
s.add_development_dependency('jeweler', '~> 1.8.3')
|
69
|
-
s.add_development_dependency('launchy', '~> 2.2.0')
|
70
|
-
s.add_runtime_dependency('net-http-persistent', '~> 2.6')
|
71
|
-
s.add_runtime_dependency('taverna-baclava', '~> 1.0.0')
|
72
|
-
s.add_runtime_dependency('ratom', '~> 0.8.2')
|
73
|
-
s.add_runtime_dependency('hirb', '>= 0.4.0')
|
74
|
-
end
|
75
|
-
|
76
39
|
# This test task does not use the standard Rake::TestTask class as we need to
|
77
40
|
# be able to supply an argument to the test. This is so that the test can be
|
78
41
|
# run with a server address from a CI server. The equivalent TestTask would be
|
data/bin/t2-run-workflow
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
# Copyright (c) 2010-
|
2
|
+
# Copyright (c) 2010-2014 The University of Manchester, UK.
|
3
3
|
#
|
4
4
|
# All rights reserved.
|
5
5
|
#
|
@@ -86,13 +86,19 @@ conn_params, creds = register_options("Usage: t2-run-workflow [options] "\
|
|
86
86
|
user, pass = cred.chomp.split(':', 2)
|
87
87
|
options[:screds] << [uri, user, pass]
|
88
88
|
end
|
89
|
+
opt.on("-P [FILE]", "--provenance", "Generate provenance for the run and "\
|
90
|
+
"save it to a file. A filename may be specified or 'provenance.zip' "\
|
91
|
+
"will be used. Getting outputs in baclava format overrides this "\
|
92
|
+
"option.") do |val|
|
93
|
+
options[:provenance] = (val || "provenance.zip").chomp
|
94
|
+
end
|
89
95
|
opt.on("-b BACLAVA", "--baclava-in=BACLAVA", "Set baclava file for input "\
|
90
96
|
"port values") do |val|
|
91
97
|
inputs[:baclava] = val
|
92
98
|
end
|
93
|
-
opt.on("-o", "--baclava-out
|
99
|
+
opt.on("-o [FILE]", "--baclava-out", "Return outputs in baclava format."\
|
94
100
|
" A filename may be specified or 'out.xml' is used") do |val|
|
95
|
-
options[:baclava_out] = val.chomp
|
101
|
+
options[:baclava_out] = (val || "out.xml").chomp
|
96
102
|
end
|
97
103
|
opt.on("-n", "--no-wait", "Do not wait for workflow to finish, return "\
|
98
104
|
"once it has started running") do |val|
|
@@ -189,6 +195,9 @@ begin
|
|
189
195
|
run.add_password_credential(list[0], list[1], list[2])
|
190
196
|
end
|
191
197
|
|
198
|
+
# generate provenance?
|
199
|
+
run.generate_provenance if options[:provenance]
|
200
|
+
|
192
201
|
# output baclava?
|
193
202
|
run.request_baclava_output if options[:baclava_out]
|
194
203
|
|
@@ -250,6 +259,12 @@ begin
|
|
250
259
|
end
|
251
260
|
end
|
252
261
|
end
|
262
|
+
|
263
|
+
if options[:provenance]
|
264
|
+
run.provenance(options[:provenance])
|
265
|
+
puts "Provenance file written to '#{options[:provenance]}'"
|
266
|
+
end
|
267
|
+
|
253
268
|
end
|
254
269
|
|
255
270
|
# delete run?
|
data/bin/t2-server-admin
CHANGED
@@ -33,7 +33,6 @@
|
|
33
33
|
|
34
34
|
require 'rubygems'
|
35
35
|
require 't2-server-cli'
|
36
|
-
require 'hirb'
|
37
36
|
|
38
37
|
include T2Server::CLI
|
39
38
|
|
@@ -58,6 +57,17 @@ conn_params, creds = register_options("Usage: t2-server-admin [options] " +
|
|
58
57
|
end
|
59
58
|
end
|
60
59
|
|
60
|
+
if options[:list]
|
61
|
+
begin
|
62
|
+
require 'hirb'
|
63
|
+
rescue LoadError
|
64
|
+
puts "\n****\nTo list administrative resources in your terminal the "\
|
65
|
+
"hirb gem must be installed:\n\n$ gem install hirb\n\nThis information "\
|
66
|
+
"will not be shown this time, sorry.\n****\n\n"
|
67
|
+
options[:list] = false
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
61
71
|
# get runs and server address from the arguments
|
62
72
|
resources = []
|
63
73
|
address = ""
|
@@ -84,7 +94,7 @@ begin
|
|
84
94
|
server.administrator(creds) do |admin|
|
85
95
|
# list and exit?
|
86
96
|
if options[:list]
|
87
|
-
puts
|
97
|
+
puts Hirb::Helpers::ObjectTable.render(admin.resources.values,
|
88
98
|
:fields=>[:name, :writable?],
|
89
99
|
:headers=>{:name => 'Resource name', :writable? => 'Access'},
|
90
100
|
:filters=>{:writable? => :access},
|
data/bin/t2-server-info
CHANGED
@@ -33,7 +33,6 @@
|
|
33
33
|
|
34
34
|
require 'rubygems'
|
35
35
|
require 't2-server-cli'
|
36
|
-
require 'hirb'
|
37
36
|
|
38
37
|
include T2Server::CLI
|
39
38
|
|
@@ -51,6 +50,17 @@ conn_params, creds = register_options("Usage: t2-server-info [options] " +
|
|
51
50
|
end
|
52
51
|
end
|
53
52
|
|
53
|
+
if options[:list] > 0
|
54
|
+
begin
|
55
|
+
require 'hirb'
|
56
|
+
rescue LoadError
|
57
|
+
puts "\n****\nTo tabulate run information in your terminal the hirb gem "\
|
58
|
+
"must be installed:\n\n$ gem install hirb\n\nRun information will not "\
|
59
|
+
"be shown this time, sorry.\n****\n\n"
|
60
|
+
options[:list] = 0
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
54
64
|
# read and check server address and credentials
|
55
65
|
uri, creds = parse_address(ARGV.shift, creds)
|
56
66
|
|
data/lib/t2-server.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2010-
|
1
|
+
# Copyright (c) 2010-2014 The University of Manchester, UK.
|
2
2
|
#
|
3
3
|
# All rights reserved.
|
4
4
|
#
|
@@ -30,9 +30,12 @@
|
|
30
30
|
#
|
31
31
|
# Author: Robert Haines
|
32
32
|
|
33
|
-
require '
|
33
|
+
require 'rubygems'
|
34
|
+
require 'bundler/setup'
|
35
|
+
|
36
|
+
require 't2-server/version'
|
34
37
|
require 't2-server/util'
|
35
|
-
require 't2-server/xml
|
38
|
+
require 't2-server/xml'
|
36
39
|
require 't2-server/exceptions'
|
37
40
|
require 't2-server/net/credentials'
|
38
41
|
require 't2-server/net/connection'
|
@@ -50,14 +53,4 @@ require 't2-server/admin'
|
|
50
53
|
# * T2Server::Server - Use this if you are providing a web interface to a
|
51
54
|
# Taverna 2 Server instance.
|
52
55
|
module T2Server
|
53
|
-
|
54
|
-
# Library version information.
|
55
|
-
module Version
|
56
|
-
# Version information in a Hash
|
57
|
-
INFO = YAML.load_file(File.join(File.dirname(__FILE__), "..",
|
58
|
-
"version.yml"))
|
59
|
-
|
60
|
-
# Version number as a String
|
61
|
-
STRING = [:major, :minor, :patch].map {|d| INFO[d]}.compact.join('.')
|
62
|
-
end
|
63
56
|
end
|
data/lib/t2-server/exceptions.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2010-
|
1
|
+
# Copyright (c) 2010-2014 The University of Manchester, UK.
|
2
2
|
#
|
3
3
|
# All rights reserved.
|
4
4
|
#
|
@@ -104,7 +104,8 @@ module T2Server
|
|
104
104
|
@method = method
|
105
105
|
@path = path
|
106
106
|
@code = response.code
|
107
|
-
@body = response.body.
|
107
|
+
@body = response.body.to_s
|
108
|
+
@body = @body.empty? ? "<none>" : "#{response.body}"
|
108
109
|
message = "Unexpected server response:\n Method: #{@method}\n Path: "\
|
109
110
|
"#{@path}\n Code: #{@code}\n Body: #{@body}"
|
110
111
|
super message
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2010-
|
1
|
+
# Copyright (c) 2010-2014 The University of Manchester, UK.
|
2
2
|
#
|
3
3
|
# All rights reserved.
|
4
4
|
#
|
@@ -30,7 +30,6 @@
|
|
30
30
|
#
|
31
31
|
# Author: Robert Haines
|
32
32
|
|
33
|
-
require 'rubygems'
|
34
33
|
require 'atom'
|
35
34
|
require 'uri'
|
36
35
|
|
data/lib/t2-server/run.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2010-
|
1
|
+
# Copyright (c) 2010-2014 The University of Manchester, UK.
|
2
2
|
#
|
3
3
|
# All rights reserved.
|
4
4
|
#
|
@@ -32,7 +32,6 @@
|
|
32
32
|
|
33
33
|
require 'base64'
|
34
34
|
require 'time'
|
35
|
-
require 'rubygems'
|
36
35
|
require 'taverna-baclava'
|
37
36
|
|
38
37
|
module T2Server
|
@@ -79,6 +78,8 @@ module T2Server
|
|
79
78
|
:inputexp => "//nsr:expected",
|
80
79
|
:name => "//nsr:name",
|
81
80
|
:feed => "//nsr:interaction",
|
81
|
+
:gen_prov => "//nsr:generate-provenance",
|
82
|
+
:run_bundle => "//nsr:run-bundle",
|
82
83
|
|
83
84
|
# Port descriptions XPath queries
|
84
85
|
:port_in => "//port:input",
|
@@ -110,6 +111,7 @@ module T2Server
|
|
110
111
|
@workflow = ""
|
111
112
|
@baclava_in = false
|
112
113
|
@baclava_out = false
|
114
|
+
@provenance = false
|
113
115
|
|
114
116
|
@credentials = credentials
|
115
117
|
|
@@ -466,11 +468,11 @@ module T2Server
|
|
466
468
|
end
|
467
469
|
|
468
470
|
# :call-seq:
|
469
|
-
#
|
471
|
+
# generate_baclava_output -> true or false
|
470
472
|
#
|
471
473
|
# Set the server to save the outputs of this run in baclava format. This
|
472
474
|
# must be done before the run is started.
|
473
|
-
def
|
475
|
+
def generate_baclava_output
|
474
476
|
return if @baclava_out
|
475
477
|
state = status
|
476
478
|
raise RunStateError.new(state, :initialized) if state != :initialized
|
@@ -479,6 +481,16 @@ module T2Server
|
|
479
481
|
@credentials)
|
480
482
|
end
|
481
483
|
|
484
|
+
# :stopdoc:
|
485
|
+
def request_baclava_output
|
486
|
+
warn "[DEPRECATED] Run#request_baclava_output is deprecated and will "\
|
487
|
+
"be removed in the next major release. Please use "\
|
488
|
+
"Run#generate_baclava_output instead."
|
489
|
+
|
490
|
+
generate_baclava_output
|
491
|
+
end
|
492
|
+
# :startdoc:
|
493
|
+
|
482
494
|
# :call-seq:
|
483
495
|
# baclava_input? -> true or false
|
484
496
|
#
|
@@ -488,13 +500,23 @@ module T2Server
|
|
488
500
|
end
|
489
501
|
|
490
502
|
# :call-seq:
|
491
|
-
#
|
503
|
+
# generate_baclava_output? -> true or false
|
492
504
|
#
|
493
505
|
# Has this run been set to return results in baclava format?
|
494
|
-
def
|
506
|
+
def generate_baclava_output?
|
495
507
|
@baclava_out
|
496
508
|
end
|
497
509
|
|
510
|
+
# :stopdoc:
|
511
|
+
def baclava_output?
|
512
|
+
warn "[DEPRECATED] Run#baclava_output? is deprecated and will be "\
|
513
|
+
"removed in the next major release. Please use "\
|
514
|
+
"Run#generate_baclava_output? instead."
|
515
|
+
|
516
|
+
generate_baclava_output?
|
517
|
+
end
|
518
|
+
# :startdoc:
|
519
|
+
|
498
520
|
# :call-seq:
|
499
521
|
# baclava_output -> string
|
500
522
|
# baclava_output(filename) -> fixnum
|
@@ -530,6 +552,66 @@ module T2Server
|
|
530
552
|
download_or_stream(param, baclava_uri, "*/*", &block)
|
531
553
|
end
|
532
554
|
|
555
|
+
# :call-seq:
|
556
|
+
# generate_provenance(toggle = true) -> true or false
|
557
|
+
#
|
558
|
+
# Toggle the generation of provenance for this run on or off. This must be
|
559
|
+
# done before the run is started. Once the run has completed provenance
|
560
|
+
# can be retrieved with Run#provenance.
|
561
|
+
#
|
562
|
+
# Requesting baclava output for a run will override this setting.
|
563
|
+
def generate_provenance(toggle = true)
|
564
|
+
return @provenance if @provenance == toggle || links[:gen_prov].nil?
|
565
|
+
state = status
|
566
|
+
raise RunStateError.new(state, :initialized) if state != :initialized
|
567
|
+
|
568
|
+
result = @server.update(links[:gen_prov], toggle.to_s, "text/plain",
|
569
|
+
@credentials)
|
570
|
+
|
571
|
+
# If changing the setting worked then return the new setting, otherwise
|
572
|
+
# return the old one.
|
573
|
+
@provenance = result ? toggle : @provenance
|
574
|
+
end
|
575
|
+
|
576
|
+
# :call-seq:
|
577
|
+
# generate_provenance? -> true or false
|
578
|
+
#
|
579
|
+
# Has this run been set to generate provenance output?
|
580
|
+
def generate_provenance?
|
581
|
+
@provenance
|
582
|
+
end
|
583
|
+
|
584
|
+
# :call-seq:
|
585
|
+
# provenance -> binary blob
|
586
|
+
# provenance(filename) -> fixnum
|
587
|
+
# provenance(stream) -> fixnum
|
588
|
+
# provenance {|chunk| ...}
|
589
|
+
#
|
590
|
+
# Get the provenance of this run from the server in zip format.
|
591
|
+
#
|
592
|
+
# Calling this method with no parameters will simply return a blob of
|
593
|
+
# zipped data. Providing a filename will stream the data directly to that
|
594
|
+
# file and return the number of bytes written. Passing in an object that
|
595
|
+
# has a +write+ method (for example, an instance of File or IO) will
|
596
|
+
# stream the data directly to that object and return the number of bytes
|
597
|
+
# that were streamed. Passing in a block will allow access to the
|
598
|
+
# underlying data stream:
|
599
|
+
# run.provenance do |chunk|
|
600
|
+
# print chunk
|
601
|
+
# end
|
602
|
+
#
|
603
|
+
# Raises RunStateError if the run has not finished running.
|
604
|
+
def provenance(param = nil, &block)
|
605
|
+
raise ArgumentError,
|
606
|
+
'both a parameter and block given for provenance' if param && block
|
607
|
+
|
608
|
+
state = status
|
609
|
+
raise RunStateError.new(state, :finished) if state != :finished
|
610
|
+
|
611
|
+
raise AccessForbiddenError.new("provenance") unless @provenance
|
612
|
+
download_or_stream(param, links[:run_bundle], "*/*", &block)
|
613
|
+
end
|
614
|
+
|
533
615
|
# :call-seq:
|
534
616
|
# zip_output -> binary blob
|
535
617
|
# zip_output(filename) -> fixnum
|
@@ -1084,7 +1166,7 @@ module T2Server
|
|
1084
1166
|
# first parse out the basic stuff
|
1085
1167
|
links = get_uris_from_doc(doc, [:expiry, :workflow, :status,
|
1086
1168
|
:createtime, :starttime, :finishtime, :wdir, :inputs, :output,
|
1087
|
-
:securectx, :listeners, :name, :feed])
|
1169
|
+
:securectx, :listeners, :name, :feed, :gen_prov, :run_bundle])
|
1088
1170
|
|
1089
1171
|
# Working dir links
|
1090
1172
|
_get_wdir_links(links)
|