Github user davies commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4897#discussion_r34518258
  
    --- Diff: python/pyspark/context.py ---
    @@ -711,6 +721,30 @@ def addPyFile(self, path):
                 # for tests in local mode
                 sys.path.insert(1, os.path.join(SparkFiles.getRootDirectory(), 
filename))
     
    +    def addRequirementsFile(self, path):
    +        """
    +        Add a pip requirements file to distribute dependencies for all 
tasks
    +        on thie SparkContext in the future. An ImportError will be thrown 
if
    +        a module in the file can't be downloaded.
    +        See 
https://pip.pypa.io/en/latest/user_guide.html#requirements-files
    +        Raises ImportError if the requirement can't be found
    +        """
    +        import pip
    +        tar_dir = tempfile.mkdtemp()
    +        try:
    +            for req in pip.req.parse_requirements(path, 
session=uuid.uuid1()):
    +                if not req.check_if_exists():
    +                    pip.main(['install', req.req.__str__()])
    +                mod = __import__(req.name)
    +                mod_path = mod.__path__[0]
    +                tar_path = os.path.join(tar_dir, req.name+'.tar.gz')
    --- End diff --
    
    Is possible that we can re-use the packaged file?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to