modelRT/main.go

59 lines
1.4 KiB
Go
Raw Permalink Normal View History

// entry function
package main
import (
"context"
"flag"
2025-12-12 11:01:18 +08:00
"log"
"modelRT/app"
_ "modelRT/docs"
)
var (
modelRTConfigDir = flag.String("modelRT_config_dir", "./configs", "config file dir of model runtime service")
modelRTConfigName = flag.String("modelRT_config_name", "config", "config file name of model runtime service")
modelRTConfigType = flag.String("modelRT_config_type", "yaml", "config file type of model runtime service")
)
2025-10-20 15:06:23 +08:00
// @title ModelRT 实时模型服务 API 文档
// @version 1.0
// @description 实时数据计算和模型运行服务的 API 服务
//
// @contact.name douxu
// TODO 修改支持的文档地址
// @contact.url http://www.swagger.io/support
// @contact.email douxu@clea.com.cn
//
// @license.name Apache 2.0
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html
//
// @host localhost:8080
// @BasePath /api/v1
func main() {
flag.Parse()
ctx := context.Background()
cli := app.CLIArgs{
ConfigDir: *modelRTConfigDir,
ConfigName: *modelRTConfigName,
ConfigType: *modelRTConfigType,
2024-12-18 16:25:49 +08:00
}
application, cleanup, err := app.InitializeApp(ctx, cli)
if err != nil {
log.Fatalf("failed to initialize app: %v", err)
}
defer cleanup()
// warm caches from postgres, then start background publishers/worker
application.Warmup(ctx)
application.StartBackground(ctx)
// blocks until the server is shut down
application.Run(ctx)
}