def tests():
    print "In tests"
    VISHNU.vishnuInitialize(os.getenv("VISHNU_CONFIG_FILE"))

    session = VISHNU.Session()
    err = VISHNU.connect("root", "vishnu_user", session)

    sessionKey = session.getSessionKey()
    workId = 0

    submitRequest = WebboardData(
        sessionKey, "cluster1", '1', '1', workId,
        "/home/ubuntu/Source/ApplicationScripts/Disseq/scripts/disseq_generic.sh",
        "/home/ubuntu/Source/ApplicationScripts/Disseq/scripts/disseq.py", {
            'query_file':
            '/home/ubuntu/Source/ApplicationScripts/Disseq/examples/input1.fasta',
            'base_file':
            '/home/ubuntu/Source/ApplicationScripts/Disseq/examples/base.fas'
        }, {
            'disseq_algo': 'sw',
            'disseq_dispSeqLen': 'no',
            'disseq_printSeqID': 'no',
            'nbSequence': '1'
        })
    execute(submitRequest)
    print "out tests"
Exemple #2
0
    def test_update_machine(self):
        ma = VISHNU.Machine()
        ma.setName("bunny")
        ma.setSite("test")
        ma.setLanguage("fr")
        ma.setMachineDescription("desc")
        ma.setStatus(1)
        r = VISHNU.addMachine(self.k, ma)
# Check with bad session key : fail
        try:
            VISHNU.updateMachine(self.k+"b'ad", ma)
        except VISHNU.VishnuException, e :
            self.assertEqual(28, e.getMsgI())
Exemple #3
0
 def test_update_user(self):
     u = VISHNU.User()
     u.setFirstname("bob")
     u.setLastname("bob")
     u.setEmail("*****@*****.**")
     u.setPrivilege(0)
     r = VISHNU.addUser(self.k, u)
     self.assertEqual(0, r)
     # Check with bad session key : fail
     try:
         r = VISHNU.updateUser(self.k + "ba'd", u)
     except VISHNU.VishnuException, e:
         self.assertEqual(28, e.getMsgI())
def tests():
    print "In tests"
    VISHNU.vishnuInitialize(os.getenv("VISHNU_CONFIG_FILE"))
    
    session = VISHNU.Session()
    err = VISHNU.connect("root", "vishnu_user", session)

    sessionKey = session.getSessionKey()
    workId =0

    submitRequest = WebboardData(sessionKey,"cluster1",'1', '1',workId,"/home/ubuntu/Source/ApplicationScripts/Disseq/scripts/disseq_generic.sh","/home/ubuntu/Source/ApplicationScripts/Disseq/scripts/disseq.py",{'query_file': '/home/ubuntu/Source/ApplicationScripts/Disseq/examples/input1.fasta', 'base_file': '/home/ubuntu/Source/ApplicationScripts/Disseq/examples/base.fas' },{'disseq_algo':'sw','disseq_dispSeqLen' :'no','disseq_printSeqID' :'no','nbSequence' :'1' })
    execute(submitRequest)
    print "out tests"
Exemple #5
0
 def test_update_machine(self):
     ma = VISHNU.Machine()
     ma.setName("bunny")
     ma.setSite("test")
     ma.setLanguage("fr")
     ma.setMachineDescription("desc")
     ma.setStatus(1)
     r = VISHNU.addMachine(self.k, ma)
     # Check with bad session key : fail
     try:
         VISHNU.updateMachine(self.k + "b'ad", ma)
     except VISHNU.VishnuException, e:
         self.assertEqual(28, e.getMsgI())
Exemple #6
0
    def test_update_user(self):
        u = VISHNU.User()
        u.setFirstname("bob")
        u.setLastname("bob")
        u.setEmail("*****@*****.**")
        u.setPrivilege(0)
        r = VISHNU.addUser(self.k, u)
        self.assertEqual(0, r)
# Check with bad session key : fail
        try:
            r = VISHNU.updateUser(self.k+"ba'd", u)
        except VISHNU.VishnuException, e :
            self.assertEqual(28, e.getMsgI())
