public class OpenGridSession extends AbstractSession<OpenGridCluster> implements 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 Integer |
localTimeAdjustment |
private static org.slf4j.Logger |
logger |
private CmdResult<Map<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<String> |
executeOnNode(String cmd,
String node,
int timeout)
Execute a command on a node in the cluster.
|
CmdResult<Date> |
getClusterDate()
Get the current date and time of the cluster node.
|
CmdResult<String> |
getHostInfo()
Utility method for getting information about the cluster
hardware and operating system by executing the
ClusterConfig.getHostInfoCommand() . |
String |
getJobFileAsString(String jobName,
String filename,
String encoding)
Utility method for downloading a result file from a job as a text file.
|
CmdResult<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<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<List<JobStatus>> |
qsub(DbControl dc,
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 Integer localTimeAdjustment
OpenGridSession(OpenGridCluster cluster, net.schmizz.sshj.SSHClient ssh)
OpenGridCluster.connect(int)
.public CmdResult<String> executeOnNode(String cmd, String node, int timeout)
node
- The name of the node, or null to execute on the masterAbstractSession.executeCmd(String, int)
public CmdResult<Date> getClusterDate()
public CmdResult<String> getHostInfo()
ClusterConfig.getHostInfoCommand()
.public CmdResult<String> getOpenGridInfo()
ClusterConfig.getOpenGridInfoCommand()
.public int getTimeAdjustment()
public CmdResult<List<JobStatus>> qsub(DbControl dc, 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<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 String getJobFileAsString(String jobName, String filename, 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)