beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Work logged] (BEAM-3287) Go SDK support for portable pipelines
Date Mon, 19 Mar 2018 18:27:01 GMT

     [ https://issues.apache.org/jira/browse/BEAM-3287?focusedWorklogId=81951&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-81951
]

ASF GitHub Bot logged work on BEAM-3287:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 19/Mar/18 18:26
            Start Date: 19/Mar/18 18:26
    Worklog Time Spent: 10m 
      Work Description: lostluck commented on a change in pull request #4888: [BEAM-3287]
Add Go support for universal runners, incl Flink
URL: https://github.com/apache/beam/pull/4888#discussion_r175537965
 
 

 ##########
 File path: sdks/go/pkg/beam/runners/universal/runnerlib/job.go
 ##########
 @@ -0,0 +1,140 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package runnerlib
+
+import (
+	"context"
+	"fmt"
+	"io"
+
+	"github.com/apache/beam/sdks/go/pkg/beam"
+	"github.com/apache/beam/sdks/go/pkg/beam/core/runtime"
+	"github.com/apache/beam/sdks/go/pkg/beam/log"
+	jobpb "github.com/apache/beam/sdks/go/pkg/beam/model/jobmanagement_v1"
+	pb "github.com/apache/beam/sdks/go/pkg/beam/model/pipeline_v1"
+	"github.com/apache/beam/sdks/go/pkg/beam/provision"
+	"github.com/golang/protobuf/proto"
+)
+
+// JobOptions capture the various options for submitting jobs
+// to universal runners.
+type JobOptions struct {
+	// Name is the job name.
+	Name string
+	// Experiments are additional experiments.
+	Experiments []string
+
+	// TODO(herohde) 3/17/2018: add further parametrization as needed
+
+	// InternalJavaRunner is the class of the receiving Java runner. To be removed.
+	InternalJavaRunner string
+}
+
+// Prepare prepares a job to the given endpoint. It returns an id and endpoint, if successful.
+func Prepare(ctx context.Context, client jobpb.JobServiceClient, p *pb.Pipeline, opt *JobOptions)
(string, string, error) {
+	raw := runtime.RawOptionsWrapper{
+		Options:     beam.PipelineOptions.Export(),
+		Runner:      opt.InternalJavaRunner,
+		AppName:     opt.Name,
+		Experiments: append(opt.Experiments, "beam_fn_api"),
+	}
+
+	options, err := provision.OptionsToProto(raw)
+	if err != nil {
+		return "", "", fmt.Errorf("failed to produce pipeline options: %v", err)
+	}
+	req := &jobpb.PrepareJobRequest{
+		Pipeline:        p,
+		PipelineOptions: options,
+		JobName:         opt.Name,
+	}
+	resp, err := client.Prepare(ctx, req)
+	if err != nil {
+		return "", "", fmt.Errorf("failed to connect to job service: %v", err)
+	}
+	return resp.GetPreparationId(), resp.GetArtifactStagingEndpoint().GetUrl(), nil
+}
+
+// Submit submits a job to the given endpoint. It returns a jobID, if successful.
 
 Review comment:
   If we change the comment on Prepare, we should probably change "given endpoint" here to
"given Beam model runner" for consistency.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


Issue Time Tracking
-------------------

    Worklog Id:     (was: 81951)
    Time Spent: 0.5h  (was: 20m)

> Go SDK support for portable pipelines
> -------------------------------------
>
>                 Key: BEAM-3287
>                 URL: https://issues.apache.org/jira/browse/BEAM-3287
>             Project: Beam
>          Issue Type: Improvement
>          Components: sdk-go
>            Reporter: Henning Rohde
>            Assignee: Henning Rohde
>            Priority: Major
>              Labels: portability
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> The Go SDK should participate in the portability framework, incl. job submission w/ a
docker container image.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message