You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by lo...@apache.org on 2023/08/08 16:53:54 UTC

[beam] branch master updated: Add message for new prism users. (#27886)

This is an automated email from the ASF dual-hosted git repository.

lostluck pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/master by this push:
     new 07f32a26005 Add message for new prism users. (#27886)
07f32a26005 is described below

commit 07f32a26005b75eb7f60d9cbafcf99f0e461f1e7
Author: Robert Burke <lo...@users.noreply.github.com>
AuthorDate: Tue Aug 8 09:53:44 2023 -0700

    Add message for new prism users. (#27886)
    
    Co-authored-by: lostluck <13...@users.noreply.github.com>
---
 sdks/go/pkg/beam/testing/ptest/ptest.go | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/sdks/go/pkg/beam/testing/ptest/ptest.go b/sdks/go/pkg/beam/testing/ptest/ptest.go
index 0bca8c48ceb..e025ed7aade 100644
--- a/sdks/go/pkg/beam/testing/ptest/ptest.go
+++ b/sdks/go/pkg/beam/testing/ptest/ptest.go
@@ -19,6 +19,7 @@ package ptest
 import (
 	"context"
 	"flag"
+	"fmt"
 	"os"
 	"testing"
 
@@ -95,7 +96,17 @@ func MainCalled() bool {
 // Run runs a pipeline for testing. The semantics of the pipeline is expected
 // to be verified through passert.
 func Run(p *beam.Pipeline) error {
-	_, err := beam.Run(context.Background(), getRunner(), p)
+	r := getRunner()
+	_, err := beam.Run(context.Background(), r, p)
+	// Until a few versions from now (say, v2.56),
+	// if there's an error, and
+	// the runner is prism, and it was the set default runner, but not a manually specificed runner via the flag
+	// augment the error with instructions to switch back to the direct runner.
+	if err != nil && r == "prism" && r == defaultRunnerOverride && r != *Runner {
+		err = fmt.Errorf("%w\nerror may be due to Apache Beam Go's migration from the direct runner to the prism runner."+
+			" While the failure(s) should be fixed, you can continue to use the direct runner with this TestMain override:"+
+			" `func TestMain(m *testing.M) { ptest.MainWithDefault(m, \"direct\") }`", err)
+	}
 	return err
 }