Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
operating-vehicle
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杜发飞
operating-vehicle
Commits
2ae921dd
Commit
2ae921dd
authored
Nov 05, 2019
by
杜发飞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
31d52b5c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
5 deletions
+6
-5
src/main/scala/com/hikcreate/data/common/Sparking.scala
+4
-3
src/main/scala/com/hikcreate/data/listener/BatchProcessListener.scala
+1
-1
src/main/scala/com/hikcreate/data/sync/SyncIgnite.scala
+1
-1
No files found.
src/main/scala/com/hikcreate/data/common/Sparking.scala
View file @
2ae921dd
...
...
@@ -4,6 +4,7 @@ import com.hikcreate.data.listener.LifecycleListener
import
org.apache.log4j.
{
Level
,
Logger
}
import
org.apache.kafka.common.serialization.StringDeserializer
import
org.apache.spark.SparkConf
import
org.apache.spark.serializer.KryoSerializer
trait
Sparking
{
...
...
@@ -13,12 +14,12 @@ trait Sparking {
Logger
.
getLogger
(
"org.apache.kafka.clients.consumer"
).
setLevel
(
Level
.
WARN
)
val
conf
:
SparkConf
=
new
SparkConf
()
.
set
(
"spark.serializer"
,
"org.apache.spark.serializer.KryoSerializer"
)
.
set
(
"spark.serializer"
,
classOf
[
KryoSerializer
].
getName
)
.
set
(
"spark.extraListeners"
,
classOf
[
LifecycleListener
].
getName
)
.
set
(
"hive.exec.dynamici.partition"
,
"true"
)
.
set
(
"hive.exec.dynamic.partition.mode"
,
"nonstrict"
)
.
setAppName
(
"test"
)
.
setMaster
(
"local[*]"
)
//
.setAppName("test")
//
.setMaster("local[*]")
def
getKafkaParams
(
servers
:
String
,
groupId
:
String
)
:
Map
[
String
,
Object
]
=
{
Map
[
String
,
Object
](
...
...
src/main/scala/com/hikcreate/data/listener/BatchProcessListener.scala
View file @
2ae921dd
...
...
@@ -20,7 +20,7 @@ class BatchProcessListener(ssc:StreamingContext) extends StreamingListener with
msg
.
append
(
"应用程序开始时间:"
+
new
DateTime
(
ssc
.
sparkContext
.
startTime
).
toString
(
"yyyy-MM-dd HH:mm:ss"
))
override
def
onBatchStarted
(
batchStarted
:
StreamingListenerBatchStarted
)
:
Unit
=
{
val
Delay_ts
=
batchStarted
.
batchInfo
.
schedulingDelay
.
get
/
1000
*
60D
val
Delay_ts
=
batchStarted
.
batchInfo
.
schedulingDelay
.
get
/
(
1000
*
60D
)
if
(
Delay_ts
>
ApolloConst
.
delayMax
&&
isSend
.
get
()){
msg
.
append
(
"当前调度等待时间:"
+
Delay_ts
)
EmailClient
.
sendEmail
(
"Spark程序监控"
,
ApolloConst
.
recipients
,
Some
(
msg
.
mkString
(
"\n"
)),
None
,
None
)
...
...
src/main/scala/com/hikcreate/data/sync/SyncIgnite.scala
View file @
2ae921dd
...
...
@@ -40,7 +40,7 @@ object SyncIgnite extends Sparking with Logging{
x
.
foreach
{
x
=>
try
{
//System.exit(1)
x
.
_2
.
foreach
(
x
=>
println
(
x
.
toJSONString
))
//
x._2.foreach(x=>println(x.toJSONString))
x
.
_1
match
{
case
TableKey
(
Some
(
"0x1200"
),
Some
(
"0x1202"
))
=>
//车辆定位消息
val
value
=
x
.
_2
.
toList
.
grouped
(
20
)
...
...
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