Package net.sf.basedb.opengrid
Class OpenGridCluster
Represents a single Open Grid Scheduler cluster
together with login information for accessing it
via SSH. Use the
connect(int)
method to create
a session for interacting with the cluster. This class
is thread-safe, but the OpenGridSession
need
synchronization if used with multiple threads.
Typically, instances of this class are created and managed
by the OpenGridService
. It is possible to create ad-hoc,
unmanaged instances, but this is not recommended.- Since:
- 1.0
- Author:
- nicklas
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Holds information about the Open Grid cluster together with a timestamp for caching purposes. -
Field Summary
Modifier and TypeFieldDescriptionprivate final ClusterConfig
private final String
private OpenGridCluster.Info
-
Constructor Summary
ConstructorDescriptionOpenGridCluster
(ConnectionInfo ci, ClusterConfig config) Creates a new Open Grid Cluster instance. -
Method Summary
Modifier and TypeMethodDescriptionorg.json.simple.JSONObject
asJSONObject
(JSONOptions options) Get the configuration information for this cluster as a JSON object.connect
(int timeout) Connect to the cluster.Get information about the Open Grid cluster.Get configuration settings for this cluster.getId()
Get the ID of this cluster.getTmpFolder
(String jobName, boolean debug) Get the tmp folder for a job with the given name.getWorkFolder
(String jobName) Get the work folder for a job with the given name.toString()
Methods inherited from class net.sf.basedb.opengrid.AbstractHost
getConnectionInfo, internalConnect
-
Field Details
-
id
-
config
-
info
-
-
Constructor Details
-
OpenGridCluster
Creates a new Open Grid Cluster instance. Note that the configurations will be locked as a result of calling this method.- Parameters:
ci
- Connection information to access the clusterconfig
- Other configuration settings
-
-
Method Details
-
toString
- Overrides:
toString
in classAbstractHost<OpenGridSession>
-
getId
Get the ID of this cluster. The ID is composed of the username, address and port from the connection information. The ID need to be unique among registered clusters. -
getConfig
Get configuration settings for this cluster. -
getWorkFolder
Get the work folder for a job with the given name. -
getTmpFolder
Get the tmp folder for a job with the given name. -
getClusterInfo
Get information about the Open Grid cluster. This is a shortcut for connecting to the cluster and exucuting a few commands on it:OpenGridSession.getHostInfo()
,OpenGridSession.getOpenGridInfo()
andOpenGridSession.getTimeAdjustment()
. In addition, the information is cached for up to 1 hour. -
connect
Connect to the cluster. The returned session can be used to send commands or transfer files to/from the cluster. Do not forget toAbstractSession.close()
the session after use.- Specified by:
connect
in classAbstractHost<OpenGridSession>
- Parameters:
timeout
- Timeout in seconds for the connection to be established
-
asJSONObject
Get the configuration information for this cluster as a JSON object. The following attributes are set: id:getId()
config:getConfig()
.ClusterConfig.asJSONObject(JSONOptions)
connection:AbstractHost.getConnectionInfo()
.ConnectionInfo.asJSONObject(JSONOptions)
Note that a new JSON object is created each time this method is called. Clients should cache this information if they need to re-used it. More information about the cluster is also available by callinggetClusterInfo()
.
-