Exemple #7
0
 def test_delete_machine(self):
     ma = VISHNU.Machine()
     ma.setName("bunny")
     ma.setSite("test")
     ma.setLanguage("fr")
     ma.setMachineDescription("desc")
     ma.setStatus(1)
     r = VISHNU.addMachine(self.k, ma)
     r = VISHNU.deleteMachine(self.k, ma.getMachineId())
     r = VISHNU.addMachine(self.k, ma)
     try:
         r = VISHNU.deleteMachine(self.k+"ba'd", ma.getMachineId())
     except VISHNU.VishnuException, e:
         self.assertEqual(28, e.getMsgI())
Exemple #8
0
    def test_define_user_id(self):
# Define a format with quote
        identifier = "$NAME'voila"
        VISHNU.defineUserIdentifier(self.k,identifier)
# Create a user
        u = VISHNU.User()
        u.setFirstname("bob")
        u.setLastname("'bob")
        u.setEmail("*****@*****.**")
        u.setPrivilege(0)
        r = VISHNU.addUser(self.k, u)
        self.assertEqual(0, r)
# Delete him
        VISHNU.deleteUser(self.k, u.getUserId())
Exemple #9
0
 def test_delete_machine(self):
     ma = VISHNU.Machine()
     ma.setName("bunny")
     ma.setSite("test")
     ma.setLanguage("fr")
     ma.setMachineDescription("desc")
     ma.setStatus(1)
     r = VISHNU.addMachine(self.k, ma)
     r = VISHNU.deleteMachine(self.k, ma.getMachineId())
     r = VISHNU.addMachine(self.k, ma)
     try:
         r = VISHNU.deleteMachine(self.k + "ba'd", ma.getMachineId())
     except VISHNU.VishnuException, e:
         self.assertEqual(28, e.getMsgI())
Exemple #10
0
    def test_add_machine(self):
        ma = VISHNU.Machine()
        ma.setName("bunny")
        ma.setSite("test")
        ma.setLanguage("fr")
        ma.setMachineDescription("desc")
# Check we can add a machine 
        r = VISHNU.addMachine(self.k, ma)
        self.assertEqual(0, r)
        VISHNU.deleteMachine(self.k, ma.getMachineId())
# Check with bad session key : fail
        try:
            VISHNU.addMachine(self.k+"b'ad", ma)
        except VISHNU.VishnuException, e :
            self.assertEqual(28, e.getMsgI())
Exemple #11
0
 def test_delete_user(self):
     u = VISHNU.User()
     u.setFirstname("bob")
     u.setLastname("bob")
     u.setEmail("*****@*****.**")
     u.setPrivilege(0)
     VISHNU.addUser(self.k, u)
     VISHNU.deleteUser(self.k, u.getUserId())
     VISHNU.addUser(self.k, u)
     try:
         VISHNU.deleteUser(self.k + "ba'd", u.getUserId())
     except VISHNU.VishnuException, e:
         self.assertEqual(28, e.getMsgI())
Exemple #12
0
 def test_delete_user(self):
     u = VISHNU.User()
     u.setFirstname("bob")
     u.setLastname("bob")
     u.setEmail("*****@*****.**")
     u.setPrivilege(0)
     VISHNU.addUser(self.k, u)
     VISHNU.deleteUser(self.k, u.getUserId())
     VISHNU.addUser(self.k, u)
     try:
         VISHNU.deleteUser(self.k+"ba'd", u.getUserId())
     except VISHNU.VishnuException, e:
         self.assertEqual(28, e.getMsgI())
def tests():
    print "In tests"
    VISHNU.vishnuInitialize(os.getenv("VISHNU_CONFIG_FILE"))

    session = VISHNU.Session()
    err = VISHNU.connect("root", "vishnu_user", session)

    sessionKey = session.getSessionKey()
    workId = 0

    submitRequest = WebboardData(
        sessionKey, "cluster1", '1', '1', workId,
        "/home/ubuntu/Source/ApplicationScripts/Blastp/scripts/blastp_generic.sh",
        "/home/ubuntu/Source/ApplicationScripts/Blastp/scripts/pblastp.py", {
            'query_file':
            '/home/ubuntu/Source/ApplicationScripts/Blastp/examples/input3.fasta'
        }, {
            'blastp_used_db': 'Default',
            'blastp_evalue': '1e-5',
            'blastp_outfmt': '7',
            'nbSequence': '2'
        })
    execute(submitRequest)
    print "out tests"
