优化融合检测
This commit is contained in:
+7
-16
@@ -1,30 +1,21 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
# coding: utf-8
|
|
||||||
|
|
||||||
# In[56]:
|
|
||||||
|
|
||||||
|
|
||||||
from goojia_utils import dateutils, ftputils, tarutils
|
from goojia_utils import dateutils, ftputils, tarutils
|
||||||
import datetime
|
import datetime
|
||||||
import calendar
|
|
||||||
import requests
|
import requests
|
||||||
import json
|
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
result = []
|
result = []
|
||||||
|
|
||||||
# #### 检测传输压缩文件是否完整
|
|
||||||
|
|
||||||
# ##### 1. 融合每天检测
|
# ##### 1. 融合每天检测
|
||||||
|
|
||||||
try:
|
try:
|
||||||
today = dateutils.add_months(datetime.datetime.now(), days=1)
|
date = sys.argv[1] if len(sys.argv) > 1 else None
|
||||||
date = dateutils.format_date(today, '%Y%m%d')
|
if date is None:
|
||||||
|
today = dateutils.add_months(datetime.datetime.now(), days=1)
|
||||||
|
date = dateutils.format_date(today, '%Y%m%d')
|
||||||
print('当前月:' + date)
|
print('当前月:' + date)
|
||||||
curr_month_days = calendar.monthrange(today.year, today.month)[1]
|
# curr_month_days = calendar.monthrange(today.year, today.month)[1]
|
||||||
print('当月天数:' + str(curr_month_days))
|
# print('当月天数:' + str(curr_month_days))
|
||||||
|
|
||||||
|
|
||||||
# In[79]:
|
# In[79]:
|
||||||
|
|||||||
@@ -6,12 +6,12 @@ with DAG(
|
|||||||
dag_id="merge_dag",
|
dag_id="merge_dag",
|
||||||
# 每日下午4点
|
# 每日下午4点
|
||||||
schedule_interval="0 16 * * *",
|
schedule_interval="0 16 * * *",
|
||||||
start_date=pendulum.datetime(2022, 11, 15, tz="Asia/Shanghai"),
|
start_date=pendulum.datetime(2023, 3, 14, tz="Asia/Shanghai"),
|
||||||
catchup=True,
|
catchup=True,
|
||||||
description="每日融合文件检测"
|
description="每日融合文件检测, 若想指定检测某一天如20230314,则传参day=20230314"
|
||||||
) as dag:
|
) as dag:
|
||||||
t1 = BashOperator(
|
t1 = BashOperator(
|
||||||
task_id='merge',
|
task_id='merge',
|
||||||
bash_command='python /opt/airflow/dags/repo/dags/jh/merge/merge.py',
|
bash_command='python /opt/airflow/dags/repo/dags/jh/merge/merge.py {{dag_run.conf["day"] if "day" in dag_run.conf}}',
|
||||||
)
|
)
|
||||||
t1
|
t1
|
||||||
|
|||||||
Reference in New Issue
Block a user