-
Notifications
You must be signed in to change notification settings - Fork 710
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
Enable beam args to be populated from environment variables #4147
Closed
ConverJens
wants to merge
23
commits into
tensorflow:master
from
ConverJens:enable_beam_to_fetch_args_from_secrets
Closed
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
e1cd066
Added env var type and method to placeholder
ConverJens 708e24d
Initial draft of resolving beam args from env
ConverJens e70d854
Beam args can now be resolved from env when executen on KFP.
ConverJens ef40c1c
Moved logic to TFX Launcher to not be dependent on specific runners.
ConverJens 3d3b5c9
Reverted container_entrypoint.py and container_entrypoint_test.py.
ConverJens eb5d789
Fixed failing unit tests.
ConverJens a927160
Fixed failing proto unit tests.
ConverJens 5803f3d
Removed debug logging. Tested and works well in KFP.
ConverJens ccff7d0
Merge branch 'master' into enable_beam_to_fetch_args_from_secrets
kennethyang404 1f5fd95
Update from PR comments: Move logic from launcher to beam_executor_op…
ConverJens 3e727ce
Merge branch 'enable_beam_to_fetch_args_from_secrets' of github.com:C…
ConverJens 2707b8f
Merge branch 'master' into enable_beam_to_fetch_args_from_secrets
ConverJens 05420e3
Update from PR comments: Fix string handling and how to treat env var…
ConverJens 097a676
Fixed typo
ConverJens 86ad813
Merge branch 'tensorflow:master' into enable_beam_to_fetch_args_from_…
ConverJens aae2b55
Fixed linting.
ConverJens f9057ab
Merge branch 'tensorflow:master' into enable_beam_to_fetch_args_from_…
ConverJens 4e702c4
Merge branch 'tensorflow:master' into enable_beam_to_fetch_args_from_…
ConverJens e2dd8a7
Merge branch 'tensorflow:master' into enable_beam_to_fetch_args_from_…
ConverJens f593fb4
Merge branch 'tensorflow:master' into enable_beam_to_fetch_args_from_…
ConverJens 5f8ebd6
Merge branch 'master' into enable_beam_to_fetch_args_from_secrets
ConverJens f100a4b
Merge branch 'master' into enable_beam_to_fetch_args_from_secrets
ConverJens 2418f38
Merge branch 'tensorflow:master' into enable_beam_to_fetch_args_from_…
ConverJens File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,32 @@ message BeamExecutableSpec { | |
PythonClassExecutableSpec python_executor_spec = 1; | ||
// Args for Apache Beam pipeline. | ||
repeated string beam_pipeline_args = 2; | ||
// Args for Apache Beam pipeline to be populated by | ||
// environment variables at runtime. The result will be merged with | ||
// beam_pipeline_args. | ||
// Map consists of: | ||
// {beam_arg: environment_variable} | ||
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. How about adding some comments about the outcome after env variable replacements? 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. Elaborated this with examples and merging logic. |
||
// | ||
// Example: | ||
// beam_pipeline_args = [--runner=DirectRunner] | ||
// os.environ[BAR] = "bar" | ||
// beam_pipeline_args_from_env = {foo: BAR} | ||
// beam_pipeline_args at runtime will be: | ||
// beam_pipeline_args = [--runner=DirectRunner, | ||
// --foo=bar] | ||
// | ||
// Args specified in beam_pipeline_args will take precedence | ||
// over args specified in beam_pipeline_args_from_env in case of | ||
// a clash. | ||
// Example: | ||
// beam_pipeline_args = [--runner=DirectRunner, | ||
// --foo=baz] | ||
// os.environ[BAR] = "bar" | ||
// beam_pipeline_args_from_env = {foo: BAR} | ||
// beam_pipeline_args at runtime will be: | ||
// beam_pipeline_args = [--runner=DirectRunner, | ||
// --foo=baz] | ||
map<string, string> beam_pipeline_args_from_env = 3; | ||
} | ||
|
||
// Specification for Container based executables. | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This forking/duplication (across several parts of code and proto) seems odd. Could we have only one?
Also what is the merging behavior of these (especially when they disagree) which now becomes a public contract which we have to honour indefinitely?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure where this code is duplicated, can you specify where?
The merging behaviour is the same as for ordinary beam args, i.e. component specific args override pipeline level args.
And in addition, any arg specified as an ordinary beam arg will take precedence over any kind of beam arg from env.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that the merging behavior seems clear now thanks to the explanation in the proto. Thanks!
But I am a little bit worried about the duplication of "beam_pipeline_args" and "beam_pipeline_args_from_env" in general. Because these two things appears together almost always. From the first comment by @zhitaoli (#3455 (comment) ) we might need to explore ideas using some kind of placeholders. If the existing placeholder in TFX doesn't fit well here, we might be able to invent a new simple placeholder mechanism like shell env var expansion.
We might be able to proceed with the current implementation, but I think that we might need to get more inputs on this from other folks. (CC @kennethyang404 )