Exemple #14
0
class testUMS(unittest.TestCase):
    def setUp(self):
        self.sess = VISHNU.Session()
        self.op = VISHNU.ConnectOptions()
        VISHNU.vishnuInitialize(os.getenv("VISHNU_CONFIG_FILE"))
        VISHNU.connect('root', 'vishnu_user', self.sess, self.op)
        self.k = self.sess.getSessionKey()

    def test_bad_key(self):
        try:
            VISHNU.listMachines(self.k + "b'ad")
        except VISHNU.VishnuException, e:
            self.assertEqual(28, e.getMsgI())
        try:
            VISHNU.listUsers(self.k + "b'ad")
        except VISHNU.VishnuException, e:
            self.assertEqual(28, e.getMsgI())
Exemple #15
0
 def test_define_user_id(self):
     # Define a format with quote
     identifier = "$NAME'voila"
     VISHNU.defineUserIdentifier(self.k, identifier)
     # Create a user
     u = VISHNU.User()
     u.setFirstname("bob")
     u.setLastname("'bob")
     u.setEmail("*****@*****.**")
     u.setPrivilege(0)
     r = VISHNU.addUser(self.k, u)
     self.assertEqual(0, r)
     # Delete him
     VISHNU.deleteUser(self.k, u.getUserId())
Exemple #16
0
 def test_add_machine(self):
     ma = VISHNU.Machine()
     ma.setName("bunny")
     ma.setSite("test")
     ma.setLanguage("fr")
     ma.setMachineDescription("desc")
     # Check we can add a machine
     r = VISHNU.addMachine(self.k, ma)
     self.assertEqual(0, r)
     VISHNU.deleteMachine(self.k, ma.getMachineId())
     # Check with bad session key : fail
     try:
         VISHNU.addMachine(self.k + "b'ad", ma)
     except VISHNU.VishnuException, e:
         self.assertEqual(28, e.getMsgI())
Exemple #17
0
 def test_connection_bad_name(self):
     sess = VISHNU.Session()
     k = sess.getSessionKey()
     VISHNU.vishnuInitialize(os.getenv("VISHNU_CONFIG_FILE"))
     l = ["bad", "vishnu_user", sess]
     self.assertRaises(VISHNU.VishnuException, VISHNU.connect, *l)
Exemple #18
0
 def test_connection(self):
     sess = VISHNU.Session()
     VISHNU.vishnuInitialize(os.getenv("VISHNU_CONFIG_FILE"))
     VISHNU.connect("root", "vishnu_user", sess)
     k = sess.getSessionKey()
     self.assertTrue(k != "")
def submitToVishnu(webboardDataRequest, errorHandler=None):

    myErrorHandler = errorHandler

    if (myErrorHandler == None):
        myErrorHandler = ErrorHandler()

    myErrorHandler.submitStatus = ""

    vsession = webboardDataRequest.vsession
    scriptPath = webboardDataRequest.application
    workId = webboardDataRequest.workId
    estimatedHours = webboardDataRequest.estimatedHours
    nbcpus = webboardDataRequest.nbcpus
    machineId = webboardDataRequest.machine

    specparams = webboardDataRequest.specparams
    memory = webboardDataRequest.memory

    parameters = dictToVishnu(webboardDataRequest.parameters)
    inputFiles = dictToVishnu(webboardDataRequest.files)

    criterion = VISHNU.LoadCriterion()
    vishnuOptions = VISHNU.SubmitOptions()

    vishnuOptions.setWorkId(workId)
    if (estimatedHours and estimatedHours != "0"):
        vishnuOptions.setWallTime(int(estimatedHours))
    if (nbcpus and nbcpus != "0"):
        vishnuOptions.setNbCpu(int(nbcpus))
    vishnuOptions.setTextParams(str(parameters))
    vishnuOptions.setFileParams(str(inputFiles))

    #Handling optional values

    #memory
    if (memory and memory != "0"):
        vishnuOptions.setMemory(memory)

    #specific params
    if (specparams != ""):
        vishnuOptions.setSpecificParams(str(specparams))
        print "Specific parameters : ", str(specparams)

    #end optional

    #vishnuOptions.setSelectQueueAutom(True)
    #vishnuOptions.setNbCpu(int())

    job = VISHNU.Job()
    try:

        print "vsession %s, machine %s, application %s" % (
            str(vsession), str(machineId), str(scriptPath))
        VISHNU.submitJob(str(vsession), str(machineId), str(scriptPath), job,
                         vishnuOptions)
        print "Submit Ok"
        myErrorHandler.submitStatus = "Success"
        myErrorHandler.jobid = job.getJobId()
        print job.getJobId()

    except VISHNU.SystemException as e:
        myErrorHandler.errors = myErrorHandler.errors + 1
        myErrorHandler.submitStatus = "VISHNU System exception : " + e.what()
        myErrorHandler.jobid = job.getJobId()
        print "VISHNU : ", e.what()
        print job.getJobId()

    except VISHNU.VishnuException as e:
        myErrorHandler.errors = myErrorHandler.errors + 1
        myErrorHandler.submitStatus = "VISHNU exception : " + e.what()
        myErrorHandler.jobid = job.getJobId()
        print "Vishnu Exception : ", e.what()
        print job.getJobId()

    except Exception as e:
        myErrorHandler.errors = myErrorHandler.errors + 1
        myErrorHandler.submitStatus = "Exception : " + e
        myErrorHandler.jobid = job.getJobId()
        print "Exception Bizarre ", e
        print job.getJobId()

    return job
Exemple #20
0
 def test_bad_key(self):
     try:
         VISHNU.listMachines(self.k + "b'ad")
     except VISHNU.VishnuException, e:
         self.assertEqual(28, e.getMsgI())
Exemple #21
0
def displayOut(jr):
  print "JobId: ", jr.getJobId()
  print "output: ", jr.getOutputPath()
  print "error: ", jr.getErrorPath()

def displayComp(lijr):
  for i in range(len(lijr[1])):
    displayOut(lijr[1][i])
    print " "

def displayListJ(lij):
  for i in range(len(lij[1])):
    displayJob(lij[1][i], i)
    print " "

VISHNU.vishnuInitialize(os.getenv("VISHNU_CONFIG_FILE"))

j = VISHNU.Job()
j1 = VISHNU.Job()
j2 = VISHNU.Job()
j3 = VISHNU.Job()
criterion = VISHNU.LoadCriterion()
op = VISHNU.SubmitOptions()
mid = "machine_1"
mid2 = "machine_2"
#path = "/home/traore/VishnuProject/vishnu/TMS/test/src/scripts/torque_script"
#path = "scripts/torque_script"
path = "scripts/testScriptGen"
waitingScriptPath = "scripts/testScriptGenWaiting"

#The first argument in command line corresponds to the machine id
Exemple #22
0
 def setUp(self):
     self.sess = VISHNU.Session()
     self.op = VISHNU.ConnectOptions()
     VISHNU.vishnuInitialize(os.getenv("VISHNU_CONFIG_FILE"))
     VISHNU.connect('root', 'vishnu_user', self.sess, self.op)
     self.k = self.sess.getSessionKey()
Exemple #23
0
newFileName = "FMS_test_file"
newDirName = "FMS_test_dir"
newSubDirName = "FMS_test_sub_dir"
#local paths
workingDirFullPath1 = machineId1 + sep + FMSWORKINGDIR
workingDirFullPath2 = machineId2 + sep + FMSWORKINGDIR
baseDirFullPath1 = machineId1 + sep + FMSDIR1
baseDirFullPath2 = machineId2 + sep + FMSDIR2
fileFullPath1 = baseDirFullPath1 + slash + newFileName
fileFullPath2 = baseDirFullPath2 + slash + newFileName
dirFullPath1 = baseDirFullPath1 + slash + newDirName
recursiveDirFullPath1 = dirFullPath1 + slash + newSubDirName
dirFullPath2 = baseDirFullPath2 + slash + newDirName

