class T2Server::Server
An interface for directly communicating with one or more Taverna 2 Server instances.
Public Class Methods
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 76 def initialize(uri, params = nil) # Convert strings to URIs and strip any credentials that have been given # in the URI. We do not want to store credentials in this class. uri, creds = Util.strip_uri_credentials(uri) # 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 the run object cache. @run_cache = RunCache.new(self) yield(self) if block_given? end
Public Instance Methods
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 103 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.
The workflow parameter may be the workflow itself, a file name or a File or IO object.
# File lib/t2-server/server.rb, line 119 def create_run(workflow, credentials = nil) uri = initialize_run(workflow, credentials) run = Run.create(self, "", credentials, uri) # Add the newly created run object to the user's run cache @run_cache.add_run(run, credentials) 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 218 def delete_all_runs(credentials = nil) # Refresh run list, delete everything, clear the user's run cache. runs(credentials).each {|run| run.delete} @run_cache.clear!(credentials) end
Return the specified run.
# File lib/t2-server/server.rb, line 208 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 192 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 200 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 182 def uri @connection.uri end
An object representing the version of the remote Taverna Server.
# File lib/t2-server/server.rb, line 164 def version @version ||= _get_version end