Example #1
0
def jobs(index = None):
    """ See the status of the jobs or return the job on index """
    jbs = Jobs()
    if index is None:
        jbs.getStatuses()
        print jbs
    else:
        return jbs.getJob(index)
Example #2
0
        def sshsubmit(self):
            from abstract import Jobs
            #TODO:Check job before submitting and messages after for err. or warn.
            ex = self.__executor
            fl = self.__filer
            self.checkjob()     # check job's attributes
            # create the command string
            command = self.prepare_command("~/.tempjob/.autogenerated.jdl")

            jdlpath = os.path.gethome() + os.path.sep + ".autogenerated.jdl"
            self.create_zipped_job()
            ex.exec("mkdir -p ~/.tempjob")
            ex.close()
            fl.upload(os.path.gethome() + os.path.sep + ".job.zip",ex.getEnv("HOME")+"/.tempjob")
            ex.exec("unzip -u ~/.tempjob/.job.zip -d ~/.tempjob")
            inp = ex.input()
            ex.close()

            jdl = self.create_description_string()  # create the jdl string
            f = open(jdlpath, 'w')
            f.write(jdl)
            f.close()
            fl.upload(jdlpath, ex.getEnv("HOME")+"/.tempjob")
            print "Submitting job ..."
            ex.exec(command)
            infostring = ex.input()
            #print infostring
            ex.close()
            os.remove(jdlpath)
            ex.exec("rm -R .tempjob")
            ex.input()
            ex.close()
            pattern = re.compile('(https://.*$)', re.MULTILINE)
            match = pattern.search(infostring)
            self.__id = match.group()
            if self.name == '':
                self.name = "Job-"+os.path.basename(self.__id)
            jbs = Jobs()
            jbs.addJob(self)
            zf = zipfile.ZipFile(os.path.gethome() + os.path.sep + ".job.zip")
            zf.close()
            os.remove(os.path.gethome() + os.path.sep + ".job.zip")
Example #3
0
 def uisubmit(self):
     from abstract import Jobs
     self.checkjob()     # check job's attributes
     command = self.prepare_command(".autogenerated_jdl")    # create the command string
     ex = self.__executor
     jdl = self.create_description_string()  # create the jdl string
     f = open(".autogenerated.jdl", 'w')
     f.write(jdl)
     f.close()
     print "Submitting job ..."
     ex.exec(command)
     infostring = ex.input()
     ex.close()
     os.remove('.autogenerated.jdl')
     pattern = re.compile('(https://.*$)', re.MULTILINE)
     match = pattern.search(infostring)
     self.__id = match.group()
     if self.name == '':
         self.name = "Job-"+os.path.basename(self.__id)
     jbs = Jobs()
     jbs.addJob(self)