[ 
https://issues.apache.org/jira/browse/BEAM-3883?focusedWorklogId=102722&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-102722
 ]

ASF GitHub Bot logged work on BEAM-3883:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 16/May/18 23:52
            Start Date: 16/May/18 23:52
    Worklog Time Spent: 10m 
      Work Description: angoenka commented on a change in pull request #5251: 
[BEAM-3883] Refactor and clean dependency.py to make it reusable with artifact 
service
URL: https://github.com/apache/beam/pull/5251#discussion_r188804700
 
 

 ##########
 File path: sdks/python/apache_beam/runners/portability/stager.py
 ##########
 @@ -78,39 +78,8 @@ class Stager(object):
   """Stager identifies and copies the appropriate artifacts to the staging
   location."""
 
-  def _copy_file(self, from_path, to_path):
-    """Copies a local file to a GCS file or vice versa."""
-    logging.info('file copy from %s to %s.', from_path, to_path)
-    if from_path.startswith('gs://') or to_path.startswith('gs://'):
-      from apache_beam.io.gcp import gcsio
-      if from_path.startswith('gs://') and to_path.startswith('gs://'):
-        # Both files are GCS files so copy.
-        gcsio.GcsIO().copy(from_path, to_path)
-      elif to_path.startswith('gs://'):
-        # Only target is a GCS file, read local file and upload.
-        with open(from_path, 'rb') as f:
-          with gcsio.GcsIO().open(to_path, mode='wb') as g:
-            pfun = functools.partial(f.read, gcsio.WRITE_CHUNK_SIZE)
-            for chunk in iter(pfun, ''):
-              g.write(chunk)
-      else:
-        # Source is a GCS file but target is local file.
-        with gcsio.GcsIO().open(from_path, mode='rb') as g:
-          with open(to_path, 'wb') as f:
-            pfun = functools.partial(g.read, gcsio.DEFAULT_READ_BUFFER_SIZE)
-            for chunk in iter(pfun, ''):
-              f.write(chunk)
-    else:
-      # Branch used only for unit tests and integration tests.
-      # In such environments GCS support is not available.
-      if not os.path.isdir(os.path.dirname(to_path)):
-        logging.info(
-            'Created folder (since we have not done yet, and any errors '
-            'will follow): %s ', os.path.dirname(to_path))
-        os.mkdir(os.path.dirname(to_path))
-      shutil.copyfile(from_path, to_path)
-
-  def _download_file(self, from_url, to_path):
+  @staticmethod
+  def _download_file(from_url, to_path):
 
 Review comment:
   As it also support http:// and gs:// I would prefer calling it from_url.
   Note: from can not be used.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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: 102722)
    Time Spent: 13h 10m  (was: 13h)

> Python SDK stages artifacts when talking to job server
> ------------------------------------------------------
>
>                 Key: BEAM-3883
>                 URL: https://issues.apache.org/jira/browse/BEAM-3883
>             Project: Beam
>          Issue Type: Sub-task
>          Components: sdk-py-core
>            Reporter: Ben Sidhom
>            Assignee: Ankur Goenka
>            Priority: Major
>          Time Spent: 13h 10m
>  Remaining Estimate: 0h
>
> The Python SDK does not currently stage its user-defined functions or 
> dependencies when talking to the job API. Artifacts that need to be staged 
> include the user code itself, any SDK components not included in the 
> container image, and the list of Python packages that must be installed at 
> runtime.
>  
> Artifacts that are currently expected can be found in the harness boot code: 
> [https://github.com/apache/beam/blob/58e3b06bee7378d2d8db1c8dd534b415864f63e1/sdks/python/container/boot.go#L52.]



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to