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 2020/04/22 18:03:34 UTC

[GitHub] [beam] robertwb commented on a change in pull request #11490: [BEAM-9577] Use new artifact API to stage go artifacts.

robertwb commented on a change in pull request #11490:
URL: https://github.com/apache/beam/pull/11490#discussion_r413201320



##########
File path: sdks/go/pkg/beam/runners/universal/runnerlib/stage.go
##########
@@ -17,27 +17,127 @@ package runnerlib
 
 import (
 	"context"
+	"io"
+	"os"
 	"time"
 
 	"github.com/apache/beam/sdks/go/pkg/beam/artifact"
+	"github.com/apache/beam/sdks/go/pkg/beam/core/runtime/graphx"
 	"github.com/apache/beam/sdks/go/pkg/beam/internal/errors"
 	jobpb "github.com/apache/beam/sdks/go/pkg/beam/model/jobmanagement_v1"
 	"github.com/apache/beam/sdks/go/pkg/beam/util/grpcx"
+	"google.golang.org/grpc"
 )
 
 // Stage stages the worker binary and any additional files to the given
 // artifact staging endpoint. It returns the retrieval token if successful.
-func Stage(ctx context.Context, id, endpoint, binary, st string, files ...artifact.KeyedFile) (retrievalToken string, err error) {
+func Stage(ctx context.Context, id, endpoint, binary, st string) (retrievalToken string, err error) {
 	ctx = grpcx.WriteWorkerID(ctx, id)
 	cc, err := grpcx.Dial(ctx, endpoint, 2*time.Minute)
 	if err != nil {
 		return "", errors.WithContext(err, "connecting to artifact service")
 	}
 	defer cc.Close()
 
+	err = StageViaPortableApi(ctx, cc, binary, st)
+
+	if err == nil {
+		return "", err
+	} else {

Review comment:
       To me it depends on whether it is "one of two+ options" (in which case an explicit else clause is clearer) or "exit early vs. fallback" (in which case not having the else is clearer). Removing the else clause for now; hopefully soon we'll be able to simply remove the fallback altogether. 




----------------------------------------------------------------
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.

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