robertwb commented on a change in pull request #15857:
URL: https://github.com/apache/beam/pull/15857#discussion_r742457520



##########
File path: sdks/python/apache_beam/utils/subprocess_server.py
##########
@@ -158,9 +158,14 @@ class JavaJarServer(SubprocessServer):
       'local', (threading.local, ),
       dict(__init__=lambda self: setattr(self, 'replacements', {})))()
 
-  def __init__(self, stub_class, path_to_jar, java_arguments):
+  def __init__(self, stub_class, path_to_jar, java_arguments, classpath=None):

Review comment:
       Done.

##########
File path: sdks/python/apache_beam/transforms/external.py
##########
@@ -283,9 +283,21 @@ def _has_constructor(self):
 class JavaExternalTransform(ptransform.PTransform):
   """A proxy for Java-implemented external transforms.
 
-  One builds these transforms just as one would in Java.
+  One builds these transforms just as one would in Java, e.g.::
+
+      transform = JavaExternalTransform('fully.qualified.ClassName')(
+          contrustorArg, ...).builderMethod(...)
+
+  or::
+
+      JavaExternalTransform('fully.qualified.ClassName').staticConstructor(

Review comment:
       Yes, that's the example above.

##########
File path: sdks/python/apache_beam/transforms/external.py
##########
@@ -655,11 +667,13 @@ class JavaJarExpansionService(object):
   argument which will spawn a subprocess using this jar to expand the
   transform.
   """
-  def __init__(self, path_to_jar, extra_args=None):
+  def __init__(self, path_to_jar, extra_args=None, classpath=None):
     if extra_args is None:
-      extra_args = ['{{PORT}}', f'--filesToStage={path_to_jar}']
+      to_stage = ','.join([path_to_jar] + list(classpath or []))

Review comment:
       Looks like the file stager does handle directories. Updated the code to 
handle globs. 

##########
File path: sdks/python/apache_beam/transforms/external.py
##########
@@ -655,11 +667,13 @@ class JavaJarExpansionService(object):
   argument which will spawn a subprocess using this jar to expand the
   transform.
   """
-  def __init__(self, path_to_jar, extra_args=None):
+  def __init__(self, path_to_jar, extra_args=None, classpath=None):
     if extra_args is None:
-      extra_args = ['{{PORT}}', f'--filesToStage={path_to_jar}']
+      to_stage = ','.join([path_to_jar] + list(classpath or []))

Review comment:
       Ideally the file stager could handle those as well. 




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to