def write_hive_shell(self, sql_path, log_path): FileBase.file_exist(sql_path) Util.file_remove(log_path) exec_sql = 'touch %s' % log_path os.popen(exec_sql) sql = Template(FileRead.file_readlines(sql_path)[0]) temp_sql = sql.substitute(dtime=Util.get_yesterday()) exec_sql = "$HIVE_HOME/bin/hive -S -e '%s' > %s" % (temp_sql, log_path) os.popen(exec_sql)
def __init__(self, monitorReport): FileRead.__init__(self, monitorReport) self.monitorReport=monitorReport
def __init__(self, monitorReport): FileRead.__init__(self, monitorReport) self.monitorReport = monitorReport
def __init__(self, path, filed, contants, monitor=None, flag=False): FileRead.__init__(self, path + "/" + filed) self.data_store = [] self.monitor = monitor self.flag = flag self.columns_mapping = contants.get_value_by_key(filed)
for k in constants.myContants.keys(): myQueue.put_singal(k) myThread.sub_job_join() reportMysql.insert_mysql_duplicate(monitor) elif cmp(sys.argv[1], '-Drecovery') == 0: mydate = Util.get_yesterday() if len(sys.argv) == 3: mydate = sys.argv[2] base_log = base_log + "/" + mydate + "/" reportMysql.__setattr__("mydate", MyDate(mydate)) monitor_log = FileRead(None).map_store_recover(base_log + "checkpoint.log") reportMysql.insert_mysql_duplicate(monitor_log) reportMysql.update_report_patch() elif cmp(sys.argv[1], '-DqueryOracle') == 0: mydate = Util.get_yesterday() if len(sys.argv) == 3: mydate = sys.argv[2] reportOracle.__setattr__("mydate", MyDate(mydate)) base_log = base_log + "/" + mydate reportOracle.write_rows_file(base_log + "/OracleAd") elif cmp(sys.argv[1], '-DqueryDonate') == 0: mydate = Util.get_yesterday() if len(sys.argv) == 3:
def __init__(self,path,filed,contants,monitor = None,flag = False): FileRead.__init__(self,path+"/"+filed) self.data_store = [] self.monitor = monitor self.flag = flag self.columns_mapping =contants.get_value_by_key(filed)