Skip to content

Add helpers to interact with pipeline options in boot entrypoints - #39595

Draft
tvalentyn wants to merge 1 commit into
apache:masterfrom
tvalentyn:profiler_options_2
Draft

Add helpers to interact with pipeline options in boot entrypoints#39595
tvalentyn wants to merge 1 commit into
apache:masterfrom
tvalentyn:profiler_options_2

Conversation

@tvalentyn

@tvalentyn tvalentyn commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Depending on the runner, the pipeline options payload retrieved from the Provisioning API (info.GetPipelineOptions()) is structured in two different formats.

Dataflow runner produces the proto that looks like the following :


pipeline_options: {
  fields: {
    key: "display_data"
    value: {
      list_value: {
        values: {
          struct_value: {
            fields: {key: "key" value: {string_value: "runner"}}
            fields: {key: "namespace" value: {string_value: "apache_beam.options.pipeline_options.PipelineOptions"}}
            ...
          }
        }
      }
    }
  }
  fields: {
    key: "options"
    value: {
      struct_value: {
        fields: {key: "allow_non_deterministic_key_coders" value: {bool_value: false}}
        fields: {key: "allow_unsafe_triggers" value: {bool_value: false}}
        ...
      }
    }
  }
}

Portable Runner on the other hand has the following structure with keys having certain prefix and suffiix surrounding the option name

pipeline_options: {
  fields: {
    key: "beam:option:allow_non_deterministic_key_coders:v1"
    value: {bool_value: false}
  }
  fields: {
    key: "beam:option:allow_non_restored_state:v1"
    value: {bool_value: false}
  }
  ...
}

Go prism runner additionally adds go_options:

fields: {
  key: "beam:option:app_name:v1"
  value: {string_value: "go-job-1-1785853522137459029"}
}

fields: {
  key: "beam:option:experiments:v1"
  value: {
    list_value: {
      values: {string_value: "a=b"}
      values: {string_value: "c=d"}
      ...
    }
  }
}

fields: {
  key: "beam:option:go_options:v1"
  value: {
    struct_value: {
      fields: {
        key: "options"
        value: {
          struct_value: {
            fields: {key: "experiments" value: {string_value: "a=b,c=d"}}
            fields: {key: "runner" value: {string_value: "universal"}}
            fields: {key: "endpoint" value: {string_value: "localhost:8073"}}
            ...
          }
        }
      }
    }
  }
}

fields: {
  key: "beam:option:parallelism:v1"
  value: {number_value: -1}
}

fields: {
  key: "beam:option:retain_docker_containers:v1"
  value: {bool_value: false}
}

fields: {
  key: "beam:option:runner:v1"
  value: {string_value: ""}
}

Go Dataflow runner uses both go_options and options, where some pipeline options passed on the command line,are passed in go_options but not in top-level pipeline_options.options, for example dataflow_service_options is nested under go_options->dataflow_service_options , but not present otherwise:

fields: {
  key: "beam:option:go_options:v1"
  value: {
    struct_value: {
      fields: {
        key: "options"
        value: {
          struct_value: {
            fields: {key: "dataflow_service_options" value: {string_value: "enable_google_cloud_profiler=go-dataflow-profiler-test"}}
            fields: {key: "experiments" value: {string_value: "use_unified_worker,beam_fn_api,use_runner_v2,use_portable_job_submission"}}
            fields: {key: "hookOrder" value: {string_value: "[\"default_remote_logging\"]"}}
            fields: {key: "hooks" value: {string_value: "{\"default_remote_logging\":null}"}}
            fields: {key: "output" value: {string_value: "gs://valentyn-test/output/wordcounts.txt"}}
            fields: {key: "temp_location" value: {string_value: "gs://valentyn-test/temp"}}
          }
        }
      }
    }
  }
}
fields: {
  key: "display_data"
  value: {
    list_value: {
      values: {
        struct_value: {
          fields: {key: "key" value: {string_value: "name"}}
          fields: {key: "namespace" value: {string_value: "options"}}
          fields: {key: "type" value: {string_value: "STRING"}}
          fields: {key: "value" value: {string_value: "go-job-1-1785855323233969192"}}
        }
      }
      values: {
        struct_value: {
          fields: {key: "key" value: {string_value: "experiments"}}
          fields: {key: "namespace" value: {string_value: "options"}}
          fields: {key: "type" value: {string_value: "STRING"}}
          fields: {key: "value" value: {string_value: "use_unified_worker,beam_fn_api,use_runner_v2,use_portable_job_submission"}}
        }
      }
      values: {
        struct_value: {
          fields: {key: "key" value: {string_value: "project"}}
          fields: {key: "namespace" value: {string_value: "options"}}
          fields: {key: "type" value: {string_value: "STRING"}}
          fields: {key: "value" value: {string_value: "apache-beam-testing"}}
        }
      }
      values: {
        struct_value: {
          fields: {key: "key" value: {string_value: "region"}}
          fields: {key: "namespace" value: {string_value: "options"}}
          fields: {key: "type" value: {string_value: "STRING"}}
          fields: {key: "value" value: {string_value: "us-central1"}}
        }
      }
      values: {
        struct_value: {
          fields: {key: "key" value: {string_value: "container_images"}}
          fields: {key: "namespace" value: {string_value: "options"}}
          fields: {key: "type" value: {string_value: "STRING"}}
          fields: {key: "value" value: {string_value: "gcr.io/apache-beam-testing/valentyn/beam_go_sdk:latest"}}
        }
      }
      values: {
        struct_value: {
          fields: {key: "key" value: {string_value: "temp_location"}}
          fields: {key: "namespace" value: {string_value: "options"}}
          fields: {key: "type" value: {string_value: "STRING"}}
          fields: {key: "value" value: {string_value: "gs://valentyn-test/temp"}}
        }
      }
      values: {
        struct_value: {
          fields: {key: "key" value: {string_value: "experiments"}}
          fields: {key: "namespace" value: {string_value: "go_options"}}
          fields: {key: "type" value: {string_value: "STRING"}}
          fields: {key: "value" value: {string_value: "use_unified_worker,beam_fn_api,use_runner_v2,use_portable_job_submission"}}
        }
      }
      values: {
        struct_value: {
          fields: {key: "key" value: {string_value: "hooks"}}
          fields: {key: "namespace" value: {string_value: "go_options"}}
          fields: {key: "type" value: {string_value: "STRING"}}
          fields: {key: "value" value: {string_value: "{\"default_remote_logging\":null}"}}
        }
      }
      values: {
        struct_value: {
          fields: {key: "key" value: {string_value: "hookOrder"}}
          fields: {key: "namespace" value: {string_value: "go_options"}}
          fields: {key: "type" value: {string_value: "STRING"}}
          fields: {key: "value" value: {string_value: "[\"default_remote_logging\"]"}}
        }
      }
      values: {
        struct_value: {
          fields: {key: "key" value: {string_value: "dataflow_service_options"}}
          fields: {key: "namespace" value: {string_value: "go_options"}}
          fields: {key: "type" value: {string_value: "STRING"}}
          fields: {key: "value" value: {string_value: "enable_google_cloud_profiler=go-dataflow-profiler-test"}}
        }
      }
      values: {
        struct_value: {
          fields: {key: "key" value: {string_value: "output"}}
          fields: {key: "namespace" value: {string_value: "go_options"}}
          fields: {key: "type" value: {string_value: "STRING"}}
          fields: {key: "value" value: {string_value: "gs://valentyn-test/output/wordcounts.txt"}}
        }
      }
      values: {
        struct_value: {
          fields: {key: "key" value: {string_value: "temp_location"}}
          fields: {key: "namespace" value: {string_value: "go_options"}}
          fields: {key: "type" value: {string_value: "STRING"}}
          fields: {key: "value" value: {string_value: "gs://valentyn-test/temp"}}
        }
      }
    }
  }
}
fields: {
  key: "options"
  value: {
    struct_value: {
      fields: {key: "autoscalingAlgorithm" value: {string_value: "NONE"}}
      fields: {key: "dataflowJobId" value: {string_value: "2026-08-04_07_55_35-6481154492393283408"}}
      fields: {key: "diskProvisionedIops" value: {number_value: 0}}
      fields: {key: "diskProvisionedThroughputMibps" value: {number_value: 0}}
      fields: {
        key: "experiments"
        value: {
          list_value: {
            values: {string_value: "use_unified_worker"}
            values: {string_value: "beam_fn_api"}
            values: {string_value: "use_runner_v2"}
            values: {string_value: "use_portable_job_submission"}
            values: {string_value: "enable_worker_container_image_prepull"}
            values: {string_value: "enable_always_on_exception_sampling"}
            values: {string_value: "disable_staged_file_integrity_checks"}
          }
        }
      }
      fields: {key: "gcpTempLocation" value: {string_value: "gs://valentyn-test/temp"}}
      fields: {key: "jobId" value: {string_value: "2026-08-04_07_55_35-6481154492393283408"}}
      fields: {key: "maxNumWorkers" value: {number_value: 0}}
      fields: {key: "numWorkers" value: {number_value: 1}}
      fields: {key: "pipelineProtoHash" value: {string_value: "f3ba7fd4407f5e98f576fbd15254e4d0073331ef59d2757a3b7c87c021b3a689"}}
      fields: {key: "pipelineUrl" value: {string_value: "gs://valentyn-test/staging/go-1-1785855323357155711/model"}}
      fields: {key: "project" value: {string_value: "apache-beam-testing"}}
      fields: {key: "region" value: {string_value: "us-central1"}}
      fields: {key: "tempLocation" value: {string_value: "gs://valentyn-test/temp"}}
    }
  }
}

