Create & Init Project...

This commit is contained in:
2019-04-22 18:49:16 +08:00
commit fc4fa37393
25440 changed files with 4054998 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_binary",
"go_library",
)
go_binary(
name = "cmd",
embed = [":go_default_library"],
tags = ["automanaged"],
)
go_library(
name = "go_default_library",
srcs = ["main.go"],
data = ["growup-job.toml"],
importpath = "go-common/app/job/main/growup/cmd",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//app/job/main/growup/conf:go_default_library",
"//app/job/main/growup/http:go_default_library",
"//library/log:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@@ -0,0 +1,166 @@
version = "1.0.0"
user = "nobody"
pid = "/tmp/growup-job.pid"
dir = "./"
perf = "0.0.0.0:7413"
family = "growup"
address = ""
trace = false
debug = false
spy = 500
[ratio]
hour = 3
sleep = 500
num = 1000
limit = 5000
[income]
hour = 0
sleep = 500
num = 1000
[log]
dir = "/data/log/growup-job/"
[mysql]
[mysql.growup]
addr = "172.16.33.205:3307"
dsn = "growup:test@tcp(172.16.33.205:3307)/bilibili_business_up?timeout=10s&readTimeout=50s&writeTimeout=50s&parseTime=true&loc=Local&charset=utf8,utf8mb4"
active = 30
idle = 2
idleTimeout = "4h"
queryTimeout = "10s"
execTimeout = "100s"
tranTimeout = "100s"
[mysql.growup.breaker]
window = "3s"
sleep = "100ms"
bucket = 10
ratio = 0.5
request = 100
[mysql.allowance]
addr = "172.16.0.148:3306"
dsn = "test:test@tcp(172.16.0.148:3306)/bilibili_business_up_cooperate?timeout=5s&readTimeout=5s&writeTimeout=5s&parseTime=true&loc=Local&charset=utf8,utf8mb4"
active = 5
idle = 2
idleTimeout = "4h"
queryTimeout = "200ms"
execTimeout = "200ms"
tranTimeout = "200ms"
[mysql.allowance.breaker]
window = "3s"
sleep = "100ms"
bucket = 10
ratio = 0.5
request = 100
[keySecret]
key = "a4bb50e6f2bc2e0f"
secret = "3507b8667a3d0b6c952013db2b635f3a"
[mail]
host = "smtp.exmail.qq.com"
port = 465
username = "2233@bilibili.com"
password = "2233"
# upincome and tag income mail
[[mail.send]]
type = 1
addr = ["2233@bilibili.com"]
# combine mail
[[mail.send]]
type = 2
addr = ["2233@bilibili.com"]
[[mail.send]]
type = 3
addr = ["2233@bilibili.com"]
[[mail.send]]
type = 4
addr = ["2233@bilibili.com"]
[host]
archive = "http://bili-search.bilibili.co"
videoType = "http://172.16.33.123:6328"
columnType = "https://api.bilibili.com/x/article/categories"
dataplatform = "http://berserker.bilibili.co"
columnAct = "https://www.bilibili.com/activity/likes/list/"
profit = "http://127.0.0.1:7410"
vc = "https://api.vc.bilibili.co"
porder = "http://archive.api.bilibili.co/videoup/porder/arc/list"
archives = "http://api.bilibili.co/x/internal/v2/archive/archives"
api = "http://api.bilibili.com"
[bm]
addr = "0.0.0.0:7414"
maxListen = 1000
timeout = "3600s"
[httpClient]
key = "c1a1cb2d89c33794"
secret = "dda47eeca111e03e6845017505baea13"
dial = "2s"
timeout = "3s"
keepAlive = "60s"
timer = 10
[httpClient.breaker]
window = "10s"
sleep = "100ms"
bucket = 10
ratio = 0.5
request = 100
[dpClient]
#key = "cadb2a78fef220e346ceb37a203b8bf3"
#secret = "91d6a8610b6d139f8901d8605c0f43d3"
key = "5dd53c7f7dd88b26c1de9273d9aff420"
secret = "3f0990c3c97fc096c80b5523266f44cf"
dial = "2s"
timeout = "3s"
keepAlive = "60s"
timer = 1000
[dpClient.breaker]
window = "10s"
sleep = "100ms"
bucket = 10
ratio = 0.5
request = 100
[hbase]
master = ""
meta = ""
dialTimeout = "1s"
readTimeout = "150ms"
readsTimeout = "600ms"
writeTimeout = "200ms"
writesTimeout = "600ms"
[hbase.zookeeper]
root = ""
addrs = ["10.23.58.154:2181","10.23.58.141:2181","10.23.58.20:2181"]
timeout = "30s"
[archiveSub]
key = "6f3331a8932e24a2"
secret = "4bfa38d3d836b677990ea2bc0a6892e4"
group = "Archive-MobileStudio-S"
topic = "Archive-T"
action = "sub"
offset = "old"
buffer = 128
name = "growup-job/sub"
proto = "tcp"
addr = "172.18.33.50:6205"
idle = 100
active = 100
dialTimeout = "1s"
readTimeout = "60s"
writeTimeout = "1s"
idleTimeout = "10s"
[bubble]
[[bubble.bRatio]]
bType = 1
ratio = 0.8
[[bubble.bRatio]]
bType = 2
ratio = 0.8

View File

@@ -0,0 +1,44 @@
package main
import (
"flag"
"os"
"os/signal"
"syscall"
"time"
"go-common/app/job/main/growup/conf"
"go-common/app/job/main/growup/http"
"go-common/library/log"
)
func main() {
flag.Parse()
if err := conf.Init(); err != nil {
panic(err)
}
log.Init(conf.Conf.Log)
log.Info("growup-job start")
http.Init(conf.Conf)
signalHandler()
}
func signalHandler() {
var ch = make(chan os.Signal, 1)
signal.Notify(ch, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT)
for {
si := <-ch
log.Info("growup-job get a signal %s", si.String())
switch si {
case syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGSTOP, syscall.SIGINT:
log.Info("get a signal %s, stop the consume process", si.String())
log.Info("growup-job [verison: %s] exit")
http.Close()
time.Sleep(time.Second)
return
case syscall.SIGHUP:
default:
return
}
}
}

View File

@@ -0,0 +1,29 @@
dates=("2017-06-01" "2017-07-01" "2017-08-01" "2017-09-01" "2017-10-01" "2017-11-01" "2017-12-01" "2018-01-01" "2018-02-01" "2018-03-01" "2018-04-01" "2018-05-01" "2018-06-01" "2018-07-01" "2018-08-01" "2018-09-01" "2018-10-01")
for date in ${dates[@]}
do
echo "start del $date"
curl -XPOST localhost:8000/x/internal/job/up-rating/score/del?date=$date
if [[ $? != 0 ]]; then
exit
fi
echo ------------\n
done
for date in ${dates[@]}
do
echo "start run $date"
for ((i=0;i<=22;i++)); do
echo "start run past $date", $i
curl -XPOST localhost:8000/x/internal/job/up-rating/past/score?date=$date
if [[ $? != 0 ]]; then
exit
fi
done
curl -XPOST localhost:8000/x/internal/job/up-rating/score?date=$date
if [[ $? != 0 ]]; then
exit
fi
echo ------------\n
done