#Objects initialization
headOpt = VISHNU.HeadOfFileOptions()
tailOpt = VISHNU.TailOfFileOptions()
dirContent = []
dirContent2 = []
lsOpt = VISHNU.LsDirOptions()
fileInfo = VISHNU.FileStat()
dirEntryInfo = VISHNU.DirEntry()
transferOpt = VISHNU.CpFileOptions()
fileTransferInfo = VISHNU.FileTransfer()
fileTransferList = []
stopTransferOptions = VISHNU.StopTransferOptions()
lsTransferOptions = VISHNU.LsTransferOptions()
session = VISHNU.Session()
contentOfFile = ""
# preconditions
if (os.path.exists(FMSDIR1)):
Exemple #24
0
  print "Name: ", newAuthSys.getName()
  print "URI: ", newAuthSys.getURI()
  print "AuthLogin: "******"AuthPassword: "******"UserPasswordEncryption: ", newAuthSys.getUserPasswordEncryption()
  print "Type: ", newAuthSys.getType()
  print "LdapBase: ", newAuthSys.getLdapBase()
 
def displayAuthSystems(li):
  print "length li:", len(li[1])
  for i in range(len(li[1])):    
    displayAuthSys(li[1][i])
    print " "  
 
try:
  sess = VISHNU.Session()
  # Initialisation of vishnu, the parameter is the path to the configuration file (cf shell script for the content of this file)
  VISHNU.vishnuInitialize(os.getenv("VISHNU_CONFIG_FILE"))
  # Connection of the user root with the password vishnu_user, getting in return the error code r and the session key k
  VISHNU.connect("root", "vishnu_user", sess)
  k = sess.getSessionKey()
  print "Session key: ",k

  # Creation of a listsession object
  #l = VISHNU.ListSessions()

  # Calling the vishnu service listSession for the session key k, filling the list l
  res = VISHNU.listSessions(k)
  # Getting the size of the list
  #l.getSessions().size()
  # Getting the userid of the 24th session of the list
Exemple #25
0
 def setUp(self):
     self.sess = VISHNU.Session()
     self.op = VISHNU.ConnectOptions()
     VISHNU.vishnuInitialize(os.getenv("VISHNU_CONFIG_FILE"))
     VISHNU.connect('root', 'vishnu_user', self.sess, self.op)
     self.k = self.sess.getSessionKey()
Exemple #26
0
        ma.setName("bunny")
        ma.setSite("test")
        ma.setLanguage("fr")
        ma.setMachineDescription("desc")
# Check we can add a machine 
        r = VISHNU.addMachine(self.k, ma)
        self.assertEqual(0, r)
        VISHNU.deleteMachine(self.k, ma.getMachineId())
# Check with bad session key : fail
        try:
            VISHNU.addMachine(self.k+"b'ad", ma)
        except VISHNU.VishnuException, e :
            self.assertEqual(28, e.getMsgI())
# For each in param check injection
        ma.setName("bunn'y")
        r = VISHNU.addMachine(self.k, ma)
        self.assertEqual(0, r)
        VISHNU.deleteMachine(self.k, ma.getMachineId())
        ma.setSite("t'est")
        r = VISHNU.addMachine(self.k, ma)
        self.assertEqual(0, r)
        VISHNU.deleteMachine(self.k, ma.getMachineId())
        ma.setLanguage("f'r")
        r = VISHNU.addMachine(self.k, ma)
        self.assertEqual(0, r)
        VISHNU.deleteMachine(self.k, ma.getMachineId())
        ma.setMachineDescription("d'esc")
        r = VISHNU.addMachine(self.k, ma)
        self.assertEqual(0, r)

# Test inserted objects contain quotes
Exemple #27
0
 def test_connection_bad_name(self):
     sess = VISHNU.Session()
     k = sess.getSessionKey()
     VISHNU.vishnuInitialize(os.getenv("VISHNU_CONFIG_FILE"))   
     l = ["bad", "vishnu_user", sess]
     self.assertRaises(VISHNU.VishnuException, VISHNU.connect, *l)
