def prepareSubmission(BinaryPath, walltime=48): """This function will generate files usefull to launch the simulation, especially if the simulation has moved from a server to another. 'runjob' and 'simulation.sh' will be generated. 'runjob' is the file that must be executed to launch the simulation. In fact, 'runjob' will submit to the queue scheduler the script 'simulation.sh' that contains all the binaries that must be launched by the simulation. Indeed, the scripts used to launch the simulation will be adapted in function of the hostname""" command = BinaryPath+"/mercury\n" + \ BinaryPath+"/element\n" + \ "echo `date '+%d-%m-%Y at %H:%M:%S'` `pwd` ': Done'>>~/qsub.log\n" # We want to know the name of the machine, to adapt the way we will launch the simulations in function hostname = simulations_utilities.getHostname() # We define a bash script to launch the simulation in a queue if ('arguin' in hostname): script = simulations_utilities.SimpleJob(command) # For arguin simulations_utilities.writeRunjobSGE("simulation.sh") # For arguin script.write() elif ('avakas' in hostname): script = simulations_utilities.Job_PBS(command, walltime=walltime) # For avakas simulations_utilities.writeRunjobPBS("simulation.sh") # For avakas script.write() else: print("The hostname %s is not recognized by the script" % hostname) print("Unable to prepare submission. Only valid for tests.") simulations_utilities.setExecutionRight("simulation.sh")
def prepareSubmission(BinaryPath, walltime=48): """This function will generate files usefull to launch the simulation, especially if the simulation has moved from a server to another. 'runjob' and 'simulation.sh' will be generated. 'runjob' is the file that must be executed to launch the simulation. In fact, 'runjob' will submit to the queue scheduler the script 'simulation.sh' that contains all the binaries that must be launched by the simulation. Indeed, the scripts used to launch the simulation will be adapted in function of the hostname""" command = BinaryPath+"/mercury\n" + \ BinaryPath+"/element\n" + \ "echo `date '+%d-%m-%Y at %H:%M:%S'` `pwd` ': Done'>>~/qsub.log\n" # We want to know the name of the machine, to adapt the way we will launch the simulations in function hostname = simulations_utilities.getHostname() # We define a bash script to launch the simulation in a queue if ('arguin' in hostname): script = simulations_utilities.SimpleJob(command) # For arguin simulations_utilities.writeRunjobSGE("simulation.sh") # For arguin script.write() elif('avakas' in hostname): script = simulations_utilities.Job_PBS(command, walltime=walltime) # For avakas simulations_utilities.writeRunjobPBS("simulation.sh") # For avakas script.write() else: print("The hostname %s is not recognized by the script" % hostname) print("Unable to prepare submission. Only valid for tests.") simulations_utilities.setExecutionRight("simulation.sh")
def generateOutputs(): command = "rm *.aei" (stdout, stderr, returnCode) = autiwa.lancer_commande(command) # We want to know the name of the machine, to adapt the way we will launch the simulations in function hostname = simulations_utilities.getHostname() command = BINARY_FOLDER[hostname] + "/element" (stdout, stderr, returnCode) = autiwa.lancer_commande(command)
def generateOutputs(): command = "rm *.aei" (stdout, stderr, returnCode) = autiwa.lancer_commande(command) # We want to know the name of the machine, to adapt the way we will launch the simulations in function hostname = simulations_utilities.getHostname() command = BINARY_FOLDER[hostname]+"/element" (stdout, stderr, returnCode) = autiwa.lancer_commande(command)
# v1.1 # To check if there is NaN in the orbits, or if the simulation did not have time to finish itself before the allowed time by the server. import os import pdb import autiwa import sys import subprocess import simulations_utilities import mercury_utilities # Get current working directory rep_exec = os.getcwd() # Get the machine hostname hostname = simulations_utilities.getHostname() scriptFolder = os.path.dirname(os.path.realpath(__file__)) # the folder in which the module is. binaryPath = os.path.join(scriptFolder, os.path.pardir) # .-. .-. .-. .-. .-. .-. .-. .-. .-. # .' `._.' `._.' `._.' `._.' `._.' `._.' `._.' `._.' `. # ( . .-. .-. .-. .-. .-. .-. .-. . ) # `. `._.' `._.' `._.' `._.' `._.' `._.' `._.' `._.' .' # ) ) ( ( # ,' ,' `. `. # ( ( DEBUT DU PROGRAMME ) ) # `. `. .' .' # ) ) ( ( # ,' .' `. .' `. .' `. .' `. .' `. .' `. .' `. .' `. `. # ( ' _ `-' _ `-' _ `-' _ `-' _ `-' _ `-' _ `-' _ ` )