fixes: #39613


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Mention the appropriate issue in your description (for example: addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment fixes #<ISSUE NUMBER> instead.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests
Go tests

See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@codecov

codecov Bot commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 67.29858% with 69 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.15%. Comparing base (539b048) to head (694bd5d).
⚠️ Report is 19 commits behind head on master.

Files with missing lines Patch % Lines
sdks/go/container/tools/pipeline_options.go 80.80% 18 Missing and 6 partials ⚠️
sdks/python/container/boot.go 0.00% 15 Missing ⚠️
sdks/python/container/profiler.go 73.21% 9 Missing and 6 partials ⚠️
sdks/go/container/boot.go 0.00% 5 Missing ⚠️
sdks/java/container/boot.go 0.00% 5 Missing ⚠️
sdks/typescript/container/boot.go 0.00% 5 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #39595      +/-   ##
============================================
- Coverage     58.16%   58.15%   -0.02%     
  Complexity    13085    13085              
============================================
  Files          2521     2520       -1     
  Lines        264530   264915     +385     
  Branches      10788    10788              
============================================
+ Hits         153876   154065     +189     
- Misses       104879   105063     +184     
- Partials       5775     5787      +12     
Flag Coverage Δ
go 28.85% <67.29%> (+0.10%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tvalentyn
tvalentyn force-pushed the profiler_options_2 branch from 694bd5d to 99596c1 Compare August 4, 2026 13:44
@tvalentyn tvalentyn changed the title Option unfication Add helpers to interact with pipeline options in boot entrypoints Aug 4, 2026
@tvalentyn
tvalentyn marked this pull request as ready for review August 4, 2026 13:46
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@tvalentyn

Copy link
Copy Markdown
Contributor Author

R: @shunping who is familiar with the issue, @jrmccluskey for any golang feedback -- thanks!

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control. If you'd like to restart, comment assign set of reviewers

@tvalentyn
tvalentyn marked this pull request as draft August 4, 2026 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Profiler instrumentation ignores profiler-related options on portable runners

1 participant