Skip to content

Commit

Permalink
debug: to be removed. Just for debug
Browse files Browse the repository at this point in the history
  • Loading branch information
oysteingraendsen committed May 10, 2023
1 parent 5f4f9cf commit 89d5731
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
8 changes: 4 additions & 4 deletions server/events/apply_command_runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -437,12 +437,12 @@ func TestApplyCommandRunner_ExecutionOrder(t *testing.T) {
Description: "Don't block when abortOnExcecutionOrderFail is not set",
ProjectContexts: []command.ProjectContext{
{
ExecutionOrderGroup: 0,
ProjectName: "First",
ExecutionOrderGroup: 0,
ProjectName: "First",
},
{
ExecutionOrderGroup: 1,
ProjectName: "Second",
ExecutionOrderGroup: 1,
ProjectName: "Second",
},
},
ProjectResults: []command.ProjectResult{
Expand Down
2 changes: 1 addition & 1 deletion server/events/policy_check_command_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (p *PolicyCheckCommandRunner) Run(ctx *command.Context, cmds []command.Proj
var result command.Result
if p.isParallelEnabled(cmds) {
ctx.Log.Info("Running policy_checks in parallel")
result = runProjectCmdsParallel(cmds, p.prjCmdRunner.PolicyCheck, p.parallelPoolSize)
result = runProjectCmdsParallel(ctx, cmds, p.prjCmdRunner.PolicyCheck, p.parallelPoolSize)
} else {
result = runProjectCmds(cmds, p.prjCmdRunner.PolicyCheck)
}
Expand Down
5 changes: 4 additions & 1 deletion server/events/project_command_pool_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ import (
type prjCmdRunnerFunc func(ctx command.ProjectContext) command.ProjectResult

func runProjectCmdsParallel(
ctx *command.Context,
cmds []command.ProjectContext,
runnerFunc prjCmdRunnerFunc,
poolSize int,
) command.Result {
var results []command.ProjectResult
mux := &sync.Mutex{}
ctx.Log.Info("DEBUG: in runProjectCmdsParallelGroups")

wg := sizedwaitgroup.New(poolSize)
for _, pCmd := range cmds {
Expand Down Expand Up @@ -77,10 +79,11 @@ func runProjectCmdsParallelGroups(
runnerFunc prjCmdRunnerFunc,
poolSize int,
) command.Result {
ctx.Log.Info("DEBUG: in runProjectCmdsParallelGroups")
var results []command.ProjectResult
groups := splitByExecutionOrderGroup(cmds)
for _, group := range groups {
res := runProjectCmdsParallel(group, runnerFunc, poolSize)
res := runProjectCmdsParallel(ctx, group, runnerFunc, poolSize)
results = append(results, res.ProjectResults...)
if res.HasErrors() && group[0].AbortOnExcecutionOrderFail {
ctx.Log.Info("abort on execution order when failed")
Expand Down

0 comments on commit 89d5731

Please sign in to comment.