public class OpenGridSession extends AbstractSession<OpenGridCluster> implements java.io.Closeable
AbstractSession.close()
the session after use.
A session is not thread-safe and need external synchronization if
used with multiple threads.AbstractSession.CloseResourceOutputStream, AbstractSession.UploadSourceWrapper
Modifier and Type | Field and Description |
---|---|
private java.lang.Integer |
localTimeAdjustment |
private static org.slf4j.Logger |
logger |
private CmdResult<java.util.Map<java.lang.String,org.jdom2.Element>> |
qstatXml |
Constructor and Description |
---|
OpenGridSession(OpenGridCluster cluster,
net.schmizz.sshj.SSHClient ssh)
Session are typically created from
OpenGridCluster.connect(int) . |
Modifier and Type | Method and Description |
---|---|
CmdResult<java.lang.String> |
executeOnNode(java.lang.String cmd,
java.lang.String node,
int timeout)
Execute a command on a node in the cluster.
|
CmdResult<java.util.Date> |
getClusterDate()
Get the current date and time of the cluster node.
|
CmdResult<java.lang.String> |
getHostInfo()
Utility method for getting information about the cluster
hardware and operating system by executing the
ClusterConfig.getHostInfoCommand() . |
java.lang.String |
getJobFileAsString(java.lang.String jobName,
java.lang.String filename,
java.lang.String encoding)
Utility method for downloading a result file from a job as a text file.
|
CmdResult<java.lang.String> |
getOpenGridInfo()
Utility method for getting information about the Open
Grid Scheduler software version by executing the
ClusterConfig.getOpenGridInfoCommand() . |
int |
getTimeAdjustment()
Get the time different in seconds between the BASE server and the remote
host.
|
CmdResult<JobStatus> |
qacct(JobIdentifier jobId,
boolean useLocalTimeAdjustment)
Issue an 'qacct -j' command to find out information about
a job that has ended.
|
CmdResult<java.lang.String> |
qdel(JobIdentifier jobId)
Abort the job with the specified job id.
|
private void |
qstat()
Execute the 'qstat -xml' command, parse the XML and store it in the cache.
|
CmdResult<JobStatus> |
qstat(JobIdentifier jobId,
boolean useLocalTimeAdjustment)
Issue an 'qstat -xml' command, parse the result and return
the information as a JobStatus object.
|
CmdResult<java.util.List<JobStatus>> |
qsub(DbControl dc,
java.util.List<JobDefinition> jobs)
Submit jobs to the cluster.
|
CmdResult<JobStatus> |
readProgress(JobStatus jobStatus)
Read the 'progress' information for the job and update job status instance.
|
CmdResult<JobStatus> |
readStderr(JobStatus jobStatus)
Read the 'stderr' file and update the message in the job status instance.
|
close, downloadFile, execute, executeCmd, getHost, isClosed, mkdirs, readFile, uploadFile, writeFile
private static final org.slf4j.Logger logger
private java.lang.Integer localTimeAdjustment
private CmdResult<java.util.Map<java.lang.String,org.jdom2.Element>> qstatXml
OpenGridSession(OpenGridCluster cluster, net.schmizz.sshj.SSHClient ssh)
OpenGridCluster.connect(int)
.public CmdResult<java.lang.String> executeOnNode(java.lang.String cmd, java.lang.String node, int timeout)
node
- The name of the node, or null to execute on the masterAbstractSession.executeCmd(String, int)
public CmdResult<java.util.Date> getClusterDate()
public CmdResult<java.lang.String> getHostInfo()
ClusterConfig.getHostInfoCommand()
.public CmdResult<java.lang.String> getOpenGridInfo()
ClusterConfig.getOpenGridInfoCommand()
.public int getTimeAdjustment()
public CmdResult<java.util.List<JobStatus>> qsub(DbControl dc, java.util.List<JobDefinition> jobs)
dc
- An open DbControl connection. This is needed if any of the
job definitions are connected to a BASE job but can be null otherwisejobs
- A list with job definitions that should be submitted to the
clusterpublic CmdResult<java.lang.String> qdel(JobIdentifier jobId)
public CmdResult<JobStatus> qstat(JobIdentifier jobId, boolean useLocalTimeAdjustment)
jobId
- Identifier for the jobuseLocalTimeAdjustment
- TRUE if the times from the cluster should be adjusted
to match local time on this serverprivate void qstat()
public CmdResult<JobStatus> qacct(JobIdentifier jobId, boolean useLocalTimeAdjustment)
jobId
- Identifier for the jobuseLocalTimeAdjustment
- TRUE if the times from the cluster should be adjusted
to match local time on this serverpublic CmdResult<JobStatus> readProgress(JobStatus jobStatus)
jobStatus
- The job status instance to update with the progress
informationpublic CmdResult<JobStatus> readStderr(JobStatus jobStatus)
jobStatus
- The job status instance to update with the progress
informationpublic java.lang.String getJobFileAsString(java.lang.String jobName, java.lang.String filename, java.lang.String encoding)
jobName
- The name of the jobfilename
- The name of the fileencoding
- Encoding to use (UTF-8 is recommended, but it depends on the program the created it)