def execution_data_task_id(ds,**kargs): hive_hook = HiveCliHook() TaskTouchzSuccess().del_path(ds,db_name,table_name,hdfs_path,"true","true") #读取sql _sql=dim_oride_city_sql_task(ds) logging.info('Executing: %s', _sql) #执行Hive hive_hook.run_cli(_sql) #熔断数据,如果数据不能为0 check_key_data_cnt_task(ds) #熔断数据 check_key_data_task(ds) #生成_SUCCESS """ 第一个参数true: 数据目录是有country_code分区。false 没有 第二个参数true: 数据有才生成_SUCCESS false 数据没有也生成_SUCCESS """ TaskTouchzSuccess().countries_touchz_success(ds,db_name,table_name,hdfs_path,"true","true")
def execution_data_task_id(ds, **kwargs): v_date = kwargs.get('v_execution_date') v_day = kwargs.get('v_execution_day') v_hour = kwargs.get('v_execution_hour') hive_hook = HiveCliHook() # 读取sql _sql = dwd_oride_driver_cheating_detection_hi_sql_task(ds, v_hour) logging.info('Executing: %s', _sql) # 执行Hive hive_hook.run_cli(_sql) # 熔断数据 # check_key_data_task(ds) # 生成_SUCCESS """ 第一个参数true: 数据目录是有country_code分区。false 没有 第二个参数true: 数据有才生成_SUCCESS false 数据没有也生成_SUCCESS """ TaskTouchzSuccess().countries_touchz_success(ds, db_name, table_name, hdfs_path, "true", "false", v_hour)
def add_partition(v_execution_date, v_execution_day, v_execution_hour, target_table_db_name, target_table_name, conn_id, hive_table_name, server_name, hive_db, is_must_have_data, **kwargs): # 生成_SUCCESS """ 第一个参数true: 数据目录是有country_code分区。false 没有 第二个参数true: 数据有才生成_SUCCESS false 数据没有也生成_SUCCESS """ TaskTouchzSuccess().countries_touchz_success( v_execution_day, hive_db, hive_table_name, OSS_PATH % ("{server_name}.{db_name}.{table_name}".format( server_name=server_name, db_name=target_table_db_name, table_name=target_table_name)), "false", is_must_have_data, v_execution_hour) sql = ''' ALTER TABLE {hive_db}.{table} ADD IF NOT EXISTS PARTITION (dt = '{ds}', hour = '{hour}') '''.format(hive_db=hive_db, table=hive_table_name, ds=v_execution_day, hour=v_execution_hour) hive2_conn = HiveServer2Hook().get_conn() cursor = hive2_conn.cursor() cursor.execute(sql) return
def merge_pre_hi_data_task(hive_db, hive_all_hi_table_name, hive_hi_table_name, is_must_have_data, pt, now_hour, pre_hour_day, pre_hour, **kwargs): sqoopSchema = SqoopSchemaUpdate() hive_columns = sqoopSchema.get_hive_column_name(hive_db, hive_all_hi_table_name) hql = ADD_HI_SQL.format(db_name=hive_db, hive_all_hi_table_name=hive_all_hi_table_name, hive_hi_table_name=hive_hi_table_name, pt=pt, now_hour=now_hour, pre_hour_day=pre_hour_day, pre_hour=pre_hour, columns=',\n'.join(hive_columns)) hive_hook = HiveCliHook() # 读取sql logging.info('Executing: %s', hql) # 执行Hive hive_hook.run_cli(hql) # 生成_SUCCESS """ 第一个参数true: 数据目录是有country_code分区。false 没有 第二个参数true: 数据有才生成_SUCCESS false 数据没有也生成_SUCCESS """ TaskTouchzSuccess().countries_touchz_success( pt, hive_db, hive_all_hi_table_name, ALL_HI_OSS_PATH % hive_all_hi_table_name, "false", is_must_have_data, now_hour)
def check_success(ds, dag, **op_kwargs): dag_ids = dag.dag_id msg = [ {"table": "{dag_name}".format(dag_name=dag_ids), "hdfs_path": "{hdfsPath}/country_code=nal/dt={pt}".format(pt=ds, hdfsPath=hdfs_path)} ] TaskTouchzSuccess().set_touchz_success(msg)
def execution_data_task_id(ds,**kargs): #生成_SUCCESS """ 第一个参数true: 数据目录是有country_code分区。false 没有 第二个参数true: 数据有才生成_SUCCESS false 数据没有也生成_SUCCESS """ TaskTouchzSuccess().countries_touchz_success(ds,db_name,table_name,hdfs_path,"false","true")
def merge_pre_hi_with_full_data_task(hive_db, hive_h_his_table_name, hive_hi_table_name, mysql_db_name, mysql_table_name, mysql_conn, sqoop_temp_db_name, sqoop_table_name, pt, now_hour, pre_day, pre_hour_day, pre_hour, is_must_have_data, **kwargs): sqoopSchema = SqoopSchemaUpdate() hive_columns = sqoopSchema.get_hive_column_name(hive_db, hive_h_his_table_name) mysql_columns = sqoopSchema.get_mysql_column_name(mysql_db_name, mysql_table_name, mysql_conn) pre_day_ms = int(time.mktime(time.strptime(pre_day, "%Y-%m-%d"))) * 1000 hql = MERGE_HI_WITH_FULL_SQL.format( columns=',\n'.join(hive_columns), pt=pt, now_hour=now_hour, db_name=hive_db, mysql_db_name=mysql_db_name, hive_h_his_table_name=hive_h_his_table_name, hive_hi_table_name=hive_hi_table_name, mysql_table_name=mysql_table_name, pre_day_ms=pre_day_ms, mysql_columns=',\n'.join(mysql_columns), sqoop_temp_db_name=sqoop_temp_db_name, sqoop_table_name=sqoop_table_name) hive_hook = HiveCliHook() # 读取sql logging.info('Executing: %s', hql) # 执行Hive hive_hook.run_cli(hql) # 生成_SUCCESS """ 第一个参数true: 数据目录是有country_code分区。false 没有 第二个参数true: 数据有才生成_SUCCESS false 数据没有也生成_SUCCESS """ TaskTouchzSuccess().countries_touchz_success( pt, hive_db, hive_h_his_table_name, H_HIS_OSS_PATH % hive_h_his_table_name, "false", is_must_have_data, now_hour)
def execution_data_task_id(ds, **kargs): hive_hook = HiveCliHook() # 读取sql _sql = ods_sqoop_base_bd_agent_df_sql_task(ds) logging.info('Executing: %s', _sql) # 执行Hive hive_hook.run_cli(_sql) # 生成_SUCCESS """ 第一个参数true: 数据目录是有country_code分区。false 没有 第二个参数true: 数据有才生成_SUCCESS false 数据没有也生成_SUCCESS """ TaskTouchzSuccess().countries_touchz_success(ds, db_name, table_name, hdfs_path, "false", "true")
def execution_data_task_id(ds, ds_nodash, **kargs): hive_hook = HiveCliHook() # 读取sql _sql = app_opay_active_user_report_w_sql_task(ds,ds_nodash) logging.info('Executing: %s', _sql) # 执行Hive hive_hook.run_cli(_sql) # 生成_SUCCESS """ 第一个参数true: 数据目录是有country_code分区。false 没有 第二个参数true: 数据有才生成_SUCCESS false 数据没有也生成_SUCCESS """ TaskTouchzSuccess().countries_touchz_success(ds, db_name, table_name, hdfs_path, "true", "true")
def execution_act_driver_task(ds, **kargs): hive_hook = HiveCliHook() # 读取sql _sql = app_oride_act_driver_cohort_w_sql_task(ds) # 执行hive hive_hook.run_cli(_sql) # 生成_SUCCESS """ 第一个参数true: 数据目录是有country_code分区。false 没有 第二个参数true: 数据有才生成_SUCCESS false 数据没有也生成_SUCCESS """ pt = airflow.macros.ds_add(ds, +6) hdfs_path = get_table_info(3)[1] TaskTouchzSuccess().countries_touchz_success(pt, "oride_dw", get_table_info(3)[0], hdfs_path, "true", "true")
def execution_data_task_id(ds, **kargs): hive_hook = HiveCliHook() # 读取sql _sql = dwm_oride_driver_act_w_sql_task(ds) logging.info('Executing: %s', _sql) # 执行Hive hive_hook.run_cli(_sql) # 生成_SUCCESS """ 第一个参数true: 数据目录是有country_code分区。false 没有 第二个参数true: 数据有才生成_SUCCESS false 数据没有也生成_SUCCESS """ TaskTouchzSuccess().countries_touchz_success('{pt}'.format(pt=airflow.macros.ds_add(ds, +6)), db_name, table_name, hdfs_path, "true", "true")
def execution_data_task_id(ds,**kargs): hive_hook = HiveCliHook() # 读取sql _sql = dim_oride_passenger_whitelist_base_sql_task(ds) # 执行Hive hive_hook.run_cli(_sql) # 熔断数据 check_key_data_task(ds) # 生成_SUCCESS """ 第一个参数true: 数据目录是有country_code分区。false 没有 第二个参数true: 数据有才生成_SUCCESS false 数据没有也生成_SUCCESS """ TaskTouchzSuccess().countries_touchz_success(ds, db_name, table_name, hdfs_path, "true", "true")
def execution_data_task_id(ds, **kargs): hive_hook = HiveCliHook() # 读取sql _sql = dwd_opay_topup_with_card_record_di_sql_task(ds) logging.info('Executing: %s', _sql) # 执行Hive hive_hook.run_cli(_sql) # 生成_SUCCESS """ 第一个参数true: 数据目录是有country_code分区。false 没有 第二个参数true: 数据有才生成_SUCCESS false 数据没有也生成_SUCCESS """ TaskTouchzSuccess().countries_touchz_success(ds, db_name, table_name, hdfs_path, "true", "true")
def execution_new_driver_task(ds, **kargs): hive_hook = HiveCliHook() # 读取sql _sql = app_oride_new_driver_cohort_m_sql_task(ds) # 执行hive hive_hook.run_cli(_sql) # 生成_SUCCESS """ 第一个参数true: 数据目录是有country_code分区。false 没有 第二个参数true: 数据有才生成_SUCCESS false 数据没有也生成_SUCCESS """ hdfs_path = get_table_info(1)[1] TaskTouchzSuccess().countries_touchz_success(ds, "oride_dw", get_table_info(1)[0], hdfs_path, "true", "true")
def execution_data_task_id(ds, **kargs): hive_hook = HiveCliHook() # 读取sql _sql = app_opay_owealth_report_d_19_sql_task(ds) logging.info('Executing: %s', _sql) # 执行Hive hive_hook.run_cli(_sql) # 生成_SUCCESS """ 第一个参数true: 数据目录是有country_code分区。false 没有 第二个参数true: 数据有才生成_SUCCESS false 数据没有也生成_SUCCESS """ TaskTouchzSuccess().countries_touchz_success(airflow.macros.ds_add(ds, +1), db_name, table_name, hdfs_path, "true", "true")
def execution_data_task_id(ds, **kargs): hive_hook = HiveCliHook() # 读取sql _sql = app_oride_driver_transport_capacity_d_sql_task(ds) logging.info('Executing: %s', _sql) # 执行Hive hive_hook.run_cli(_sql) # 熔断数据 # check_key_data_task(ds) # 生成_SUCCESS """ 第一个参数true: 数据目录是有country_code分区。false 没有 第二个参数true: 数据有才生成_SUCCESS false 数据没有也生成_SUCCESS """ TaskTouchzSuccess().countries_touchz_success(ds, db_name, table_name, hdfs_path, "true", "true")
def execution_data_task_id(ds, execution_date, **kargs): hive_hook = HiveCliHook() # 读取sql _sql = dwd_oride_location_driver_event_hi_sql_task(ds, execution_date) logging.info('Executing: %s', _sql) # 执行Hive hive_hook.run_cli(_sql) # 熔断数据 # check_key_data_task(ds, execution_date) # 生成_SUCCESS """ 第一个参数true: 数据目录是有country_code分区。false 没有 第二个参数true: 数据有才生成_SUCCESS false 数据没有也生成_SUCCESS """ TaskTouchzSuccess().countries_touchz_success(ds, db_name, table_name, hdfs_path, "true", "false", execution_date.strftime("%H"))
def execution_data_task_id(ds, **kargs): hive_hook = HiveCliHook() # 读取sql _sql = dwd_active_user_week_di_sql_task(ds) logging.info('Executing: %s', _sql) # 执行Hive hive_hook.run_cli(_sql) # 熔断数据 # check_key_data_task(ds) # 生成_SUCCESS """ 第一个参数true: 数据目录是有country_code分区。false 没有 第二个参数true: 数据有才生成_SUCCESS false 数据没有也生成_SUCCESS """ after_6_day = airflow.macros.ds_add(ds, +6) TaskTouchzSuccess().countries_touchz_success(after_6_day, db_name, table_name, hdfs_path, "true", "true")