mannie-taverna-scufl 0.6.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.
@@ -0,0 +1,10 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <s:scufl xmlns:s="http://org.embl.ebi.escience/xscufl/0.1alpha" version="0.2" log="0">
3
+ <s:workflowdescription lsid="urn:lsid:net.sf.taverna:wfDefinition:6ebc9ec6-1045-459d-a26c-74e4efe2d6f8" author="" title="animal" />
4
+ <s:processor name="AnimalFactory" boring="true">
5
+ <s:stringconstant>frog</s:stringconstant>
6
+ </s:processor>
7
+ <s:link source="AnimalFactory:value" sink="animal" />
8
+ <s:sink name="animal" />
9
+ </s:scufl>
10
+
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <s:scufl xmlns:s="http://org.embl.ebi.escience/xscufl/0.1alpha" version="0.2" log="0">
3
+ <s:workflowdescription lsid="urn:lsid:net.sf.taverna:wfDefinition:a378c99c-b85e-46cd-91be-47ac93cde18c" author="" title="animal" />
4
+ <s:processor name="colour_the_animal">
5
+ <s:local>org.embl.ebi.escience.scuflworkers.java.StringConcat</s:local>
6
+ </s:processor>
7
+ <s:link source="animal" sink="colour_the_animal:string2" />
8
+ <s:link source="colour" sink="colour_the_animal:string1" />
9
+ <s:link source="colour_the_animal:output" sink="coulouredAnimal" />
10
+ <s:source name="animal" />
11
+ <s:source name="colour" />
12
+ <s:sink name="coulouredAnimal" />
13
+ </s:scufl>
14
+
data/test/tc_client.rb ADDED
@@ -0,0 +1,191 @@
1
+ $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
2
+
3
+ require 'test/unit'
4
+ require 'enactor/client'
5
+ require 'document/data'
6
+
7
+ class TcClient < Test::Unit::TestCase
8
+
9
+ FIXTURES = File.join(File.dirname(__FILE__), "fixtures")
10
+
11
+ TEST_SERVER="http://rpc269.cs.man.ac.uk:8180/remotetaverna/v1/"
12
+ TEST_USER="snake"
13
+ TEST_PW=IO.read("#{FIXTURES}/password.txt").strip
14
+
15
+ # Test workflows
16
+ ANIMAL_WF=IO.read("#{FIXTURES}/animal.xml")
17
+ COLOUR_ANIMAL_WF=IO.read("#{FIXTURES}/colouranimal.xml")
18
+
19
+ def setup
20
+ @service = Enactor::Client.new(TEST_SERVER, TEST_USER, TEST_PW)
21
+ end
22
+
23
+ def test_connect
24
+ capabilities_doc = @service.get_capabilities_doc()
25
+ #users = capabilities.elements["{http://taverna.sf.net/service}users"]
26
+ users = capabilities_doc.root.elements["users"]
27
+ users_url = users.attributes.get_attribute_ns('http://www.w3.org/1999/xlink', 'href').value
28
+ assert_equal(TEST_SERVER + "users", users_url)
29
+ end
30
+
31
+ def test_get_user_url
32
+ user_url = @service.get_user_url()
33
+ assert_equal(TEST_SERVER + "users/" + TEST_USER, user_url)
34
+ end
35
+
36
+ def test_get_user_collection_url
37
+ workflow_url = @service.get_user_collection_url("workflows")
38
+ assert_equal(TEST_SERVER + "users/" + TEST_USER + "/workflows", workflow_url)
39
+ job_url = @service.get_user_collection_url("jobs")
40
+ assert_equal(TEST_SERVER + "users/" + TEST_USER + "/jobs", job_url)
41
+ data_url = @service.get_user_collection_url("datas")
42
+ assert_equal(TEST_SERVER + "users/" + TEST_USER + "/data", data_url)
43
+ end
44
+
45
+ def test_upload_workflow
46
+ workflow_url = @service.upload_workflow(ANIMAL_WF)
47
+ prefix = TEST_SERVER + "workflows/"
48
+ assert(workflow_url.index(prefix) == 0)
49
+ end
50
+
51
+ def test_workflow_exists
52
+ workflow_url = @service.upload_workflow(ANIMAL_WF)
53
+ assert(@service.workflow_exists?(workflow_url))
54
+ assert(!@service.workflow_exists?(workflow_url.chop))
55
+ end
56
+
57
+ def test_service_valid
58
+ assert(@service.service_valid?)
59
+ assert(!Enactor::Client.new(TEST_SERVER, TEST_USER, TEST_PW.chop).service_valid?)
60
+ end
61
+
62
+ def test_create_job
63
+ workflow_url = @service.upload_workflow(ANIMAL_WF)
64
+ job_doc = @service.create_job_doc(workflow_url)
65
+ #workflow_element = job_doc.elements["{http://taverna.sf.net/service}workflow"]
66
+ workflow_element = job_doc.root.elements['workflow']
67
+ assert_equal(workflow_url, workflow_element.attributes.get_attribute_ns('http://www.w3.org/1999/xlink', 'href').value)
68
+ end
69
+
70
+ def test_submit_job
71
+ workflow_url = @service.upload_workflow(ANIMAL_WF)
72
+ job_url = @service.submit_job(workflow_url)
73
+ prefix = TEST_SERVER + "jobs/"
74
+ assert(job_url.index(prefix) == 0)
75
+ end
76
+
77
+ def test_create_data
78
+ inputs = {}
79
+ inputs['colour'] = Document::Data.new('red')
80
+ inputs['animal'] = Document::Data.new('snake')
81
+ data_document = @service.create_data_doc(inputs)
82
+ parsed = @service.parse_data_doc(data_document)
83
+ assert_equal(inputs, parsed)
84
+ end
85
+
86
+ def test_upload_data
87
+ inputs = {}
88
+ inputs["colour"] = Document::Data.new("red")
89
+ inputs["animal"] = Document::Data.new("snake")
90
+ data_url = @service.upload_data(inputs)
91
+ prefix = TEST_SERVER + "data/"
92
+ assert(data_url.index(prefix) == 0)
93
+ end
94
+
95
+ def test_submit_job_with_data
96
+ inputs = {}
97
+ inputs["colour"] = Document::Data.new("red")
98
+ inputs["animal"] = Document::Data.new("snake")
99
+ workflow_url = @service.upload_workflow(COLOUR_ANIMAL_WF)
100
+ data_url = @service.upload_data(inputs)
101
+ job_url = @service.submit_job(workflow_url, data_url)
102
+ end
103
+
104
+ def test_get_job_status
105
+ workflow_url = @service.upload_workflow(ANIMAL_WF)
106
+ job_url = @service.submit_job(workflow_url)
107
+ status = @service.get_job_status(job_url)
108
+ assert(Enactor::Status.valid?(status))
109
+ end
110
+
111
+ def test_get_job_created_date
112
+ workflow_url = @service.upload_workflow(ANIMAL_WF)
113
+ job_url = @service.submit_job(workflow_url)
114
+ time = @service.get_job_created_date(job_url)
115
+ assert(time.kind_of?(DateTime))
116
+ end
117
+
118
+ def test_get_job_modified_date
119
+ workflow_url = @service.upload_workflow(ANIMAL_WF)
120
+ job_url = @service.submit_job(workflow_url)
121
+ time = @service.get_job_modified_date(job_url)
122
+ assert(time.kind_of?(DateTime))
123
+ end
124
+
125
+ def test_finished
126
+ workflow_url = @service.upload_workflow(ANIMAL_WF)
127
+ job_url = @service.submit_job(workflow_url)
128
+ # Assuming our server is not VERY quick
129
+ assert(!@service.finished?(job_url))
130
+ end
131
+
132
+ def test_job_outputs_size
133
+ workflow_url = @service.upload_workflow(ANIMAL_WF)
134
+ job_url = @service.submit_job(workflow_url)
135
+ @service.wait_for_job(job_url, 30)
136
+ assert_equal(481, @service.get_job_outputs_size(job_url))
137
+ end
138
+
139
+ def test_wait_for_job
140
+ workflow_url = @service.upload_workflow(ANIMAL_WF)
141
+ job_url = @service.submit_job(workflow_url)
142
+ now = Time.now
143
+ timeout = 1
144
+ status = @service.wait_for_job(job_url, timeout)
145
+ after = Time.now
146
+
147
+ # Should be at least some milliseconds longer than the timeout
148
+ assert(after - now > timeout)
149
+ assert(!@service.finished?(job_url))
150
+ end
151
+
152
+ def test_execute
153
+ # Note: This test might take a minute or so to complete
154
+ results = @service.execute_sync(ANIMAL_WF)
155
+ assert_equal(1, results.length)
156
+ assert_equal("frog", results["animal"].value)
157
+ end
158
+
159
+ def test_execute_with_data
160
+ # Note: This test might take a minute or so to complete
161
+ inputs = {}
162
+ inputs["colour"] = Document::Data.new("red")
163
+ inputs["animal"] = Document::Data.new("snake")
164
+ workflow_url = @service.upload_workflow(COLOUR_ANIMAL_WF)
165
+ results = @service.execute_sync(nil, workflow_url, inputs)
166
+
167
+ assert_equal(1, results.length)
168
+ assert_equal("redsnake", results["coulouredAnimal"].value)
169
+ end
170
+
171
+ def test_execute_with_multiple_data
172
+ # Note: This test might take a minute or so to complete
173
+ inputs = {}
174
+ inputs["colour"] = Document::Data.new(["red", "green"])
175
+ inputs["animal"] = Document::Data.new(["rabbit", "mouse", "cow"])
176
+ workflow_url = @service.upload_workflow(COLOUR_ANIMAL_WF)
177
+ results = @service.execute_sync(nil, workflow_url, inputs)
178
+
179
+ assert_equal(1, results.length)
180
+ animals = results["coulouredAnimal"].value
181
+
182
+ assert_equal(2, animals.length)
183
+ animals = animals[0] + animals[1]
184
+ assert_equal(6, animals.length)
185
+
186
+ assert(animals.include?("redmouse"))
187
+ assert(animals.include?("greenrabbit"))
188
+ assert(!animals.include?("redsnake"))
189
+ end
190
+
191
+ end
@@ -0,0 +1,4 @@
1
+ $:.unshift File.join(File.dirname(__FILE__), ".")
2
+
3
+ require 'test/unit'
4
+ require 'tc_client'
metadata ADDED
@@ -0,0 +1,95 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mannie-taverna-scufl
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.6.0
5
+ platform: ruby
6
+ authors:
7
+ - David Withers
8
+ - Emmanuel Tagarira
9
+ autorequire: baclava, client, document, scufl
10
+ bindir: bin
11
+ cert_chain:
12
+ date: 2009-08-18 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rdoc
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 2.4.3
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: darkfish-rdoc
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.1.5
34
+ version:
35
+ description: This a gem developed by myGrid for the purpose of interacting with Taverna 1 workflows. An example use would be the image genaration for the model representing Taverna 1 workflows as used in myExperiment.
36
+ email: david.withers@manchester.ac.uk
37
+ executables: []
38
+
39
+ extensions: []
40
+
41
+ extra_rdoc_files:
42
+ - README
43
+ - LICENCE
44
+ files:
45
+ - test/fixtures
46
+ - test/fixtures/animal.xml
47
+ - test/fixtures/colouranimal.xml
48
+ - test/tc_client.rb
49
+ - test/ts_taverna.rb
50
+ - lib/baclava
51
+ - lib/baclava/reader.rb
52
+ - lib/baclava/writer.rb
53
+ - lib/document
54
+ - lib/document/data.rb
55
+ - lib/document/report.rb
56
+ - lib/enactor
57
+ - lib/enactor/client.rb
58
+ - lib/scufl
59
+ - lib/scufl/dot.rb
60
+ - lib/scufl/model.rb
61
+ - lib/scufl/parser.rb
62
+ - README
63
+ - LICENCE
64
+ has_rdoc: true
65
+ homepage: http://www.mygrid.org.uk/
66
+ licenses:
67
+ post_install_message:
68
+ rdoc_options:
69
+ - -N
70
+ - --tab-width=2
71
+ - --main=README
72
+ - --exclude='scufl.gemspec|test'
73
+ require_paths:
74
+ - lib
75
+ required_ruby_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: 1.0.1
80
+ version:
81
+ required_rubygems_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: "0"
86
+ version:
87
+ requirements: []
88
+
89
+ rubyforge_project:
90
+ rubygems_version: 1.3.5
91
+ signing_key:
92
+ specification_version: 1
93
+ summary: Support for interacting with the Taverna workflow system (Scufl).
94
+ test_files:
95
+ - test/ts_taverna.rb