feat(cmd/joj3): run all commands concurrently in teapot
All checks were successful
build / build (push) Successful in 1m26s
build / build (pull_request) Successful in 1m25s
build / trigger-build-image (push) Has been skipped
build / trigger-build-image (pull_request) Has been skipped

This commit is contained in:
张泊明518370910136 2024-10-17 23:13:23 -04:00 committed by 张泊明518370910136
parent b75a756998
commit c3c154d9b0

View File

@ -47,10 +47,10 @@ func Run(conf *conf.Conf) error {
}
var wg sync.WaitGroup
var scoreboardErr, failedTableErr, issueErr error
wg.Add(2)
if !conf.Teapot.SkipScoreboard {
wg.Add(1)
go func() {
defer wg.Done()
if !conf.Teapot.SkipScoreboard {
err := execCommand("joint-teapot", []string{
"joj3-scoreboard", envFilePath, conf.Stage.OutputPath, actor,
conf.Teapot.GradingRepoName, repoName, runNumber,
@ -59,8 +59,12 @@ func Run(conf *conf.Conf) error {
if err != nil {
scoreboardErr = err
}
}()
}
if !conf.Teapot.SkipFailedTable {
wg.Add(1)
go func() {
defer wg.Done()
err := execCommand("joint-teapot", []string{
"joj3-failed-table", envFilePath, conf.Stage.OutputPath, actor,
conf.Teapot.GradingRepoName, repoName, runNumber,
@ -69,11 +73,12 @@ func Run(conf *conf.Conf) error {
if err != nil {
failedTableErr = err
}
}
}()
}
if !conf.Teapot.SkipIssue {
wg.Add(1)
go func() {
defer wg.Done()
if !conf.Teapot.SkipIssue {
err := execCommand("joint-teapot", []string{
"joj3-create-result-issue", envFilePath, conf.Stage.OutputPath,
repoName, runNumber, conf.Name, actor, sha,
@ -81,8 +86,8 @@ func Run(conf *conf.Conf) error {
if err != nil {
issueErr = err
}
}
}()
}
wg.Wait()
if scoreboardErr != nil || failedTableErr != nil || issueErr != nil {
slog.Error("teapot exit", "scoreboardErr", scoreboardErr,