Skip to content
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

Use local loopback worker from Python expansion services. #33645

Merged
merged 1 commit into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions sdks/python/apache_beam/transforms/environments.py
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,18 @@ def create_proto(
payload=beam_runner_api_pb2.AnyOfEnvironmentPayload(
environments=environments).SerializeToString())

def __hash__(self):
return sum(hash(env) for env in self._environments)

def __eq__(self, other):
return (
isinstance(other, AnyOfEnvironment) and
set(self._environments) == set(other._environments))

def to_runner_api(self, context):
return self.create_proto(
[env.to_runner_api(context) for env in self._environments])


class PyPIArtifactRegistry(object):
_registered_artifacts = set() # type: Set[Tuple[str, str]]
Expand Down
3 changes: 2 additions & 1 deletion sdks/python/apache_beam/yaml/yaml_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -1108,7 +1108,8 @@ def __enter__(self):
'{{PORT}}',
'--fully_qualified_name_glob=*',
'--pickle_library=cloudpickle',
'--requirements_file=' + os.path.join(venv + '-requirements.txt')
'--requirements_file=' + os.path.join(venv + '-requirements.txt'),
'--serve_loopback_worker',
])
self._service = self._service_provider.__enter__()
return self._service
Expand Down
Loading