Exemple #28
0
lsTransferOptions = VISHNU.LsTransferOptions()
session = VISHNU.Session()
contentOfFile = ""
# preconditions
if os.path.exists(FMSDIR1):
    shutil.rmtree(FMSDIR1)

if os.path.exists(FMSDIR2):
    shutil.rmtree(FMSDIR2)


os.makedirs(FMSDIR1)
os.makedirs(FMSDIR2)

vishnu_client_file_path = os.getenv("VISHNU_CONFIG_FILE")
VISHNU.vishnuInitialize(vishnu_client_file_path)

##########################################################


try:

    r = VISHNU.connect(userId, userPwd, session)
    k = session.getSessionKey()
    print "touch:", fileFullPath1
    VISHNU.touch(k, fileFullPath1)
    print "sessionKey:", k
    print "==================stat===============:"
    VISHNU.stat(k, fileFullPath1, fileInfo)
    displayFileInfo(fileInfo)
    print "rm: ", fileFullPath1
Exemple #29
0
 def test_connection(self):
     sess = VISHNU.Session()
     VISHNU.vishnuInitialize(os.getenv("VISHNU_CONFIG_FILE"))
     VISHNU.connect("root", "vishnu_user", sess)
     k = sess.getSessionKey()
     self.assertTrue(k != "")
Exemple #30
0
 def test_bad_key(self):
     try:
         VISHNU.listMachines(self.k+"b'ad")
     except VISHNU.VishnuException, e :
         self.assertEqual(28, e.getMsgI())
Exemple #31
0
  return values.get(mtype)
  
def displayMetric(lic, machineId):
  try :
    for i in range(len(lic[1])):
      print "Type: ", getMetricType(lic[1][i].getType())
      mtype = getMetricType(lic[1][i].getType())
      print "Value: ", lic[1][i].getValue()
      mvalue = lic[1][i].getValue()
      mtime = (date.fromtimestamp(lic[1][i].getTime())).strftime('%d-%b-%Y')
      print "time : ", mtime
       
  except VISHNU.VishnuException, e:
	  print e.what()

VISHNU.vishnuInitialize(os.getenv("VISHNU_CONFIG_FILE"))

mid = "machine_1"
pop = VISHNU.ProcessOp()
lip = []
lic = []
opc = VISHNU.CurMetricOp()
lih = []
oph = VISHNU.MetricHistOp()
sess = VISHNU.Session()

try :
  VISHNU.connect("root", "vishnu_user", sess)
  k = sess.getSessionKey()
  print "Session key: ",k 
  lip = VISHNU.getProcesses(k, pop)
Exemple #32
0
        ma.setName("bunny")
        ma.setSite("test")
        ma.setLanguage("fr")
        ma.setMachineDescription("desc")
        # Check we can add a machine
        r = VISHNU.addMachine(self.k, ma)
        self.assertEqual(0, r)
        VISHNU.deleteMachine(self.k, ma.getMachineId())
        # Check with bad session key : fail
        try:
            VISHNU.addMachine(self.k + "b'ad", ma)
        except VISHNU.VishnuException, e:
            self.assertEqual(28, e.getMsgI())
# For each in param check injection
        ma.setName("bunn'y")
        r = VISHNU.addMachine(self.k, ma)
        self.assertEqual(0, r)
        VISHNU.deleteMachine(self.k, ma.getMachineId())
        ma.setSite("t'est")
        r = VISHNU.addMachine(self.k, ma)
        self.assertEqual(0, r)
        VISHNU.deleteMachine(self.k, ma.getMachineId())
        ma.setLanguage("f'r")
        r = VISHNU.addMachine(self.k, ma)
        self.assertEqual(0, r)
        VISHNU.deleteMachine(self.k, ma.getMachineId())
        ma.setMachineDescription("d'esc")
        r = VISHNU.addMachine(self.k, ma)
        self.assertEqual(0, r)

        # Test inserted objects contain quotes