Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mobvista-dmp
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王金锋
mobvista-dmp
Commits
c5e8abd9
Commit
c5e8abd9
authored
Aug 25, 2021
by
fan.jiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
id1142110895
parent
48220007
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
117 additions
and
0 deletions
+117
-0
rtdmp_tmp_id1142110895.job
...eudo_package_to_other_business/rtdmp_tmp_id1142110895.job
+3
-0
rtdmp_tmp_id1142110895.sh
...seudo_package_to_other_business/rtdmp_tmp_id1142110895.sh
+29
-0
dmp_env.sh
azkaban/dmp_env.sh
+1
-0
RtdmpTmpId1142110895.scala
...ala/mobvista/dmp/datasource/dm/RtdmpTmpId1142110895.scala
+84
-0
No files found.
azkaban/dm/pseudo_package_to_other_business/rtdmp_tmp_id1142110895.job
0 → 100644
View file @
c5e8abd9
type=command
command=sh -x rtdmp_tmp_id1142110895.sh
\ No newline at end of file
azkaban/dm/pseudo_package_to_other_business/rtdmp_tmp_id1142110895.sh
0 → 100644
View file @
c5e8abd9
#!/usr/bin/env bash
source
../../dmp_env.sh
dt_today
=
$(
date
-d
"
$ScheduleTime
1 days ago"
+
"%Y%m%d"
)
dt_slash_today
=
$(
date
-d
"
$ScheduleTime
1 days ago"
+
"%Y/%m/%d"
)
check_await
"
${
DM_INSTALL_LIST
}
_v2/
${
dt_slash_today
}
/dsp_req/_SUCCESS"
OUTPUT_PATH1
=
"
${
RTDMP_TMP_PACKAGE_NAME_PATH
}
/id1142110895/
${
dt_slash_today
}
/"
hadoop fs
-rm
-r
"
${
OUTPUT_PATH1
}
"
spark-submit
--class
mobvista.dmp.datasource.dm.RtdmpTmpId1142110895
\
--conf
spark.yarn.executor.memoryOverhead
=
2048
\
--conf
spark.default.parallelism
=
3000
\
--conf
spark.sql.shuffle.partitions
=
3000
\
--conf
spark.driver.maxResultSize
=
4g
\
--conf
spark.network.timeout
=
720s
\
--files
${
HIVE_SITE_PATH
}
\
--master
yarn
--deploy-mode
cluster
--executor-memory
8g
--driver-memory
6g
--executor-cores
6
--num-executors
70
\
../../
${
JAR
}
-dt_today
${
dt_today
}
-output1
${
OUTPUT_PATH1
}
\
-coalesce
420
if
[[
$?
-ne
0
]]
;
then
exit
255
fi
\ No newline at end of file
azkaban/dmp_env.sh
View file @
c5e8abd9
...
...
@@ -265,6 +265,7 @@ RTDMP_COM_TAOBAO_LITETAO_REYUN_PATH="s3://mob-emr-test/dataplatform/DataWareHous
RTDMP_COM_SS_ANDROID_UGC_AWEME_REYUN_PATH
=
"s3://mob-emr-test/dataplatform/DataWareHouse/data/dwh/tmp/rtdmp_com_ss_android_ugc_aweme_reyun"
RTDMP_COM_TAOBAO_LITETAO_BTOP_PATH
=
"s3://mob-emr-test/dataplatform/DataWareHouse/data/dwh/tmp/rtdmp_com_taobao_litetao_btop"
RTDMP_COM_SS_ANDROID_UGC_AWEME_BTOP_PATH
=
"s3://mob-emr-test/dataplatform/DataWareHouse/data/dwh/tmp/rtdmp_com_ss_android_ugc_aweme_btop"
RTDMP_TMP_PACKAGE_NAME_PATH
=
"s3://mob-emr-test/dataplatform/DataWareHouse/data/dwh/tmp/rtdmp_tmp_package_name"
RTDMP_NORMAL_PATH
=
"s3://mob-emr-test/dataplatform/DataWareHouse/data/dwh/tmp/rtdmp_normal"
RTDMP_NORMAL_COUNT_RESULT
=
"s3://mob-emr-test/dataplatform/DataWareHouse/data/dwh/tmp/rtdmp_normal_count_result"
...
...
src/main/scala/mobvista/dmp/datasource/dm/RtdmpTmpId1142110895.scala
0 → 100644
View file @
c5e8abd9
package
mobvista.dmp.datasource.dm
import
mobvista.dmp.common.CommonSparkJob
import
mobvista.dmp.format.TextMultipleOutputFormat
import
org.apache.commons.cli.Options
import
org.apache.commons.lang.StringUtils
import
org.apache.hadoop.fs.
{
FileSystem
,
Path
}
import
org.apache.hadoop.io.Text
import
org.apache.spark.sql.
{
Row
,
SparkSession
}
import
java.net.URI
import
scala.collection.mutable.ArrayBuffer
/**
* @author jiangfan
* @date 2021/8/25 11:47
*/
class
RtdmpTmpId1142110895
extends
CommonSparkJob
with
Serializable
{
override
protected
def
buildOptions
()
:
Options
=
{
val
options
=
new
Options
options
.
addOption
(
"coalesce"
,
true
,
"[must] coalesce"
)
options
.
addOption
(
"output1"
,
true
,
"[must] output1"
)
options
.
addOption
(
"dt_today"
,
true
,
"[must] dt_today"
)
options
}
override
protected
def
run
(
args
:
Array
[
String
])
:
Int
=
{
val
commandLine
=
commParser
.
parse
(
options
,
args
)
if
(!
checkMustOption
(
commandLine
))
{
printUsage
(
options
)
return
-
1
}
else
printOptions
(
commandLine
)
val
coalesce
=
commandLine
.
getOptionValue
(
"coalesce"
)
val
output1
=
commandLine
.
getOptionValue
(
"output1"
)
val
dt_today
=
commandLine
.
getOptionValue
(
"dt_today"
)
val
spark
=
SparkSession
.
builder
()
.
appName
(
"RtdmpTmpId1142110895"
)
.
config
(
"spark.rdd.compress"
,
"true"
)
.
config
(
"spark.io.compression.codec"
,
"snappy"
)
.
config
(
"spark.sql.orc.filterPushdown"
,
"true"
)
.
config
(
"spark.sql.warehouse.dir"
,
"s3://mob-emr-test/spark-warehouse"
)
.
config
(
"spark.serializer"
,
"org.apache.spark.serializer.KryoSerializer"
)
.
enableHiveSupport
()
.
getOrCreate
()
val
sc
=
spark
.
sparkContext
import
spark.implicits._
FileSystem
.
get
(
new
URI
(
s
"s3://mob-emr-test"
),
spark
.
sparkContext
.
hadoopConfiguration
).
delete
(
new
Path
(
output1
),
true
)
try
{
val
sql1
=
s
"""
|select device_id, device_type from dwh.dm_install_list_v2 where dt='${dt_today}' and package_name in ('1142110895','id1142110895') and device_type not in ('androidid','android_id','ruid')
"""
.
stripMargin
spark
.
sql
(
sql1
).
rdd
.
flatMap
(
buildRes
(
_
)).
coalesce
(
coalesce
.
toInt
)
.
saveAsNewAPIHadoopFile
(
s
"${output1}"
,
classOf
[
Text
],
classOf
[
Text
],
classOf
[
TextMultipleOutputFormat
],
spark
.
sparkContext
.
hadoopConfiguration
)
}
finally
{
spark
.
stop
()
}
0
}
def
buildRes
(
row
:
Row
)
:
Array
[
Tuple2
[
Text
,
Text
]]
=
{
val
buffer
=
new
ArrayBuffer
[
Tuple2
[
Text
,
Text
]]()
val
device_id
=
row
.
getAs
[
String
](
"device_id"
)
val
device_type
=
row
.
getAs
[
String
](
"device_type"
)
if
(
StringUtils
.
isNotBlank
(
device_type
))
{
buffer
+=
Tuple2
(
new
Text
(
s
"${device_type}, "
),
new
Text
(
device_id
))
}
buffer
.
toArray
}
}
object
RtdmpTmpId1142110895
{
def
main
(
args
:
Array
[
String
])
:
Unit
=
{
new
RtdmpTmpId1142110895
().
run
(
args
)
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment