Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

chamikaramj
Copy link
Contributor

@chamikaramj chamikaramj commented Apr 28, 2025

To preserve update compatibility, we avoid replacement if the an 'updateCompatibilityBeamVersion' with an old Beam version is provided.

This fixes #34767


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.

Copy link
Contributor

Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment assign set of reviewers

@chamikaramj chamikaramj force-pushed the beam_yaml_managed_kafka branch from b2787fd to 98de30b Compare April 28, 2025 06:29
Copy link
Contributor

Assigning reviewers. If you would like to opt out of this review, comment assign to next reviewer:

R: @shunping for label python.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

@chamikaramj
Copy link
Contributor Author

chamikaramj commented Apr 28, 2025

PreCommit_Yaml_Xlang_Direct seems to be perma-red: #32603

@chamikaramj
Copy link
Contributor Author

R: @ahmedabu98 @derrickaw

Copy link
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


ManagedReplacement = namedtuple(
'ManagedReplacement',
'underlying_transform_identifier update_compatibility_version')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'underlying_transform_identifier update_compatibility_version')
'underlying_transform_identifier, update_compatibility_version')

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

import apache_beam.dataframe.io
import apache_beam.io
import apache_beam.transforms.util
from apache_beam import ManagedReplacement
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious how this is getting imported from top-level apache_beam

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We include everything under the "transforms" package in the top level:

from apache_beam.transforms import *


compatibility_version_match = True
if self._managed_replacement and compatibility_version_match:
compat_version_match = not is_compat_version_prior_to(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use a clearer name than compat_version_match? Not sure if this means the SDK version is before or after the specified update_compatibility_version

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Comment on lines 181 to 182
if identifier in MANAGED_TRANSFORM_URN_TO_JAR_TARGET_MAPPING:
default_target = MANAGED_TRANSFORM_URN_TO_JAR_TARGET_MAPPING.get(identifier)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might as well simplify and throw an error if identifier is not in MANAGED_TRANSFORM_URN_TO_JAR_TARGET_MAPPING

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Contributor Author

@chamikaramj chamikaramj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. PTAL.


ManagedReplacement = namedtuple(
'ManagedReplacement',
'underlying_transform_identifier update_compatibility_version')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

import apache_beam.dataframe.io
import apache_beam.io
import apache_beam.transforms.util
from apache_beam import ManagedReplacement
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We include everything under the "transforms" package in the top level:

from apache_beam.transforms import *


compatibility_version_match = True
if self._managed_replacement and compatibility_version_match:
compat_version_match = not is_compat_version_prior_to(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Comment on lines 181 to 182
if identifier in MANAGED_TRANSFORM_URN_TO_JAR_TARGET_MAPPING:
default_target = MANAGED_TRANSFORM_URN_TO_JAR_TARGET_MAPPING.get(identifier)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@chamikaramj chamikaramj force-pushed the beam_yaml_managed_kafka branch from 8373652 to 03fb49c Compare April 29, 2025 18:08
@ahmedabu98
Copy link
Contributor

Failing test: AttributeError: module 'apache_beam.transforms.managed' has no attribute '_EXPANSION_SERVICE_JAR_TARGETS'

Comment on lines +69 to +72
_IO_EXPANSION_SERVICE_JAR_TARGET = "sdks:java:io:expansion-service:shadowJar"

_GCP_EXPANSION_SERVICE_JAR_TARGET = (
"sdks:java:io:google-cloud-platform:expansion-service:shadowJar")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe combine these in a list of "supported expansion jar targets" and replace this:

services_and_names = managed._EXPANSION_SERVICE_JAR_TARGETS

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@chamikaramj
Copy link
Contributor Author

PTAL.

@chamikaramj chamikaramj merged commit f3e0f6d into apache:master Apr 30, 2025
90 checks passed
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.

[Feature Request]: Automatically replace Beam YAML Kafka source/sink with managed I/O
2 participants