This repository has been archived by the owner. It is now read-only.
Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
17 changed files
with
526 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,66 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# * "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
from airflow import DAG | ||
import datetime as dt | ||
from airflow.contrib.operators.spark_submit_operator import SparkSubmitOperator | ||
from datetime import timedelta | ||
|
||
default_args = { | ||
'owner': 'lookalike_application', | ||
'depends_on_past': False, | ||
'start_date': dt.datetime(2021, 7, 28), | ||
'retries': 1, | ||
'retry_delay': timedelta(minutes=5), | ||
} | ||
|
||
dag = DAG( | ||
'lookalike_application', | ||
default_args=default_args, | ||
schedule_interval=None, | ||
|
||
) | ||
|
||
|
||
def sparkOperator( | ||
file, | ||
task_id, | ||
**kwargs | ||
): | ||
return SparkSubmitOperator( | ||
application='/home/airflow/airflow-apps/lookalike-model/lookalike_model/application/pipeline/{}'.format(file), | ||
application_args=['/home/airflow/airflow-apps/lookalike-model/lookalike_model/application/pipeline/config.yml'], | ||
conn_id='spark_default', | ||
executor_memory='8G', | ||
conf={'spark.driver.maxResultSize': '5g', 'spark.hadoop.hive.exec.dynamic.partition': True, 'spark.hadoop.hive.exec.dynamic.partition.mode': 'nonstrict'}, | ||
driver_memory='8G', | ||
executor_cores=5, | ||
num_executors=20, | ||
task_id=task_id, | ||
dag=dag, | ||
**kwargs | ||
) | ||
|
||
|
||
|
||
score_generator = sparkOperator('score_generator.py', 'lookalike_score_generator') | ||
score_vector_table = sparkOperator('score_vector_table.py', 'lookalike_score_vector_table') | ||
score_vector_rebucketing = sparkOperator('score_vector_rebucketing.py', 'lookalike_score_vector_rebucketing') | ||
top_n_similarity_table_generator = sparkOperator('top_n_similarity_table_generator.py', 'lookalike_top_n_similarity_table_generator') | ||
|
||
|
||
score_generator >> score_vector_table >> score_vector_rebucketing >> top_n_similarity_table_generator |
BIN
+397 KB
Model/lookalike-model/doc/ssd-v2.pdf
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -1,31 +1,35 @@ | ||
product_tag: 'lookalike' | ||
pipeline_tag: '08042021' | ||
score_generator: | ||
input: | ||
log_table : "lookalike_03042021_logs" | ||
did_table: "lookalike_03042021_trainready" | ||
keywords_table: "din_ad_keywords_09172020" | ||
test_table: "lookalike_trainready_jimmy_test" | ||
din_model_tf_serving_url: "http://10.193.217.105:8506/v1/models/lookalike3:predict" | ||
din_model_tf_serving_url: "http://10.193.217.105:8506/v1/models/lookalike:predict" | ||
din_model_length: 20 | ||
seeduser_table : "lookalike_seeduser" | ||
number_of_seeduser: 1000 | ||
extend: 2000 | ||
alg: "euclidean" ##### currently just support "euclideand" and "dot" | ||
output: | ||
did_score_table: "lookalike_score_01112021" | ||
score_norm_table: "lookalike_score_norm_01112021" | ||
did_score_table: "{product_tag}_score_{pipeline_tag}" | ||
score_norm_table: "{product_tag}_score_norm_{pipeline_tag}" | ||
normalize: False | ||
|
||
score_vector: | ||
keywords_table: "din_ad_keywords_09172020" | ||
score_norm_table: "lookalike_score_norm_01112021" | ||
score_vector_table: "lookalike_score_vector_01112021" | ||
score_norm_table: "{product_tag}_score_norm_{pipeline_tag}" | ||
score_vector_table: "{product_tag}_score_vector_{pipeline_tag}" | ||
did_bucket_size: 2 | ||
did_bucket_step: 2 | ||
score_vector_rebucketing: | ||
did_bucket_size: 2 | ||
did_bucket_step: 2 | ||
alpha_did_bucket_size: 1000 | ||
score_vector_alpha_table: 'lookalike_score_vector_alpha_01112021' | ||
alpha_did_bucket_size: 20 #default=1000 | ||
score_vector_alpha_table: '{product_tag}_score_vector_alpha_{pipeline_tag}' | ||
top_n_similarity: | ||
alpha_did_bucket_step: 100 | ||
top_n: 100 | ||
similarity_table: "lookalike_similarity_01112021" | ||
did_bucket_step: 1 | ||
alpha_did_bucket_step: 10 | ||
top_n: 10 | ||
similarity_table: "{product_tag}_similarity_{pipeline_tag}" |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -1,14 +1,16 @@ | ||
#!/bin/bash | ||
|
||
spark-submit --executor-memory 16G --driver-memory 24G --num-executors 16 --executor-cores 5 --master yarn --conf spark.driver.maxResultSize=8g seed_user_selector.py config.yml "29" | ||
# Not used as part of pipeline | ||
spark-submit --master yarn --num-executors 20 --executor-cores 5 --executor-memory 8G --driver-memory 8G --conf spark.driver.maxResultSize=5g --conf spark.hadoop.hive.exec.dynamic.partition=true --conf spark.hadoop.hive.exec.dynamic.partition.mode=nonstrict seed_user_selector.py config.yml "29" | ||
|
||
spark-submit --executor-memory 16G --driver-memory 24G --num-executors 16 --executor-cores 5 --master yarn --conf spark.driver.maxResultSize=8g score_generator.py config.yml | ||
spark-submit --master yarn --num-executors 20 --executor-cores 5 --executor-memory 8G --driver-memory 8G --conf spark.driver.maxResultSize=5g --conf spark.hadoop.hive.exec.dynamic.partition=true --conf spark.hadoop.hive.exec.dynamic.partition.mode=nonstrict score_generator.py config.yml | ||
|
||
spark-submit --master yarn --num-executors 20 --executor-cores 5 --executor-memory 8G --driver-memory 8G --conf spark.driver.maxResultSize=5g --conf spark.hadoop.hive.exec.dynamic.partition=true --conf spark.hadoop.hive.exec.dynamic.partition.mode=nonstrict score_vector_table.py config.yml | ||
|
||
spark-submit --master yarn --num-executors 20 --executor-cores 5 --executor-memory 8G --driver-memory 8G --conf spark.driver.maxResultSize=5g --conf spark.hadoop.hive.exec.dynamic.partition=true --conf spark.hadoop.hive.exec.dynamic.partition.mode=nonstrict score_vector_rebucketing.py config. | ||
spark-submit --master yarn --num-executors 20 --executor-cores 5 --executor-memory 8G --driver-memory 8G --conf spark.driver.maxResultSize=5g --conf spark.hadoop.hive.exec.dynamic.partition=true --conf spark.hadoop.hive.exec.dynamic.partition.mode=nonstrict score_vector_rebucketing.py config.yml | ||
|
||
spark-submit --master yarn --num-executors 20 --executor-cores 5 --executor-memory 16G --driver-memory 16G --conf spark.driver.maxResultSize=5g --conf spark.hadoop.hive.exec.dynamic.partition=true --conf spark.hadoop.hive.exec.dynamic.partition.mode=nonstrict top_n_similarity_table_generator.py config.yml | ||
|
||
spark-submit --executor-memory 16G --driver-memory 24G --num-executors 16 --executor-cores 5 --master yarn --conf spark.driver.maxResultSize=8g validation.py config.yml "29" | ||
# Not used as part of pipeline | ||
spark-submit ---master yarn --num-executors 20 --executor-cores 5 --executor-memory 8G --driver-memory 8G --conf spark.driver.maxResultSize=5g --conf spark.hadoop.hive.exec.dynamic.partition=true --conf spark.hadoop.hive.exec.dynamic.partition.mode=nonstrict validation.py config.yml "29" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.