Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve logging when operator failed before generating artifact #1252

Merged
merged 5 commits into from
Apr 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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