[
https://issues.apache.org/jira/browse/BEAM-8351?focusedWorklogId=323587&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-323587
]
ASF GitHub Bot logged work on BEAM-8351:
----------------------------------------
Author: ASF GitHub Bot
Created on: 04/Oct/19 17:16
Start Date: 04/Oct/19 17:16
Worklog Time Spent: 10m
Work Description: chadrik commented on pull request #9730: [BEAM-8351]
Support passing in arbitrary KV pairs to sdk worker via external environment
config
URL: https://github.com/apache/beam/pull/9730#discussion_r331603033
##########
File path: sdks/python/apache_beam/runners/portability/portable_runner.py
##########
@@ -129,11 +129,25 @@ def _create_environment(options):
env=(config.get('env') or '')
).SerializeToString())
elif environment_urn == common_urns.environments.EXTERNAL.urn:
+ def _looks_like_json(environment_config):
+ import re
+ return re.match(r'\{.+\}', environment_config)
Review comment:
There's also whitespace to consider. So if we're using `re.match` we have
to do `re.match(r'\s*\{.*\}\s*$')`.
We just need a simple heuristic that tells us that it looks json and not a
url. The most important thing is that we don't end up with a regex that
incorrectly returns False for something that is *actually* json, so I suggested
the `re.search` option because I think it's sufficient at detecting something
that's *not a url* and thus probably json. That said, I think the `re.match`
regex above looks pretty safe. Obviously, we're only talking about json
objects (i.e. dict) and not arrays and other scalars.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 323587)
Time Spent: 1h (was: 50m)
> Support passing in arbitrary KV pairs to sdk worker via external environment
> config
> -----------------------------------------------------------------------------------
>
> Key: BEAM-8351
> URL: https://issues.apache.org/jira/browse/BEAM-8351
> Project: Beam
> Issue Type: Improvement
> Components: sdk-py-core, sdk-py-harness
> Reporter: Wanqi Lyu
> Assignee: Wanqi Lyu
> Priority: Minor
> Time Spent: 1h
> Remaining Estimate: 0h
>
> Originally, the environment config for environment type of EXTERNAL only
> support passing in an url for the external worker pool; We want to support
> passing in arbitrary KV pairs to sdk worker via external environment config,
> so that the when starting the sdk harness we could get the values from
> `StartWorkerRequest.params`.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)