新增公交测试

This commit is contained in:
shenjian@fangjia.com
2022-11-21 10:48:26 +08:00
parent 0b9dbbdf70
commit 48562ba023
2 changed files with 77 additions and 73 deletions
+8 -4
View File
@@ -36,7 +36,9 @@ def deal(actions, item):
doc_info['bus_station'] = ",".join(bus_station) doc_info['bus_station'] = ",".join(bus_station)
bus_doc = poiutils.find_nearest_by_location(curr_city, None, [lng, lat], "交通", "公交") bus_doc = poiutils.find_nearest_by_location(curr_city, None, [lng, lat], "交通", "公交")
log.info(bus_doc)
if pd.notna(bus_doc): if pd.notna(bus_doc):
log.info("开始计算最近公交")
doc_info['nearest_bus_station_distance'] = int(bus_doc['sort'][0]) doc_info['nearest_bus_station_distance'] = int(bus_doc['sort'][0])
doc_info['nearest_bus_station'] = bus_doc['_source']['name'] doc_info['nearest_bus_station'] = bus_doc['_source']['name']
@@ -46,10 +48,12 @@ def deal(actions, item):
if len(subway_station) > 0: if len(subway_station) > 0:
doc_info['subway_station'] = ",".join(subway_station) doc_info['subway_station'] = ",".join(subway_station)
bus_doc = poiutils.find_nearest_by_location(curr_city, None, [lng, lat], "交通", "地铁") subway_doc = poiutils.find_nearest_by_location(curr_city, None, [lng, lat], "交通", "地铁")
if pd.notna(bus_doc): log.info(subway_doc)
doc_info['nearest_subway_station_distance'] = int(bus_doc['sort'][0]) if pd.notna(subway_doc):
doc_info['nearest_subway_station'] = bus_doc['_source']['name'] log.info("开始计算最近地铁")
doc_info['nearest_subway_station_distance'] = int(subway_doc['sort'][0])
doc_info['nearest_subway_station'] = subway_doc['_source']['name']
action = { action = {
"_op_type": "update", "_op_type": "update",
+69 -69
View File
@@ -10,76 +10,76 @@ with DAG(
catchup=True, catchup=True,
description="地址输出信息分类数据定时更新" description="地址输出信息分类数据定时更新"
) as dag: ) as dag:
# t1 = BashOperator( t1 = BashOperator(
# task_id='comm', task_id='comm',
# bash_command='python /opt/airflow/dags/repo/dags/business/business/community/comm.py {{dag_run.conf["type"] if "type" in dag_run.conf}}', bash_command='python /opt/airflow/dags/repo/dags/business/business/community/comm.py {{dag_run.conf["type"] if "type" in dag_run.conf}}',
# ) )
# t2 = BashOperator( t2 = BashOperator(
# task_id='price', task_id='price',
# bash_command='python /opt/airflow/dags/repo/dags/business/business/community/price.py {{dag_run.conf["type"] if "type" in dag_run.conf}}', bash_command='python /opt/airflow/dags/repo/dags/business/business/community/price.py {{dag_run.conf["type"] if "type" in dag_run.conf}}',
# ) )
# t3 = BashOperator( t3 = BashOperator(
# task_id='sell', task_id='sell',
# bash_command='python /opt/airflow/dags/repo/dags/business/business/community/sell.py {{dag_run.conf["type"] if "type" in dag_run.conf}}', bash_command='python /opt/airflow/dags/repo/dags/business/business/community/sell.py {{dag_run.conf["type"] if "type" in dag_run.conf}}',
# ) )
# t4 = BashOperator( t4 = BashOperator(
# task_id='avg_cost', task_id='avg_cost',
# bash_command='python /opt/airflow/dags/repo/dags/business/business/community/avg_cost.py {{dag_run.conf["type"] if "type" in dag_run.conf}}', bash_command='python /opt/airflow/dags/repo/dags/business/business/community/avg_cost.py {{dag_run.conf["type"] if "type" in dag_run.conf}}',
# ) )
# t5 = BashOperator( t5 = BashOperator(
# task_id='trade', task_id='trade',
# bash_command='python /opt/airflow/dags/repo/dags/business/business/community/trade.py {{dag_run.conf["type"] if "type" in dag_run.conf}}', bash_command='python /opt/airflow/dags/repo/dags/business/business/community/trade.py {{dag_run.conf["type"] if "type" in dag_run.conf}}',
# ) )
# t6 = BashOperator( t6 = BashOperator(
# task_id='total_price', task_id='total_price',
# bash_command='python /opt/airflow/dags/repo/dags/business/business/community/total_price.py {{dag_run.conf["type"] if "type" in dag_run.conf}}', bash_command='python /opt/airflow/dags/repo/dags/business/business/community/total_price.py {{dag_run.conf["type"] if "type" in dag_run.conf}}',
# ) )
# t6_1 = BashOperator( t6_1 = BashOperator(
# task_id='total_price_complete', task_id='total_price_complete',
# bash_command='python /opt/airflow/dags/repo/dags/business/business/community/total_price_complete.py {{dag_run.conf["type"] if "type" in dag_run.conf}}', bash_command='python /opt/airflow/dags/repo/dags/business/business/community/total_price_complete.py {{dag_run.conf["type"] if "type" in dag_run.conf}}',
# ) )
t7 = BashOperator( t7 = BashOperator(
task_id='traffic', task_id='traffic',
bash_command='python /opt/airflow/dags/repo/dags/business/business/community/traffic.py {{dag_run.conf["type"] if "type" in dag_run.conf}}', bash_command='python /opt/airflow/dags/repo/dags/business/business/community/traffic.py {{dag_run.conf["type"] if "type" in dag_run.conf}}',
) )
# t7_1 = BashOperator( t7_1 = BashOperator(
# task_id='business_district', task_id='business_district',
# bash_command='python /opt/airflow/dags/repo/dags/business/business/community/business_district.py {{dag_run.conf["type"] if "type" in dag_run.conf}}', bash_command='python /opt/airflow/dags/repo/dags/business/business/community/business_district.py {{dag_run.conf["type"] if "type" in dag_run.conf}}',
# ) )
# t8 = BashOperator( t8 = BashOperator(
# task_id='medical', task_id='medical',
# bash_command='python /opt/airflow/dags/repo/dags/business/business/community/medical.py {{dag_run.conf["type"] if "type" in dag_run.conf}}', bash_command='python /opt/airflow/dags/repo/dags/business/business/community/medical.py {{dag_run.conf["type"] if "type" in dag_run.conf}}',
# ) )
# t9 = BashOperator( t9 = BashOperator(
# task_id='life', task_id='life',
# bash_command='python /opt/airflow/dags/repo/dags/business/business/community/life.py {{dag_run.conf["type"] if "type" in dag_run.conf}}', bash_command='python /opt/airflow/dags/repo/dags/business/business/community/life.py {{dag_run.conf["type"] if "type" in dag_run.conf}}',
# ) )
# t10 = BashOperator( t10 = BashOperator(
# task_id='relative_price_ranking', task_id='relative_price_ranking',
# bash_command='python /opt/airflow/dags/repo/dags/business/business/community/relative_price_ranking.py {{dag_run.conf["type"] if "type" in dag_run.conf}}', bash_command='python /opt/airflow/dags/repo/dags/business/business/community/relative_price_ranking.py {{dag_run.conf["type"] if "type" in dag_run.conf}}',
# ) )
# t11 = BashOperator( t11 = BashOperator(
# task_id='consumption', task_id='consumption',
# bash_command='python /opt/airflow/dags/repo/dags/business/business/community/consumption.py {{dag_run.conf["type"] if "type" in dag_run.conf}}', bash_command='python /opt/airflow/dags/repo/dags/business/business/community/consumption.py {{dag_run.conf["type"] if "type" in dag_run.conf}}',
# ) )
# t12 = BashOperator( t12 = BashOperator(
# task_id='price_rating', task_id='price_rating',
# bash_command='python /opt/airflow/dags/repo/dags/business/business/community/price_rating.py {{dag_run.conf["type"] if "type" in dag_run.conf}}', bash_command='python /opt/airflow/dags/repo/dags/business/business/community/price_rating.py {{dag_run.conf["type"] if "type" in dag_run.conf}}',
# ) )
# t13 = BashOperator( t13 = BashOperator(
# task_id='education', task_id='education',
# bash_command='python /opt/airflow/dags/repo/dags/business/business/community/education.py {{dag_run.conf["type"] if "type" in dag_run.conf}}', bash_command='python /opt/airflow/dags/repo/dags/business/business/community/education.py {{dag_run.conf["type"] if "type" in dag_run.conf}}',
# ) )
# t14 = BashOperator( t14 = BashOperator(
# task_id='education2', task_id='education2',
# bash_command='python /opt/airflow/dags/repo/dags/business/business/community/education2.py {{dag_run.conf["type"] if "type" in dag_run.conf}}', bash_command='python /opt/airflow/dags/repo/dags/business/business/community/education2.py {{dag_run.conf["type"] if "type" in dag_run.conf}}',
# ) )
# t15 = BashOperator( t15 = BashOperator(
# task_id='extra', task_id='extra',
# bash_command='python /opt/airflow/dags/repo/dags/business/business/community/extra.py {{dag_run.conf["type"] if "type" in dag_run.conf}}', bash_command='python /opt/airflow/dags/repo/dags/business/business/community/extra.py {{dag_run.conf["type"] if "type" in dag_run.conf}}',
# ) )
# t16 = BashOperator( t16 = BashOperator(
# task_id='other', task_id='other',
# bash_command='python /opt/airflow/dags/repo/dags/business/business/community/other.py {{dag_run.conf["type"] if "type" in dag_run.conf}}', bash_command='python /opt/airflow/dags/repo/dags/business/business/community/other.py {{dag_run.conf["type"] if "type" in dag_run.conf}}',
# ) )
# t1 >> t2 >> t3 >> t4 >> t5 >> t6 >> t6_1 >> t7 >> t7_1 >> t8 >> t9 >> t10 >> t11 >> t12 >> t13 >> t14 >> t15 >> t16 t1 >> t2 >> t3 >> t4 >> t5 >> t6 >> t6_1 >> t7 >> t7_1 >> t8 >> t9 >> t10 >> t11 >> t12 >> t13 >> t14 >> t15 >> t16