Пример #1
0
    def prepare_workspace(project, repo_top, args):
        # Since we dispatch to remote machines, a project specific python
        # virtualenv is exists, needs to be activated when launching the job.
        Launcher.set_python_venv(project)
        if Launcher.python_venv is None:
            return

        # Python_venv needs to be a valid tarfile. Extract it in the scratch
        # area if it does not exist. It is upto the user to delete it if it is
        # stale.
        stem = Path(Launcher.python_venv).stem.split('.')[0]
        path = Path(args.scratch_root, stem)
        if not path.is_dir():
            with tarfile.open(Launcher.python_venv, mode='r') as tar:
                tar.extractall(path=args.scratch_root)
        Launcher.python_venv = path
Пример #2
0
    def prepare_workspace(project, repo_top, args):
        '''Overrides Launcher.prepare_workspace.'''

        # Since we dispatch to remote machines, a project specific python
        # virtualenv is exists, needs to be activated when launching the job.
        Launcher.set_python_venv(project)
        if Launcher.python_venv is None:
            return

        # Python_venv needs to be a valid tarfile. Extract it in the scratch
        # area if it does not exist. It is upto the user to delete it if it is
        # stale.
        if tarfile.is_tarfile(Launcher.python_venv):
            path = Path(args.scratch_root, Path(Launcher.python_venv).stem)
            if not path.is_dir():
                with tarfile.open(Launcher.python_venv, mode='r') as tar:
                    tar.extractall(path=args.scratch_root)
            Launcher.python_venv = path

        else:
            raise LauncherError("{} is not a valid tar file".format(
                Launcher.python_venv))