From 5e38decf9e723a385057131b01bbd33d8c60bda3 Mon Sep 17 00:00:00 2001 From: Jack McCluskey <34928439+jrmccluskey@users.noreply.github.com> Date: Fri, 29 Sep 2023 14:20:25 -0400 Subject: [PATCH] Add callout of PIP failures as unrecoverable, link to new documentation (#28743) --- sdks/python/container/piputil.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sdks/python/container/piputil.go b/sdks/python/container/piputil.go index 67488bdc39f7..1bafe422d457 100644 --- a/sdks/python/container/piputil.go +++ b/sdks/python/container/piputil.go @@ -32,6 +32,8 @@ import ( "github.com/apache/beam/sdks/v2/go/pkg/beam/util/execx" ) +const unrecoverableURL string = "https://beam.apache.org/documentation/sdks/python-unrecoverable-errors/index.html#pip-dependency-resolution-failures" + // pipInstallRequirements installs the given requirement, if present. func pipInstallRequirements(ctx context.Context, logger *tools.Logger, files []string, dir, name string) error { pythonVersion, err := expansionx.GetPythonVersion() @@ -56,7 +58,7 @@ func pipInstallRequirements(ctx context.Context, logger *tools.Logger, files []s err := execx.ExecuteEnvWithIO(nil, os.Stdin, bufLogger, bufLogger, pythonVersion, args...) if err != nil { bufLogger.FlushAtError(ctx) - return err + return fmt.Errorf("PIP failed to install dependencies, got %s. This error may be unrecoverable, see %s for more information", err, unrecoverableURL) } bufLogger.FlushAtDebug(ctx) return nil @@ -114,7 +116,7 @@ func pipInstallPackage(ctx context.Context, logger *tools.Logger, files []string err := execx.ExecuteEnvWithIO(nil, os.Stdin, bufLogger, bufLogger, pythonVersion, args...) if err != nil { bufLogger.FlushAtError(ctx) - return err + return fmt.Errorf("PIP failed to install dependencies, got %s. This error may be unrecoverable, see %s for more information", err, unrecoverableURL) } else { bufLogger.FlushAtDebug(ctx) } @@ -122,7 +124,7 @@ func pipInstallPackage(ctx context.Context, logger *tools.Logger, files []string err = execx.ExecuteEnvWithIO(nil, os.Stdin, bufLogger, bufLogger, pythonVersion, args...) if err != nil { bufLogger.FlushAtError(ctx) - return err + return fmt.Errorf("PIP failed to install dependencies, got %s. This error may be unrecoverable, see %s for more information", err, unrecoverableURL) } bufLogger.FlushAtDebug(ctx) return nil @@ -133,7 +135,7 @@ func pipInstallPackage(ctx context.Context, logger *tools.Logger, files []string err := execx.ExecuteEnvWithIO(nil, os.Stdin, bufLogger, bufLogger, pythonVersion, args...) if err != nil { bufLogger.FlushAtError(ctx) - return err + return fmt.Errorf("PIP failed to install dependencies, got %s. This error may be unrecoverable, see %s for more information", err, unrecoverableURL) } bufLogger.FlushAtDebug(ctx) return nil