You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/02/04 00:13:15 UTC

[GitHub] [beam] lostluck commented on a change in pull request #16710: [BEAM-13813] Add support for URL artifact to extractStagingToPath

lostluck commented on a change in pull request #16710:
URL: https://github.com/apache/beam/pull/16710#discussion_r799067602



##########
File path: sdks/go/pkg/beam/artifact/materialize.go
##########
@@ -150,6 +158,12 @@ func extractStagingToPath(artifact *pipepb.ArtifactInformation) (string, error)
 			return "", err
 		}
 		stagedName = generateId() + "-" + filepath.Base(ty.Path)
+	} else if artifact.TypeUrn == URNUrlArtifact {

Review comment:
       I imaging the mixing of requesting TypeUrn and RoleUrn in this if/else ladder is an artifact of legacy handling?

##########
File path: sdks/go/pkg/beam/artifact/materialize_test.go
##########
@@ -279,6 +360,8 @@ func (fake *fakeRetrievalService) ResolveArtifacts(ctx context.Context, request
 func (fake *fakeRetrievalService) GetArtifact(ctx context.Context, request *jobpb.GetArtifactRequest, opts ...grpc.CallOption) (jobpb.ArtifactRetrievalService_GetArtifactClient, error) {
 	if request.Artifact.TypeUrn == "resolved" {
 		return &fakeGetArtifactResponseStream{data: request.Artifact.TypePayload}, nil
+	} else if request.Artifact.TypeUrn == URNFileArtifact || request.Artifact.TypeUrn == URNUrlArtifact {
+		return &fakeGetArtifactResponseStream{data: request.Artifact.RolePayload}, nil
 	}
 	return nil, errors.Errorf("Unsupported artifact %v", request.Artifact)

Review comment:
       ```suggestion
   	switch request.Artifact.TypeUrn {
   	case "resolved":
   		return &fakeGetArtifactResponseStream{data: request.Artifact.TypePayload}, nil
   	case URNFileArtifact, URNUrlArtifact:
   		return &fakeGetArtifactResponseStream{data: request.Artifact.RolePayload}, nil
   	default:
   		return nil, errors.Errorf("Unsupported artifact %v", request.Artifact)
   	}
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org