DAG: multi_interest_jx_feed

schedule: 20 05 * * *


multi_interest_jx_feed

Toggle wrap
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
from airflow import DAG
from airflow.operators.bash_operator import BashOperator
from datetime import datetime, timedelta
from airflow.contrib.operators.spark_submit_operator import SparkSubmitOperator
from datetime import timedelta,datetime
import pendulum
import pytz

tz = pytz.timezone('Asia/Shanghai')

default_args = {
    'owner': 'Terry',
    'depends_on_past': False,
    'start_date': pendulum.datetime(year=2024, month=4, day=23).astimezone(tz),
    'email': ['tian23.li@tcl.com'],
    'email_on_failure': True,
    'email_on_retry': True,
    'retries': 2,
    'retry_delay': timedelta(minutes=5),
}

_config = {
    'conf': {
        'spark.executor.extraJavaOptions': '-XX:+UseConcMarkSweepGC',
        "spark.dynamicAllocation.minExecutors":8,
        "spark.dynamicAllocation.maxExecutors":8,
        "spark.yarn.executor.memoryOverhead":2648,
        "spark.driver.maxResultSize": "4g",
        "spark.yarn.maxAppAttempts": 1,
        "spark.network.timeout": 1000000,
        "spark.executor.heartbeatInterval" : 1000000
    },
    'executor_cores': 4,
    'executor_memory': '6g',
    'name': '{{ task_instance.task_id }}',
    
    'driver_memory': '6g',
}

dag = DAG(
    dag_id='multi_interest_jx_feed',
    description='flow for multi-interest jx feed inference',
    default_args=default_args,
    schedule_interval='20 05 * * *',
)

# kill_iPython_job = BashOperator(
#     task_id='kill_iPython_job',
#     bash_command="ps -ef | grep ipykernel | grep -v grep | awk '{print $2}' | xargs kill -9",
#     #bash_command="kill $(nvidia-smi -g 0)",
#     dag=dag,
# )

get_aid_click_expose_jx_lst_ndays_local = SparkSubmitOperator(
    task_id='get_aid_click_expose_jx_feed_ndays_local',
    dag=dag,
    **_config,
    application='/data/gangyanyuan/terry/terry-recsys-2024/multi-interest/script/jx_feed/get_aid_click_expose_jx_feed_ndays_local.py',
    conn_id = "spark_local",
)
online_monitor_ecpm_by_bucket_may_algo = SparkSubmitOperator(
    task_id='online_monitor_ecpm_by_bucket_may_algo',
    dag=dag,
    **_config,
    application= "/data/gangyanyuan/terry/terry-recsys-2024/multi-interest/script/ecpm_monitor/online_monitor_ecpm_by_bucket_may_algo.py",
    conn_id = "spark_local",
)

get_jx_feed_dnum_expose = BashOperator(
    task_id='get_jx_feed_dnum_expose',
    bash_command="cd /data/gangyanyuan/terry/terry-recsys-2024/multi-interest/script/jx_feed && /data/dev/miniconda/envs/recsys2/bin/python 1_get_jx_feed_dnum_expose.py",
    depends_on_past =False,
    dag=dag,
)
get_jx_feed_dnum_30days = BashOperator(
    task_id='get_jx_feed_dnum_30days',
    bash_command="cd /data/gangyanyuan/terry/terry-recsys-2024/multi-interest/script/jx_feed && /data/dev/miniconda/envs/recsys2/bin/python 2_get_jx_feed_dnum_30days.py",
    depends_on_past =False,
    dag=dag,
)
update_user_click_jx_feed_60days = BashOperator(
    task_id='update_user_click_jx_feed_60days',
    bash_command="cd /data/gangyanyuan/terry/terry-recsys-2024/multi-interest/script/jx_feed && /data/dev/miniconda/envs/deepmatch/bin/python 3_1_update_user_click_jx_feed_60days.py",
    depends_on_past =False,
    dag=dag,
)
generate_diffurec_dataset_jx_feed = BashOperator(
    task_id='generate_diffurec_dataset_jx_feed',
    bash_command="cd /data/gangyanyuan/terry/terry-recsys-2024/multi-interest/script/jx_feed && /data/dev/miniconda/envs/deepmatch/bin/python 4_generate_diffurec_dataset_jx_feed.py",
    depends_on_past =False,
    dag=dag,
)
pca_text_image = BashOperator(
    task_id='pca_text_image',
    bash_command="cd /data/gangyanyuan/terry/terry-recsys-2024/multi-interest/script && /data/dev/miniconda/envs/deepmatch/bin/python pca.py --dataset jx_feed --text_feat --image_feat",
    depends_on_past =False,
    dag=dag,
)
# train
train_diffurec_jx_feed = BashOperator(
    task_id='train_diffurec_jx_feed',
    bash_command="cd /data/gangyanyuan/terry/terry-recsys-2024/multi-interest/DiffuRec/src_v2 && /data/dev/miniconda/envs/pt1.0/bin/python main_daily.py --dataset jx_feed --text_feat --image_feat",
    depends_on_past =False,
    dag=dag,
)
generate_inference_dataset = BashOperator(
    task_id='generate_inference_dataset',
    bash_command="cd /data/gangyanyuan/terry/terry-recsys-2024/multi-interest/script/jx_feed && /data/dev/miniconda/envs/deepmatch/bin/python 5_generate_inference_dataset.py",
    depends_on_past =False,
    dag=dag,
)

generate_diffurec_recall_result = BashOperator(
    task_id='generate_diffurec_recall_result',
    bash_command="cd /data/gangyanyuan/terry/terry-recsys-2024/multi-interest/script/jx_feed && /data/dev/miniconda/envs/pt1.0/bin/python 6_generate_diffurec_recall_result.py --text_feat --image_feat",
    depends_on_past =False,
    dag=dag,
)

# sep
get_vip_users = BashOperator(
    task_id='get_vip_users',
    bash_command="cd /data/gangyanyuan/terry/terry-recsys-2024/multi-interest/script/movie_tv && /data/dev/miniconda/envs/deepmatch/bin/python 0_get_vip_users.py",
    depends_on_past =False,
    dag=dag,
)

update_user_click_jx_feed_60days_novip = BashOperator(
    task_id='update_user_click_jx_feed_60days_novip',
    bash_command="cd /data/gangyanyuan/terry/terry-recsys-2024/multi-interest/script/jx_feed/novip_sep && /data/dev/miniconda/envs/deepmatch/bin/python 3_1_update_user_click_jx_feed_60days_novip_v2.py",
    depends_on_past =False,
    dag=dag,
)
generate_diffurec_dataset_jx_feed_novip = BashOperator(
    task_id='generate_diffurec_dataset_jx_feed_novip',
    bash_command="cd /data/gangyanyuan/terry/terry-recsys-2024/multi-interest/script/jx_feed/novip_sep && /data/dev/miniconda/envs/deepmatch/bin/python 4_generate_diffurec_dataset_jx_feed_novip.py",
    depends_on_past =False,
    dag=dag,
)
pca_text_image_v2 = BashOperator(
    task_id='pca_text_image_v2',
    bash_command="cd /data/gangyanyuan/terry/terry-recsys-2024/multi-interest/script && /data/dev/miniconda/envs/deepmatch/bin/python pca_v2.py --dataset jx_feed --text_feat --image_feat",
    depends_on_past =False,
    dag=dag,
)
# train
train_diffurec_jx_feed_novip = BashOperator(
    task_id='train_diffurec_jx_feed_novip',
    bash_command="cd /data/gangyanyuan/terry/terry-recsys-2024/multi-interest/DiffuRec/src_v2 && /data/dev/miniconda/envs/pt1.0/bin/python main_daily_llm_v2.py --dataset jx_feed --text_feat --image_feat",
    depends_on_past =False,
    dag=dag,
)
generate_inference_dataset_novip = BashOperator(
    task_id='generate_inference_dataset_novip',
    bash_command="cd /data/gangyanyuan/terry/terry-recsys-2024/multi-interest/script/jx_feed/novip_sep && /data/dev/miniconda/envs/deepmatch/bin/python 5_generate_inference_dataset_novip.py",
    depends_on_past =False,
    dag=dag,
)

