|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfr.ifremer.isisfish.simulator.launcher.SSHSimulatorLauncher
public class SSHSimulatorLauncher
Use a remote simulation server. Upload zip simulation file on server and launch simulation on that file. Isis-Fish must be installed on remote server. Caparmor file layout ($i = plan/as increment) :
$shortid is id of parent job (without increment), they are not
deleted after result download.
JSch| Nested Class Summary | |
|---|---|
protected static class |
SSHSimulatorLauncher.ControlProgressMonitor
Redefine a custom progress monitor that update control. |
| Field Summary | |
|---|---|
protected freemarker.template.Configuration |
freemarkerConfiguration
Freemarker configuration |
protected static org.apache.commons.logging.Log |
log
Class logger |
protected static String |
QSUB_SCRIPT_TEMPLATE
Freemarker qsub template. |
protected static com.jcraft.jsch.Session |
sshSession
Opened session to ssh service. |
protected static com.jcraft.jsch.Session |
sshSftpSession
Opened session to sftp service. |
| Constructor Summary | |
|---|---|
SSHSimulatorLauncher()
Constructor. |
|
| Method Summary | |
|---|---|
protected void |
clearSimulationFiles(com.jcraft.jsch.Session session,
SimulationControl control)
Remove all $ISIS-TMP/simulation-$id-* files on caparmor. |
protected void |
closeSSHSession(com.jcraft.jsch.Session session)
Close ssh session. |
protected File |
downloadResultsArchive(com.jcraft.jsch.Session session,
SimulationControl simulationControl,
String md5sum)
Download simulation zip results. |
protected File |
downloadResultsMD5File(com.jcraft.jsch.Session sshSession,
String simulationId)
Download remote simulation md5 control file and store its content into temp file. |
protected File |
downloadSimulationFile(com.jcraft.jsch.Session sshSession,
String simulationId,
String fileName)
Download remote simulation control file and store its content into temp file. |
int |
getCheckProgressionInterval()
Retourne l'intervalle de temps a utiliser entre deux verification de progresssion. |
protected File |
getLaunchSimulationScriptFile(String simuationId,
String simulationZip,
boolean standaloneZip,
String simulationResultZip,
String preScriptPath,
boolean multipleSimulationScript)
Retourne un fichier temporaire contenant le script de lancement de simulation. |
protected String |
getRemoteResultArchivePath(String simulationId)
Get remote simulation zip path. |
protected String |
getRemoteTempDirectory()
Get remote directory absolute path. |
protected String |
getSimulationScriptLaunchContent(String templateName,
String simuationId,
String simulationZip,
boolean standaloneZip,
String simulationZipResult,
String preScriptPath,
boolean multipleSimulationScript)
Utilise freemarker pour recuperer le contenu du script. |
SimulationStorage |
getSimulationStorage(SimulationService simulationService,
SimulationControl control)
Retourne le storage où est stockée la simulation. |
protected com.jcraft.jsch.Session |
getSSHSession()
Get opened ssh session or try to open a new one. |
protected void |
initFreemarker()
Init freemarker configuration. |
int |
maxSimulationThread()
Retourne le nombre maximal de thread de simulations simultanées supporté. |
protected void |
message(SimulationControl control,
String message)
Display message both in commons-logging and control text progress. |
protected com.jcraft.jsch.Session |
openSSHSession()
Connect to remote server throw SSH, and return session. |
protected void |
putSshKeyOnRemoteServer(com.jcraft.jsch.Session session,
File sshKey)
Add ssh key into $HOME/.ssh/authorized_keys file. |
protected void |
sendStartSimulationRequest(com.jcraft.jsch.Session session,
String simulationId,
String scriptRemotePath,
int lastSimulationNumber)
Add script in remote qsub queue. |
protected void |
sendStopSimulationRequest(com.jcraft.jsch.Session session,
String simulationId)
Send qdel request on job. |
void |
simulate(SimulationService simulationService,
SimulationItem simulationItem)
Execute une simulation. |
void |
simulationStopRequest(SimulationJob job)
Called if a started simulation has been ask to stop. |
protected void |
startSimulation(SimulationItem simulationItem,
String simulationid,
String simulationRemoteZipPath,
String remoteResultZip,
String simulationPreScriptPath)
Start simulation if necessary. |
String |
toString()
|
void |
updateControl(SimulationService simulationService,
SimulationControl control)
Met à jour la progression. |
protected String |
uploadPreScriptIfNecessary(com.jcraft.jsch.Session session,
String simulationId,
String simulationPreScript)
Upload pre script on remote server. |
protected void |
uploadSimulation(com.jcraft.jsch.Session session,
String remoteDirectory,
String remoteSimulationZipPath,
File simulationFile)
Perform simulation upload. |
protected String |
uploadSimulationIfNecessary(com.jcraft.jsch.Session session,
SimulationItem simulationItem,
String simulationid,
File simulationFile)
Upload simulation if necessary and always return the remote simulation zip path to use. |
protected String |
uploadSimulationScript(com.jcraft.jsch.Session session,
String simulationid,
File simulationScript)
Upload script on remote server. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static org.apache.commons.logging.Log log
protected freemarker.template.Configuration freemarkerConfiguration
protected static final String QSUB_SCRIPT_TEMPLATE
protected static com.jcraft.jsch.Session sshSession
protected static com.jcraft.jsch.Session sshSftpSession
| Constructor Detail |
|---|
public SSHSimulatorLauncher()
| Method Detail |
|---|
protected void initFreemarker()
protected void message(SimulationControl control,
String message)
control - controlmessage - message to displaypublic int maxSimulationThread()
SimulatorLauncher
maxSimulationThread in interface SimulatorLauncherpublic int getCheckProgressionInterval()
SimulatorLauncher
getCheckProgressionInterval in interface SimulatorLauncherpublic String toString()
toString in class Object
public void simulationStopRequest(SimulationJob job)
throws RemoteException
simulationStopRequest in interface SimulatorLauncherjob - job to stop
RemoteException - Si pour l'execution de la simulation
on utilise des resources distantes (serveurs) et que ceux si non pas pu
etre contacte.
public void simulate(SimulationService simulationService,
SimulationItem simulationItem)
throws RemoteException
simulate in interface SimulatorLaunchersimulationService - le SimulationService qui a initie
la simulationsimulationItem - l'item contenant toutes les infos nécessaire au
lancement de la simulation
IMPORTANT Quoi qu'il arrive
RemoteException - Si pour l'execution de la simulation
on utilise des resources distantes (serveurs) et que ceux si non pas pu
etre contacte. Dans ce cas la simulation n'a pas ete faite et cette
exception est levee.
public SimulationStorage getSimulationStorage(SimulationService simulationService,
SimulationControl control)
throws RemoteException
updateControl(SimulationService, SimulationControl) before calling
this method.
getSimulationStorage in interface SimulatorLaunchersimulationService - le SimulationService qui a initie
la simulationcontrol - le control de la simulation
RemoteException - Si pour l'execution de la simulation
on utilise des resources distantes (serveurs) et que ceux si non pas pu
etre contacte.
public void updateControl(SimulationService simulationService,
SimulationControl control)
throws RemoteException
SimulationControl.
Essaye aussi de telecharger le fichier md5 de la simulation, et, s'il
est present, l'archive de résultat.
Supprime tous les fichiers de la simulations apres avoir télécharger les
résultats.
updateControl in interface SimulatorLaunchersimulationService - le SimulationService qui a initie
la simulationcontrol - le control de la simulation
RemoteException - Si pour l'execution de la simulation
on utilise des resources distantes (serveurs) et que ceux si non pas pu
etre contacte.
protected com.jcraft.jsch.Session getSSHSession()
throws com.jcraft.jsch.JSchException
com.jcraft.jsch.JSchException
protected com.jcraft.jsch.Session openSSHSession()
throws com.jcraft.jsch.JSchException
com.jcraft.jsch.JSchExceptionprotected void closeSSHSession(com.jcraft.jsch.Session session)
session - session to close
protected void putSshKeyOnRemoteServer(com.jcraft.jsch.Session session,
File sshKey)
throws com.jcraft.jsch.JSchException
session - opened sessionsshKey -
com.jcraft.jsch.JSchException
protected String uploadSimulationIfNecessary(com.jcraft.jsch.Session session,
SimulationItem simulationItem,
String simulationid,
File simulationFile)
throws SSHException
session - already open valid ssh sessionsimulationItem - simulation itemsimulationid - simulation idsimulationFile - simulation file to upload
SSHException - if upload fail
protected void uploadSimulation(com.jcraft.jsch.Session session,
String remoteDirectory,
String remoteSimulationZipPath,
File simulationFile)
throws SSHException
session - already open valid ssh sessionremoteDirectory - remoteSimulationZipPath -
SSHException
protected File downloadResultsArchive(com.jcraft.jsch.Session session,
SimulationControl simulationControl,
String md5sum)
throws SSHException,
IOException
SSHException - if download fail (can happen if remote file doesn't exist
IOException - if download fail (can happen if remote file doesn't exist
protected File downloadSimulationFile(com.jcraft.jsch.Session sshSession,
String simulationId,
String fileName)
throws IOException,
SSHException
sshSession - valid opened ssh sessionsimulationId - id de la simulationfileName - nom du fichier a telecharger
IOException
SSHException - if remote file doesn't exists
protected File downloadResultsMD5File(com.jcraft.jsch.Session sshSession,
String simulationId)
throws IOException,
SSHException
sshSession - valid opened ssh sessionsimulationId - id de la simulation
IOException
SSHException - if remote file doesn't exists
protected void clearSimulationFiles(com.jcraft.jsch.Session session,
SimulationControl control)
throws IOException,
SSHException
$ISIS-TMP/simulation-$id-* files on caparmor.
session - valid opened ssh sessioncontrol - simulation control
IOException
SSHException
protected String uploadSimulationScript(com.jcraft.jsch.Session session,
String simulationid,
File simulationScript)
throws SSHException
session - valid opened ssh sessionsimulationScript - file to upload
SSHException - if upload failprotected String getRemoteResultArchivePath(String simulationId)
simulationId - simulation id
protected String uploadPreScriptIfNecessary(com.jcraft.jsch.Session session,
String simulationId,
String simulationPreScript)
throws SSHException,
IOException
session - valid opened ssh sessionsimulationId - simulation idsimulationPreScript - script content
SSHException - if upload fail
IOException - if upload fail
protected void startSimulation(SimulationItem simulationItem,
String simulationid,
String simulationRemoteZipPath,
String remoteResultZip,
String simulationPreScriptPath)
throws Exception
simulationItem - simulation item (needed for additionnal info, simulation, number, indenpendant, etc...)simulationid - simulation idsimulationRemoteZipPath - simulation preparation (input) zip pathremoteResultZip - simulation result (output) zip pathsimulationPreScriptPath - simulation prescript
Exception
protected File getLaunchSimulationScriptFile(String simuationId,
String simulationZip,
boolean standaloneZip,
String simulationResultZip,
String preScriptPath,
boolean multipleSimulationScript)
throws IOException
simuationId - id de la simulationsimulationZip - zip de la simulationstandaloneZip - standalone simulation zippreScriptPath - simulation pre script path (can be null)multipleSimulationScript - if true build a multijob simulation script
null en cas d'exception
IOException - if can't build script
protected String getSimulationScriptLaunchContent(String templateName,
String simuationId,
String simulationZip,
boolean standaloneZip,
String simulationZipResult,
String preScriptPath,
boolean multipleSimulationScript)
throws IOException
templateName - url du templatesimuationId - id de la simulationsimulationZip - zip de la simulationstandaloneZip - standalone simulation zipsimulationZipResult - zip resultat de la simulationpreScriptPath - simulation pre script path (can be null)multipleSimulationScript - if true build a multijob simulation script
IOException - if can't get script content
protected void sendStartSimulationRequest(com.jcraft.jsch.Session session,
String simulationId,
String scriptRemotePath,
int lastSimulationNumber)
throws SSHException
session - valid opened sessionsimulationId - simulation id (short version for a multiple job)scriptRemotePath - remote script pathlastSimulationNumber - if >=0 start a multiple pbs job form 0 to lastSimulationNumber
SSHException - if call fail
protected void sendStopSimulationRequest(com.jcraft.jsch.Session session,
String simulationId)
throws SSHException
session - valid opened sessionsimulationId - simulation id
SSHException - if call failprotected String getRemoteTempDirectory()
File.separator here, caparmor is always unix.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||