feat(cmd/joj3): run all commands concurrently in teapot (#66)
Reviewed-on: #66 Co-authored-by: Boming Zhang <bomingzh@sjtu.edu.cn> Co-committed-by: Boming Zhang <bomingzh@sjtu.edu.cn>
This commit is contained in:
		
							parent
							
								
									b75a756998
								
							
						
					
					
						commit
						03933412bb
					
				|  | @ -47,10 +47,10 @@ func Run(conf *conf.Conf) error { | ||||||
| 	} | 	} | ||||||
| 	var wg sync.WaitGroup | 	var wg sync.WaitGroup | ||||||
| 	var scoreboardErr, failedTableErr, issueErr error | 	var scoreboardErr, failedTableErr, issueErr error | ||||||
| 	wg.Add(2) | 	if !conf.Teapot.SkipScoreboard { | ||||||
| 	go func() { | 		wg.Add(1) | ||||||
| 		defer wg.Done() | 		go func() { | ||||||
| 		if !conf.Teapot.SkipScoreboard { | 			defer wg.Done() | ||||||
| 			err := execCommand("joint-teapot", []string{ | 			err := execCommand("joint-teapot", []string{ | ||||||
| 				"joj3-scoreboard", envFilePath, conf.Stage.OutputPath, actor, | 				"joj3-scoreboard", envFilePath, conf.Stage.OutputPath, actor, | ||||||
| 				conf.Teapot.GradingRepoName, repoName, runNumber, | 				conf.Teapot.GradingRepoName, repoName, runNumber, | ||||||
|  | @ -59,8 +59,12 @@ func Run(conf *conf.Conf) error { | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				scoreboardErr = err | 				scoreboardErr = err | ||||||
| 			} | 			} | ||||||
| 		} | 		}() | ||||||
| 		if !conf.Teapot.SkipFailedTable { | 	} | ||||||
|  | 	if !conf.Teapot.SkipFailedTable { | ||||||
|  | 		wg.Add(1) | ||||||
|  | 		go func() { | ||||||
|  | 			defer wg.Done() | ||||||
| 			err := execCommand("joint-teapot", []string{ | 			err := execCommand("joint-teapot", []string{ | ||||||
| 				"joj3-failed-table", envFilePath, conf.Stage.OutputPath, actor, | 				"joj3-failed-table", envFilePath, conf.Stage.OutputPath, actor, | ||||||
| 				conf.Teapot.GradingRepoName, repoName, runNumber, | 				conf.Teapot.GradingRepoName, repoName, runNumber, | ||||||
|  | @ -69,11 +73,12 @@ func Run(conf *conf.Conf) error { | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				failedTableErr = err | 				failedTableErr = err | ||||||
| 			} | 			} | ||||||
| 		} | 		}() | ||||||
| 	}() | 	} | ||||||
| 	go func() { | 	if !conf.Teapot.SkipIssue { | ||||||
| 		defer wg.Done() | 		wg.Add(1) | ||||||
| 		if !conf.Teapot.SkipIssue { | 		go func() { | ||||||
|  | 			defer wg.Done() | ||||||
| 			err := execCommand("joint-teapot", []string{ | 			err := execCommand("joint-teapot", []string{ | ||||||
| 				"joj3-create-result-issue", envFilePath, conf.Stage.OutputPath, | 				"joj3-create-result-issue", envFilePath, conf.Stage.OutputPath, | ||||||
| 				repoName, runNumber, conf.Name, actor, sha, | 				repoName, runNumber, conf.Name, actor, sha, | ||||||
|  | @ -81,8 +86,8 @@ func Run(conf *conf.Conf) error { | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				issueErr = err | 				issueErr = err | ||||||
| 			} | 			} | ||||||
| 		} | 		}() | ||||||
| 	}() | 	} | ||||||
| 	wg.Wait() | 	wg.Wait() | ||||||
| 	if scoreboardErr != nil || failedTableErr != nil || issueErr != nil { | 	if scoreboardErr != nil || failedTableErr != nil || issueErr != nil { | ||||||
| 		slog.Error("teapot exit", "scoreboardErr", scoreboardErr, | 		slog.Error("teapot exit", "scoreboardErr", scoreboardErr, | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user