feat: read sandbox conf
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
2f8604f647
commit
b608a22cfd
|
@ -10,9 +10,11 @@ import (
|
|||
)
|
||||
|
||||
type Conf struct {
|
||||
LogLevel int `default:"0"`
|
||||
OutputPath string `default:"joj3_result.json"`
|
||||
Stages []struct {
|
||||
SandboxExecServer string `default:"localhost:5051"`
|
||||
SandboxToken string `default:""`
|
||||
LogLevel int `default:"0"`
|
||||
OutputPath string `default:"joj3_result.json"`
|
||||
Stages []struct {
|
||||
Name string
|
||||
Executor struct {
|
||||
Name string
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"log/slog"
|
||||
"os"
|
||||
|
||||
_ "focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/executors"
|
||||
"focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/executors"
|
||||
_ "focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/parsers"
|
||||
"focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/stage"
|
||||
|
||||
|
@ -77,6 +77,7 @@ func main() {
|
|||
os.Exit(1)
|
||||
}
|
||||
setupSlog(conf)
|
||||
executors.InitWithConf(conf.SandboxExecServer, conf.SandboxToken)
|
||||
stages := generateStages(conf)
|
||||
defer stage.Cleanup()
|
||||
results := stage.Run(stages)
|
||||
|
|
|
@ -2,8 +2,13 @@ package executors
|
|||
|
||||
import (
|
||||
_ "focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/executors/dummy"
|
||||
_ "focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/executors/sandbox"
|
||||
"focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/executors/sandbox"
|
||||
)
|
||||
|
||||
// this file does nothing but imports to ensure all the init() functions
|
||||
// in the subpackages are called
|
||||
|
||||
// overwrite the default registered executors
|
||||
func InitWithConf(sandboxExecServer, sandboxToken string) {
|
||||
sandbox.InitWithConf(sandboxExecServer, sandboxToken)
|
||||
}
|
||||
|
|
|
@ -8,9 +8,17 @@ var name = "sandbox"
|
|||
|
||||
func init() {
|
||||
stage.RegisterExecutor(name, &Sandbox{
|
||||
// TODO: read from conf
|
||||
execServer: "localhost:5051",
|
||||
token: "",
|
||||
cachedMap: make(map[string]string),
|
||||
})
|
||||
}
|
||||
|
||||
// overwrite the default registered executor
|
||||
func InitWithConf(execServer, token string) {
|
||||
stage.RegisterExecutor(name, &Sandbox{
|
||||
execServer: execServer,
|
||||
token: token,
|
||||
cachedMap: make(map[string]string),
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user