def install_blueprint_plugins(blueprint_id, blueprint_path, install_plugins=False, default_python_interpreter='python2.7', storage_path=None): requirements = blueprint_processor.create_requirements(blueprint_path) if install_plugins: if requirements: venv_path = utils.venv_path(blueprint_id, storage_path=storage_path) venv = manage.VirtualEnvironment(venv_path, python=default_python_interpreter) venv.open_or_create() for req in requirements: if not venv.is_installed(req): try: venv.install(req) LOG.info("Installed dependency: {0}".format(req)) except exceptions.PackageInstallationException: msg = 'Unable to install {0} dependency'.format(req) LOG.error(msg) raise aria_exceptions.AriaError(msg) LOG.info("Virtualenv {0} was used or created.".format(venv_path)) return os.path.join(venv_path, 'lib', venv.python, 'site-packages') else: LOG.debug('There are no plugins to install.')
def generic_execute(blueprint_id=None, workflow_id=None, parameters=None, allow_custom_parameters=None, task_retries=None, task_retry_interval=None, environment=None, default_python_interpreter='python2.7', storage_path=None): root_venv_path = utils.venv_path(blueprint_id, storage_path=storage_path) venv_path = os.path.join(root_venv_path, 'lib', default_python_interpreter, 'site-packages') sys.path.append(venv_path) result = environment.execute( workflow=workflow_id, parameters=parameters, allow_custom_parameters=allow_custom_parameters, task_retries=task_retries, task_retry_interval=task_retry_interval) del sys.path[sys.path.index(venv_path)] return result
def install_blueprint_plugins( blueprint_id, blueprint_path, install_plugins=False, default_python_interpreter="python2.7", storage_path=None ): requirements = blueprint_processor.create_requirements(blueprint_path) if install_plugins: if requirements: venv_path = utils.venv_path(blueprint_id, storage_path=storage_path) venv = manage.VirtualEnvironment(venv_path, python=default_python_interpreter) venv.open_or_create() for req in requirements: if not venv.is_installed(req): try: venv.install(req) LOG.info("Installed dependency: {0}".format(req)) except exceptions.PackageInstallationException: msg = "Unable to install {0} dependency".format(req) LOG.error(msg) raise aria_exceptions.AriaError(msg) LOG.info("Virtualenv {0} was used or created.".format(venv_path)) return os.path.join(venv_path, "lib", venv.python, "site-packages") else: LOG.debug("There are no plugins to install.")