Esempio n. 1
0
 def _downLoadTarball(self):
     tmpStorePath = '%s/cnnModel.tar.gz' % Env().getPath('TEMP_PATH')
     cnnModelPath = '%s/runs' % Env().getPath('CNN_HOME_PATH')
     rtl = self.task.db.cateCNN.searchCNNModel()
     #Here we need type tranlate, because hana return a buffer type.
     hexContext = str(rtl.getStr())
     binaryContext = hexContext.decode('hex')
     chmod = False
     if not os.path.exists(tmpStorePath):
         chmod = True
     with open(tmpStorePath, 'wb') as fd:
         fd.write(binaryContext)
     if chmod:
         basicApi.chmodFile(tmpStorePath, 0777)
     cmd = '/usr/bin/rm -rf %s' % cnnModelPath
     os.system(cmd)
     cmd = '/bin/tar zxf %s -C %s' % (tmpStorePath,
                                      Env().getPath('CNN_HOME_PATH'))
     os.system(cmd)
     pass
Esempio n. 2
0
 def updateModel(self, task):
     if Env(
     ).homeDir == '/remote/asepw_archive2/grid/autoAnalyzer/gitAutoAnalyze':
         #This is used for re-calculation
         basicApi.d_print('AseAnalysis: updateModel()')
         #Record recalculation action into db
         task.db.cateSummary.insertRecalculateLog()
         #Begin update
         self.cnn.update(task)
         self.tfidf.update(task)
     else:
         print('Re-calculate must be run under:')
         print(
             '    /remote/asepw_archive2/grid/autoAnalyzer/gitAutoAnalyze')
     pass
Esempio n. 3
0
 def sendMailSetSummary(self, tag):
     tsr = TestsetReport(self.task)
     #Search testset summary with tag
     rtl = self.task.db.cateSummary.searchTestSet(tag)
     testsetList = rtl.getUnchangable()
     #iterate each item
     for row in testsetList:
         self.task.tag = row[0]
         self.task.platform = row[1]
         self.task.branch = row[2]
         self.task.testSet = row[3]
         self.task.workDir = row[4]
         self.task.user = row[5]
         self.task.aaLogDir = '%s/autoAnalyzer' % Env().getPath('TEMP_PATH')
         if not basicApi.dirExist(self.task.aaLogDir):
             basicApi.makeDir(self.task.aaLogDir)
         tsr.execute()
     pass
Esempio n. 4
0
        sql = 'insert into %s (%s) values (%s)' % (table_name, field_name, field_value)
        #print(sql, flush=True)
        self.cursor.execute(sql)
        self.conn.commit()

    def query(self, table_name, field_dict):
        (field_name, _) = dict2Str2(field_dict)
        sql = 'select %s from %s' % (field_name, table_name)
        result = self.cursor.execute(sql)
        return result.fetchall()

    def getAllTables(self):
        sql = "select name from sqlite_master where type='table' order by name"
        result = self.cursor.execute(sql)
        return result.fetchall()


if __name__ == '__main__':
    from common.environment import Env
    env = Env()
    db = Database(env)
    sql = 'select rowid,last from eos_usdt where rowid > 30'
    result = db.execute(sql)
    data = result.fetchall()
    print(data)
    pair = data[-1]
    print(pair)
    row_id = pair[0]
    print(row_id)
    
Esempio n. 5
0
 def __init__(self):
     env = Env()
     self.gate_query = GateIO(env.config.gate.api_query_url,
                              env.config.gate.api_key,
                              env.config.gate.scret_key)
Esempio n. 6
0
 def __init__(self, db=HanaAccess, analyzers=[]):
     basicApi.d_print('AseTask: __init__()')
     super(AseTask, self).__init__(db, analyzers)
     #Just used for exactly same error message file/attach CR
     self.jnlStorePath = Env().getPath('JNL_STORE_PATH')
     pass