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

[BEAM-8613] Add environment variable support to Docker environment #10064

Closed
wants to merge 1 commit into from

Conversation

nrusch
Copy link

@nrusch nrusch commented Nov 11, 2019

This extends the Docker environment to support passing a JSON configuration string, similar to the Process and External environments, in order to facilitate the passing of environment variables to the docker runtime. As part of this change, the DockerPayload grows a new env map field.

If a JSON configuration string is used to construct a Docker environment, it must include a docker_image key, and can optionally include an env sub-object representing an environment variable map. These variables will be forwarded to the docker command via --env flags.


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

  • Choose reviewer(s) and mention them in a comment (R: @username).
  • Format the pull request title like [BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replace BEAM-XXX with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.
  • 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.

Post-Commit Tests Status (on master branch)

Lang SDK Apex Dataflow Flink Gearpump Samza Spark
Go Build Status --- --- Build Status --- --- Build Status
Java Build Status Build Status Build Status Build Status
Build Status
Build Status
Build Status Build Status Build Status
Build Status
Python Build Status
Build Status
Build Status
Build Status
--- Build Status
Build Status
Build Status
Build Status
--- --- Build Status
XLang --- --- --- Build Status --- --- ---

Pre-Commit Tests Status (on master branch)

--- Java Python Go Website
Non-portable Build Status Build Status
Build Status
Build Status Build Status
Portable --- Build Status --- ---

See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.

@@ -138,20 +145,33 @@ def __hash__(self):
return hash((self.__class__, self.container_image))

def __repr__(self):
return 'DockerEnvironment(container_image=%s)' % self.container_image
return 'DockerEnvironment(container_image=%s,env=%s)' % (
Copy link
Contributor

Choose a reason for hiding this comment

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

space after the comma, I think

Copy link
Author

Choose a reason for hiding this comment

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

I was matching the prevailing style of ProcessEnvironment and ExternalEnvironment.

sdks/python/apache_beam/transforms/environments.py Outdated Show resolved Hide resolved
@@ -203,7 +223,7 @@ def from_runner_api_parameter(payload, context):
def from_options(cls, options):
config = json.loads(options.environment_config)
return cls(config.get('command'), os=config.get('os', ''),
arch=config.get('arch', ''), env=config.get('env', ''))
arch=config.get('arch', ''), env=config.get('env'))
Copy link
Contributor

Choose a reason for hiding this comment

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

yeah, I have a fix for this in my typing branch. fine to fix it here as long as the reviewers agree.

@chadrik
Copy link
Contributor

chadrik commented Nov 11, 2019

R: @robertwb
R: @lukecwik

@nrusch nrusch force-pushed the docker_payload_env_vars branch 2 times, most recently from c1a438c to 760e038 Compare November 12, 2019 21:17
This allows the environment config to be specific as a JSON string,
in which case an optional map of environment variables can be included,
and will be passed along to the container runtime via `--env=` flags.
@nrusch
Copy link
Author

nrusch commented Nov 19, 2019

Rebased to current master.

@stale
Copy link

stale bot commented Jan 19, 2020

This pull request has been marked as stale due to 60 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@beam.apache.org list. Thank you for your contributions.

@stale stale bot added the stale label Jan 19, 2020
@stale
Copy link

stale bot commented Jan 26, 2020

This pull request has been closed due to lack of activity. If you think that is incorrect, or the pull request requires review, you can revive the PR at any time.

@stale stale bot closed this Jan 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants