Exemple #1
0
        def run(self):
            j = 0
            for i in self.Seq:
                modelname = readModelnameFromParamsFile(
                    os.path.join(
                        Config().readConfigEntry('bonnmotionvalidatepath'),
                        Config().readConfigEntry(
                            'tempoutputparamsfile').replace('INDEX', str(i))))

                runBonnmotionModel(
                    Config().readConfigEntry('bonnmotionvalidatepath'), i,
                    modelname)

                movementsfilename = os.path.join(
                    Config().readConfigEntry('bonnmotionvalidatepath'),
                    Config().readConfigEntry(
                        'tempoutputmovementsfile').replace('INDEX', str(i)))
                f = gzip.open(movementsfilename, 'rb')
                movements_content = f.read()
                f.close()

                if (self.Md5[j] <> Hashes().md5(movements_content)
                        or self.Sha1[j] <> Hashes().sha1(movements_content)):
                    f2 = open(
                        os.path.join(
                            Config().readConfigEntry('bonnmotionvalidatepath'),
                            Config().readConfigEntry(
                                'tempoutputparamsfile').replace(
                                    'INDEX', str(i))), 'r')
                    self.ReturnValue.append(f2.read())
                    f2.close()

                j += 1
 def run(self):
     for i in self.Seq:
         modelname = readModelnameFromParamsFile(os.path.join(Config().readConfigEntry('bonnmotionvalidatepath'), Config().readConfigEntry('tempoutputparamsfile').replace('INDEX', str(i))))
         
         runBonnmotionModel(Config().readConfigEntry('bonnmotionvalidatepath'), i, modelname)
         
         paramsfilename = os.path.join(Config().readConfigEntry('bonnmotionvalidatepath'), Config().readConfigEntry('tempoutputparamsfile').replace('INDEX', str(i)))
         movementsfilename = os.path.join(Config().readConfigEntry('bonnmotionvalidatepath'), Config().readConfigEntry('tempoutputmovementsfile').replace('INDEX', str(i)))
         try:
             #open movements file
             f = gzip.open(movementsfilename, 'rb')
             movements_content = f.read()
             f.close()  
         except IOError as ex:
             print >> sys.stderr, ex  
             print >> sys.stderr, "that means bonnmotion has not generated any output"
             print >> sys.stderr, "parameter file:"
             fd = open(os.path.join(Config().readConfigEntry('bonnmotionvalidatepath'), Config().readConfigEntry('tempoutputparamsfile').replace('INDEX', str(i))))
             print >> sys.stderr, fd.read()
             fd.close()
             sys.exit(1);
         
         p = {}
         p['identifier'] = modelname
         #read parameters
         f2 = open(paramsfilename)
         p['bmparamsfile'] = f2.read()
         f2.close()
         #create checksum
         Hashes().calcHashes(p, movements_content)
         p['user'] = getpass.getuser()
         p['datetime'] = datetime.datetime.now().strftime("%Y-%m-%d %H:%M")
         
         #save in DB
         DataAccess().save(p) 
Exemple #3
0
        def run(self):
            for i in self.Seq:
                for case in self.Cases:
                    paramsfilename = os.path.join(
                        Config().readConfigEntry('bonnmotionvalidatepath'),
                        Config().readConfigEntry(
                            'tempoutputparamsfile').replace('INDEX', str(i)))
                    movementsfilename = os.path.join(
                        Config().readConfigEntry('bonnmotionvalidatepath'),
                        Config().readConfigEntry(
                            'tempoutputmovementsfile').replace(
                                'INDEX', str(i)))
                    outputfilename = os.path.join(
                        Config().readConfigEntry('bonnmotionvalidatepath'),
                        Config().readConfigEntry('tempoutputname') + str(i))

                    if 'appparams' in case:
                        runBonnmotionApp(
                            Config().readConfigEntry('bonnmotionvalidatepath'),
                            i, self.App, case['appparams'])
                    else:
                        runBonnmotionApp(
                            Config().readConfigEntry('bonnmotionvalidatepath'),
                            i, self.App, '')
                    ordering = []
                    content = ''
                    for ext in case['extensions']:
                        ordering.append(ext)
                        #open file
                        if ext != 'NULL':
                            f = open(outputfilename + '.' + ext)
                            content = content + f.read()
                            f.close()

                    #read parameters
                    f2 = open(paramsfilename)
                    params = f2.read()
                    f2.close()

                    p = {}
                    if 'appparams' in case:
                        p['appparameters'] = case['appparams']
                    else:
                        p['appparameters'] = ''
                    p['identifier'] = self.App
                    p['bmparamsfile'] = params
                    Hashes().calcHashes(p, content)
                    p['user'] = getpass.getuser()
                    p['datetime'] = datetime.datetime.now().strftime(
                        "%Y-%m-%d %H:%M")

                    tmp = ''
                    for y in ordering:
                        tmp = tmp + y + ','
                    p['ordering'] = tmp[0:-1]

                    #save in DB
                    DataAccess().save(p)
Exemple #4
0
        def run(self):
            j = 0
            for i in self.Seq:
                paramsfilename = os.path.join(
                    Config().readConfigEntry('bonnmotionvalidatepath'),
                    Config().readConfigEntry('tempoutputparamsfile').replace(
                        'INDEX', str(i.no)))
                movementsfilename = os.path.join(
                    Config().readConfigEntry('bonnmotionvalidatepath'),
                    Config().readConfigEntry(
                        'tempoutputmovementsfile').replace('INDEX', str(i.no)))
                outputfilename = os.path.join(
                    Config().readConfigEntry('bonnmotionvalidatepath'),
                    Config().readConfigEntry('tempoutputname') + str(i.no))

                if len(i.appparameters) > 0:
                    runBonnmotionApp(
                        Config().readConfigEntry('bonnmotionvalidatepath'),
                        i.no, i.identifier, i.appparameters)
                else:
                    runBonnmotionApp(
                        Config().readConfigEntry('bonnmotionvalidatepath'),
                        i.no, i.identifier, '')

                content = ''

                spliting = i.ordering.split(',')
                if len(spliting) > 1:  #the app creates more than 1 file
                    for ext in spliting:
                        if i.ordering != 'NULL':
                            f = open(outputfilename + '.' + ext)
                            content = content + f.read(
                            )  #concatenate content of all files created
                            f.close()
                else:  #the app creates only one file
                    if i.ordering != 'NULL':
                        f = open(outputfilename + '.' + i.ordering)
                        content = f.read()
                        f.close()

                if (i.md5 <> Hashes().md5(content)
                        or i.sha1 <> Hashes().sha1(content)):
                    f2 = open(
                        os.path.join(
                            Config().readConfigEntry('bonnmotionvalidatepath'),
                            Config().readConfigEntry(
                                'tempoutputparamsfile').replace(
                                    'INDEX', str(i.no))), 'r')
                    if i.appparameters != '':
                        self.ReturnValue.append('parameters of bonnmotion:\n' +
                                                f2.read() + '\nappname: ' +
                                                i.identifier +
                                                '\nparameters of the app:\n' +
                                                i.appparameters)
                    else:
                        self.ReturnValue.append(
                            'parameters of bonnmotion:\n' + f2.read() +
                            '\nappname: ' + i.identifier +
                            '\nparameters of the app: none\n')
                    f2.close()
                j += 1