generate_diffurec_recall_result_novip = BashOperator(
    task_id='generate_diffurec_recall_result_novip',
    bash_command="cd /data/gangyanyuan/terry/terry-recsys-2024/multi-interest/script/jx_feed/novip_sep && /data/dev/miniconda/envs/pt1.0/bin/python 6_generate_diffurec_recall_result_novip.py --text_feat --image_feat",
    depends_on_past =False,
    dag=dag,
)


save_jx_feed_recall_to_hive_v2 = SparkSubmitOperator(
    task_id='save_jx_feed_recall_to_hive_v2',
    dag=dag,
    **_config,
    application= '/data/gangyanyuan/terry/terry-recsys-2024/multi-interest/script/jx_feed/save_jx_feed_recall_to_hive_v2.py',
    conn_id = "spark_local",
)
get_pretrained_content_embedding_jx_feed = BashOperator(
    task_id='get_pretrained_content_embedding_jx_feed',
    bash_command="cd /data/gangyanyuan/terry/terry-recsys-2024/multi-interest/script/jx_feed && /data/dev/miniconda/envs/deepmatch/bin/python get_pretrained_content_embedding_jx_feed.py --dataset jx_feed",
    depends_on_past =False,
    dag=dag,
)
get_pretrained_image_embedding_minicpm_jx_feed = BashOperator(
    task_id='get_pretrained_image_embedding_minicpm_jx_feed',
    bash_command="cd /data/gangyanyuan/terry/terry-recsys-2024/multi-interest/script/jx_feed && /data/dev/miniconda/envs/deepmatch/bin/python get_pretrained_image_embedding_minicpm_jx_feed.py --dataset jx_feed",
    depends_on_past =False,
    dag=dag,
)
get_pretrained_content_embedding_jx_feed_sep = BashOperator(
    task_id='get_pretrained_content_embedding_jx_feed_sep',
    bash_command="cd /data/gangyanyuan/terry/terry-recsys-2024/multi-interest/script/jx_feed/novip_sep && /data/dev/miniconda/envs/deepmatch/bin/python get_pretrained_content_embedding_jx_feed_sep.py --dataset jx_feed",
    depends_on_past =False,
    dag=dag,
)
get_pretrained_image_embedding_minicpm_sep = BashOperator(
    task_id='get_pretrained_image_embedding_minicpm_jx_feed_sep',
    bash_command="cd /data/gangyanyuan/terry/terry-recsys-2024/multi-interest/script/jx_feed/novip_sep && /data/dev/miniconda/envs/deepmatch/bin/python get_pretrained_image_embedding_minicpm_jx_feed_sep.py --dataset jx_feed",
    depends_on_past =False,
    dag=dag,
)


get_aid_click_expose_jx_lst_ndays_local >> online_monitor_ecpm_by_bucket_may_algo

get_jx_feed_dnum_expose >> get_jx_feed_dnum_30days >> get_vip_users >> update_user_click_jx_feed_60days >> update_user_click_jx_feed_60days_novip >> generate_diffurec_dataset_jx_feed >> get_pretrained_content_embedding_jx_feed >> get_pretrained_image_embedding_minicpm_jx_feed >> pca_text_image>> train_diffurec_jx_feed >> generate_inference_dataset >> generate_diffurec_recall_result >> save_jx_feed_recall_to_hive_v2

update_user_click_jx_feed_60days_novip >> generate_diffurec_dataset_jx_feed_novip >> get_pretrained_content_embedding_jx_feed_sep >> get_pretrained_image_embedding_minicpm_sep >> pca_text_image_v2 >> train_diffurec_jx_feed_novip >> generate_inference_dataset_novip >> generate_diffurec_recall_result_novip >> save_jx_feed_recall_to_hive_v2