Skip to content

Commit

Permalink
fix: group all the non-iterator activities under TriggerFromAPI condi…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
jvallesm committed Nov 15, 2024
1 parent e0db95c commit 40dde1e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 20 deletions.
4 changes: 2 additions & 2 deletions pkg/worker/minioactivity.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (w *worker) UploadInputsToMinioActivity(ctx context.Context, param *UploadI

func (w *worker) UploadRecipeToMinioActivity(ctx context.Context, param *UploadRecipeToMinioActivityParam) error {
log := w.log.With(zap.String("PipelineTriggerUID", param.PipelineTriggerID))
log.Info("UploadReceiptToMinioActivity started")
log.Info("UploadRecipeToMinioActivity started")

wfm, err := w.memoryStore.GetWorkflowMemory(ctx, param.PipelineTriggerID)
if err != nil {
Expand Down Expand Up @@ -116,7 +116,7 @@ func (w *worker) UploadRecipeToMinioActivity(ctx context.Context, param *UploadR
return err
}

log.Info("UploadReceiptToMinioActivity finished")
log.Info("UploadRecipeToMinioActivity finished")
return nil
}

Expand Down
33 changes: 15 additions & 18 deletions pkg/worker/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,26 +250,23 @@ func (w *worker) TriggerPipelineWorkflow(ctx workflow.Context, param *TriggerPip
}).Get(ctx, nil); err != nil {
return err
}
}

err := workflow.ExecuteActivity(minioCtx, w.UploadInputsToMinioActivity, &UploadInputsToMinioActivityParam{
PipelineTriggerID: param.SystemVariables.PipelineTriggerID,
ExpiryRuleTag: param.SystemVariables.ExpiryRuleTag,
}).Get(ctx, nil)
if err != nil {
logger.Error("Failed to upload pipeline run input", zap.Error(err))
}
err := workflow.ExecuteActivity(minioCtx, w.UploadInputsToMinioActivity, &UploadInputsToMinioActivityParam{
PipelineTriggerID: param.SystemVariables.PipelineTriggerID,
ExpiryRuleTag: param.SystemVariables.ExpiryRuleTag,
}).Get(ctx, nil)
if err != nil {
logger.Error("Failed to upload pipeline run input", zap.Error(err))
}

err = workflow.ExecuteActivity(minioCtx, w.UploadRecipeToMinioActivity, &UploadRecipeToMinioActivityParam{
PipelineTriggerID: param.SystemVariables.PipelineTriggerID,
ExpiryRuleTag: param.SystemVariables.ExpiryRuleTag,
}).Get(ctx, nil)
if err != nil {
logger.Error("Failed to upload pipeline run recipe", zap.Error(err))
}
err = workflow.ExecuteActivity(minioCtx, w.UploadRecipeToMinioActivity, &UploadRecipeToMinioActivityParam{
PipelineTriggerID: param.SystemVariables.PipelineTriggerID,
ExpiryRuleTag: param.SystemVariables.ExpiryRuleTag,
}).Get(ctx, nil)
if err != nil {
logger.Error("Failed to upload pipeline run recipe", zap.Error(err))
}

// TODO group everything under condition
if param.TriggerFromAPI {
if err := workflow.ExecuteActivity(ctx, w.InitComponentsActivity, &InitComponentsActivityParam{
WorkflowID: workflowID,
SystemVariables: param.SystemVariables,
Expand All @@ -283,7 +280,7 @@ func (w *worker) TriggerPipelineWorkflow(ctx workflow.Context, param *TriggerPip
}

dagData := &LoadDAGDataActivityResult{}
err = workflow.ExecuteActivity(ctx, w.LoadDAGDataActivity, workflowID).Get(ctx, dagData)
err := workflow.ExecuteActivity(ctx, w.LoadDAGDataActivity, workflowID).Get(ctx, dagData)
if err != nil {
logger.Error("Failed to load DAG", zap.Error(err))
}
Expand Down

0 comments on commit 40dde1e

Please sign in to comment.