Skip to content

Commit

Permalink
Improve logging when operator failed before generating artifact (#1252)
Browse files Browse the repository at this point in the history
  • Loading branch information
likawind authored Apr 28, 2023
1 parent 7c75d66 commit 09d55b6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/golang/lib/engine/aq_engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -1005,6 +1005,10 @@ func (eng *aqEngine) execute(
// and check operators with warning severity.
if execState.HasBlockingFailure() {
log.Infof("Stopping execution of operator %v", op.ID())
if execState.Error != nil {
log.Infof("Reason: %s", execState.Error.Message())
}

for id, dagOp := range workflowDag.Operators() {
log.Infof("Checking status of operator %v", id)
// Skip if this operator has already been completed or is in progress.
Expand Down
11 changes: 9 additions & 2 deletions src/golang/lib/workflow/artifact/artifact.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,14 @@ func (a *ArtifactImpl) updateArtifactResultAfterComputation(
execState *shared.ExecutionState,
) {
changes := map[string]interface{}{
models.ArtifactResultMetadata: nil,
models.ArtifactResultStatus: execState.Status,
models.ArtifactResultExecState: execState,
models.ArtifactResultMetadata: nil,
}

if a.Computed(ctx) {
metadataExists := utils.ObjectExistsInStorage(ctx, a.storageConfig, a.execPaths.ArtifactMetadataPath)

if a.Computed(ctx) && metadataExists {
var artifactResultMetadata shared.ArtifactResultMetadata
err := utils.ReadFromStorage(
ctx,
Expand Down Expand Up @@ -322,6 +324,11 @@ func (a *ArtifactImpl) GetMetadata(ctx context.Context) (*shared.ArtifactResultM
return nil, nil
}

// If the path is not available, we assume the data is not available.
if !utils.ObjectExistsInStorage(ctx, a.storageConfig, a.execPaths.ArtifactMetadataPath) {
return nil, nil
}

var metadata shared.ArtifactResultMetadata
err := utils.ReadFromStorage(ctx, a.storageConfig, a.execPaths.ArtifactMetadataPath, &metadata)
if err != nil {
Expand Down
4 changes: 4 additions & 0 deletions src/golang/lib/workflow/utils/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ func CleanupStorageFiles(ctx context.Context, storageConfig *shared.StorageConfi
}

func ObjectExistsInStorage(ctx context.Context, storageConfig *shared.StorageConfig, path string) bool {
if path == "" {
return false
}

return storage.NewStorage(storageConfig).Exists(ctx, path)
}

Expand Down

0 comments on commit 09d55b6

Please sign in to comment.