[
https://issues.apache.org/jira/browse/BEAM-8746?focusedWorklogId=347918&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-347918
]
ASF GitHub Bot logged work on BEAM-8746:
----------------------------------------
Author: ASF GitHub Bot
Created on: 22/Nov/19 05:00
Start Date: 22/Nov/19 05:00
Worklog Time Spent: 10m
Work Description: chadrik commented on pull request #10161: [BEAM-8746]
Make local job service accessible from external machines
URL: https://github.com/apache/beam/pull/10161#discussion_r349433786
##########
File path: sdks/python/apache_beam/runners/portability/local_job_service.py
##########
@@ -95,7 +95,7 @@ def create_beam_job(self, preparation_id, job_name,
pipeline, options):
def start_grpc_server(self, port=0):
self._server = grpc.server(UnboundedThreadPoolExecutor())
- port = self._server.add_insecure_port('localhost:%d' % port)
+ port = self._server.add_insecure_port('[::]:%d' % port)
Review comment:
ok, I've been playing around with this, and the main impediment to keeping
this design simple is that there are two separate hostnames required, one for
opening the port for the server, and one which is delivered to the client for
reconnecting to the staging service.
I think it'd be nice to prevent people from having to figure out all this
stuff again, because it's pretty frustrating to get it right, so here's my best
effort at a compromise between making this configurable and making it "just
work".
```python
def get_hostname(self):
"""Return the host name at which this server will be accessible.
In particular, this is provided to the client as the
artifact staging endpoint.
"""
return 'localhost'
def start_grpc_server(self, port=0):
self._server = grpc.server(UnboundedThreadPoolExecutor())
hostname = self.get_hostname()
# either open this up to the world, or lock it down to localhost
if os.environ.get('DOCKER_MAC_CONTAINER') == '1' or hostname !=
'localhost':
service_address = '[::]'
else:
service_address = 'localhost'
port = self._server.add_insecure_port('%s:%d' % (service_address, port))
beam_job_api_pb2_grpc.add_JobServiceServicer_to_server(self,
self._server)
beam_artifact_api_pb2_grpc.add_ArtifactStagingServiceServicer_to_server(
self._artifact_service, self._server)
self._artifact_staging_endpoint = endpoints_pb2.ApiServiceDescriptor(
url='%s:%d' % (hostname, port))
self._server.start()
_LOGGER.info('Grpc server started at %s on port %d' % (hostname, port))
return port
```
What do you think? The other option is that I just copy all of
`start_grpc_server` into my sub-class. It's not the end of the world if that's
the decision we come to.
----------------------------------------------------------------
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: 347918)
Time Spent: 1.5h (was: 1h 20m)
> Allow the local job service to work from inside docker
> ------------------------------------------------------
>
> Key: BEAM-8746
> URL: https://issues.apache.org/jira/browse/BEAM-8746
> Project: Beam
> Issue Type: Improvement
> Components: sdk-py-core
> Reporter: Chad Dombrova
> Assignee: Chad Dombrova
> Priority: Major
> Time Spent: 1.5h
> Remaining Estimate: 0h
>
> Currently the connection is refused. It's a simple fix.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)