An interface for directly communicating with one or more Taverna 2 Server instances.
Create a new Server instance that represents the real server at uri. If connection_parameters are supplied they will be used to set up the network connection to the server.
It will yield itself if a block is given.
# File lib/t2-server/server.rb, line 74 def initialize(uri, params = nil) # we want to use URIs here but strings can be passed in unless uri.is_a? URI uri = URI.parse(Util.strip_path_slashes(uri)) end # strip username and password from the URI if present if uri.user != nil uri = URI::HTTP.new(uri.scheme, nil, uri.host, uri.port, nil, uri.path, nil, nil, nil); end # setup connection @connection = ConnectionFactory.connect(uri, params) # The following four fields hold cached data about the server that is # only downloaded the first time it is requested. @server_doc = nil @version = nil @version_components = nil @links = nil # initialize run object cache @runs = {} yield(self) if block_given? end
Return an instance of the Taverna Server administrator interface. This method will yield the newly created administrator if a block is given.
# File lib/t2-server/server.rb, line 116 def administrator(credentials = nil) admin = Administrator.new(self, credentials) yield(admin) if block_given? admin end
Create a run on this server using the specified workflow. This method will yield the newly created Run if a block is given.
# File lib/t2-server/server.rb, line 129 def create_run(workflow, credentials = nil) id = initialize_run(workflow, credentials) run = Run.create(self, "", credentials, id) # cache newly created run object - this must be done per user user = credentials.nil? ? :all : credentials.username @runs[user] = {} unless @runs[user] @runs[user][id] = run yield(run) if block_given? run end
Delete all runs on this server, discarding all of their state. Note that only those runs that the provided credentials have permission to delete will be deleted.
# File lib/t2-server/server.rb, line 242 def delete_all_runs(credentials = nil) # first refresh run list runs(credentials).each {|run| run.delete} end
Create a run on this server using the specified workflow but do not return it as a Run instance. Return its identifier instead.
# File lib/t2-server/server.rb, line 147 def initialize_run(workflow, credentials = nil) # set up the run object cache - this must be done per user user = credentials.nil? ? :all : credentials.username @runs[user] = {} unless @runs[user] @connection.POST(links[:runs], workflow, "application/vnd.taverna.t2flow+xml", credentials) end
Return the specified run.
# File lib/t2-server/server.rb, line 212 def run(identifier, credentials = nil) get_runs(credentials)[identifier] end
The maximum number of runs that this server will allow at any one time.
Runs in any state (Initialized
, Running
and
Finished
) are counted against this maximum.
# File lib/t2-server/server.rb, line 196 def run_limit(credentials = nil) read(links[:runlimit], "text/plain", credentials).to_i end
Return the set of runs on this server.
# File lib/t2-server/server.rb, line 204 def runs(credentials = nil) get_runs(credentials).values end
The URI of the connection to the remote Taverna Server.
# File lib/t2-server/server.rb, line 186 def uri @connection.uri end
The version string of the remote Taverna Server.
# File lib/t2-server/server.rb, line 160 def version if @version.nil? @version = _get_version end @version end
An array of the major, minor and patch version components of the remote Taverna Server.
# File lib/t2-server/server.rb, line 173 def version_components if @version_components.nil? comps = version.split(".") @version_components = comps.map { |v| v.to_i } end @version_components end