-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Improve logging in boot.go to facilitate future triaging #38342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -183,12 +183,17 @@ func launchSDKProcess() error { | |
| if err != nil { | ||
| logger.Fatalf(ctx, "Failed to convert pipeline options: %v", err) | ||
| } | ||
| logger.Printf(ctx, "PipelineOptions=%v", options) | ||
|
|
||
| experiments := getExperiments(options) | ||
| logger.Printf(ctx, "Experiments=%v", experiments) | ||
|
|
||
| pipNoBuildIsolation = false | ||
| if slices.Contains(experiments, "pip_no_build_isolation") { | ||
| pipNoBuildIsolation = true | ||
| logger.Printf(ctx, "Disabled build isolation when installing packages with pip") | ||
| logger.Printf(ctx, "Build isolation disabled when installing packages with pip") | ||
| } else { | ||
| logger.Printf(ctx, "Build isolation enabled when installing packages with pip") | ||
| } | ||
|
|
||
| // (2) Retrieve and install the staged packages. | ||
|
|
@@ -408,6 +413,10 @@ func installSetupPackages(ctx context.Context, logger *tools.Logger, files []str | |
| bufLogger := tools.NewBufferedLogger(logger) | ||
| bufLogger.Printf(ctx, "Installing setup packages ...") | ||
|
|
||
| if err := logRuntimeDependencies(ctx, bufLogger, "pre-installation"); err != nil { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the use-case for this?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While we already log dependencies after installation, Adding a pre-installation call ensures we capture the environment state regardless of whether the installation succeeds. This is useful for reproducing and triaging environment-specific failures from customers.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 'pre-installation', 'post-installation' sounds a bit cryptic for end user who is not a beam dev, and the output may be a a bit verbose. How about we think of a way to enable debug logging for boot.go and only print pre-installation env if debug logging is enabled? then, we can ask affected customers to run their pipeline with debug logging enabled if necessary.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The new logs only add 4 lines and are already emitted at the DEBUG level, which allows users to filter them out as needed. Given this minimal footprint, I’d prefer to avoid adding complexity of a new configuration mechanism or flag in
I used the term "installation" because of the line of "Installing setup packages ..." prior to these logs (see above screenshot too), but I am open to any better term.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sg, thanks!
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i do think that the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps we could change logs to the below:
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great. I made the change to use "initial runtime environmemnt" and "final runtime environment". I also included some small edits to existing messages to make them consistent and concise. PTAL |
||
| bufLogger.Printf(ctx, "couldn't fetch the runtime python dependencies: %v", err) | ||
| } | ||
|
|
||
| // Install the Dataflow Python SDK if one was staged. In released | ||
| // container images, SDK is already installed, but can be overriden | ||
| // using the --sdk_location pipeline option. | ||
|
|
@@ -432,7 +441,7 @@ func installSetupPackages(ctx context.Context, logger *tools.Logger, files []str | |
| if err := pipInstallPackage(ctx, logger, files, workDir, workflowFile, false, true, nil); err != nil { | ||
| return fmt.Errorf("failed to install workflow: %v", err) | ||
| } | ||
| if err := logRuntimeDependencies(ctx, bufLogger); err != nil { | ||
| if err := logRuntimeDependencies(ctx, bufLogger, "post-installation"); err != nil { | ||
| bufLogger.Printf(ctx, "couldn't fetch the runtime python dependencies: %v", err) | ||
| } | ||
| if err := logSubmissionEnvDependencies(ctx, bufLogger, workDir); err != nil { | ||
|
|
@@ -485,20 +494,20 @@ func processArtifactsInSetupOnlyMode() { | |
|
|
||
| // logRuntimeDependencies logs the python dependencies | ||
| // installed in the runtime environment. | ||
| func logRuntimeDependencies(ctx context.Context, bufLogger *tools.BufferedLogger) error { | ||
| func logRuntimeDependencies(ctx context.Context, bufLogger *tools.BufferedLogger, phase string) error { | ||
| pythonVersion, err := expansionx.GetPythonVersion() | ||
| if err != nil { | ||
| return err | ||
| } | ||
| bufLogger.Printf(ctx, "Using Python version:") | ||
| bufLogger.Printf(ctx, "Using Python version (%s):", phase) | ||
| args := []string{"--version"} | ||
| if err := execx.ExecuteEnvWithIO(nil, os.Stdin, bufLogger, bufLogger, pythonVersion, args...); err != nil { | ||
| bufLogger.FlushAtError(ctx) | ||
| } else { | ||
| bufLogger.FlushAtDebug(ctx) | ||
| } | ||
| bufLogger.Printf(ctx, "Logging runtime dependencies:") | ||
| args = []string{"-m", "pip", "freeze"} | ||
| bufLogger.Printf(ctx, "Logging runtime dependencies (%s):", phase) | ||
| args = []string{"-m", "pip", "freeze", "--all"} | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The argument |
||
| if err := execx.ExecuteEnvWithIO(nil, os.Stdin, bufLogger, bufLogger, pythonVersion, args...); err != nil { | ||
| bufLogger.FlushAtError(ctx) | ||
| } else { | ||
|
|
||

Uh oh!
There was an error while loading. Please reload this page.