Skip to content

Commit

Permalink
fix style
Browse files Browse the repository at this point in the history
  • Loading branch information
mfleader committed Nov 6, 2023
1 parent b9f6c9d commit b31aa00
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions workflow/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import (
)

const (
WORKFLOW_INPUT_KEY = "input"
WORKFLOW_STEPS_KEY = "steps"
WorkflowInputKey = "input"

Check warning on line 21 in workflow/workflow.go

View workflow job for this annotation

GitHub Actions / golangci-lint

exported: exported const WorkflowInputKey should have comment (or a comment on this block) or be unexported (revive)
WorkflowStepsKey = "steps"
)

// executableWorkflow is an implementation of the ExecutableWorkflow interface that provides a workflow you can actually
Expand Down Expand Up @@ -70,8 +70,8 @@ func (e *executableWorkflow) Execute(ctx context.Context, serializedInput any) (
config: e.config,
lock: &sync.Mutex{},
data: map[string]any{
WORKFLOW_INPUT_KEY: serializedInput,
WORKFLOW_STEPS_KEY: map[string]any{},
WorkflowInputKey: serializedInput,
WorkflowStepsKey: map[string]any{},
},
dag: e.dag.Clone(),
inputsNotified: make(map[string]struct{}, len(e.dag.ListNodes())),
Expand All @@ -92,14 +92,14 @@ func (e *executableWorkflow) Execute(ctx context.Context, serializedInput any) (
runnableStep := runnableStep
stepDataModel := map[string]any{}
for _, stage := range e.lifecycles[stepID].Stages {
steps := l.data[WORKFLOW_STEPS_KEY].(map[string]any)
steps := l.data[WorkflowStepsKey].(map[string]any)
if _, ok := steps[stepID]; !ok {
steps[stepID] = map[string]any{}
}
stages := steps[stepID].(map[string]any)
stages[stage.ID] = map[string]any{}
}
l.data[WORKFLOW_STEPS_KEY].(map[string]any)[stepID] = stepDataModel
l.data[WorkflowStepsKey].(map[string]any)[stepID] = stepDataModel

var stageHandler step.StageChangeHandler = &stageChangeHandler{
onStageChange: func(
Expand Down Expand Up @@ -156,7 +156,7 @@ func (e *executableWorkflow) Execute(ctx context.Context, serializedInput any) (
// We remove the input node from the DAG and call the notifySteps function once to trigger the workflow
// start.
e.logger.Debugf("Starting workflow execution...\n%s", l.dag.Mermaid())
inputNode, err := l.dag.GetNodeByID(WORKFLOW_INPUT_KEY)
inputNode, err := l.dag.GetNodeByID(WorkflowInputKey)
if err != nil {
return "", nil, fmt.Errorf("bug: cannot obtain input node (%w)", err)
}
Expand Down Expand Up @@ -307,8 +307,8 @@ func (l *loopState) onStageComplete(stepID string, previousStage *string, previo
}

// Placing data from the output into the general data structure
l.data[WORKFLOW_STEPS_KEY].(map[string]any)[stepID].(map[string]any)[*previousStage] = map[string]any{}
l.data[WORKFLOW_STEPS_KEY].(map[string]any)[stepID].(map[string]any)[*previousStage].(map[string]any)[*previousStageOutputID] = *previousStageOutput
l.data[WorkflowStepsKey].(map[string]any)[stepID].(map[string]any)[*previousStage] = map[string]any{}
l.data[WorkflowStepsKey].(map[string]any)[stepID].(map[string]any)[*previousStage].(map[string]any)[*previousStageOutputID] = *previousStageOutput
}
l.notifySteps()
}
Expand Down

0 comments on commit b31aa00

Please sign in to comment.