Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto update of requirements in virtualenv #156

Closed
microfuge opened this issue May 31, 2022 · 2 comments
Closed

Auto update of requirements in virtualenv #156

microfuge opened this issue May 31, 2022 · 2 comments
Assignees

Comments

@microfuge
Copy link

Dear All,

First of all thanks so much for this role!

I have used a modified version of this role to install Galaxy in a privilege separation mode. As the virtualenv is owned by a privsep user, galaxy (galaxy user) can not auto update the newly arising requirements in the virtualenv (e.g due to enabling new options in the config) .
For example the drmaa package is not installed by default. The option in the role defaults where the packages to install in the virtualenv seem to be mentioned here -

galaxy_requirements_file: "{{ galaxy_server_dir }}/lib/galaxy/dependencies/pinned-requirements.txt"

Should I add required packages (e.g drmaa ) to the pinned-requirements.txt in the Galaxy source ? Or is there a way that I have missed? Also is there a way to know which packages are not present when a new option is enabled in the configs. E.g when enabling cluster access in job config, the information that the drmaa package is missing and needs to be added.

Thanks Again and please let me know if something is missing/wrong in this post.
Regards,
Saurabh

@natefoo
Copy link
Member

natefoo commented Jun 1, 2022

drmaa is a conditional dependency and is installed if a drmaa-backed runner plugin is enabled in Galaxy's job config. This happens in the role via these tasks in dependencies.yml:

    - name: Collect Galaxy conditional dependency requirement strings
      command: "{{ galaxy_venv_dir }}/bin/python -c \"import galaxy.dependencies; print('\\n'.join(galaxy.dependencies.optional('{{ galaxy_config_file }}')))\""
      environment:
        PYTHONPATH: "{{ galaxy_server_dir }}/lib"
      register: conditional_dependencies
      changed_when: no

    - name: Install Galaxy conditional dependencies
      pip:
        name: "{{ conditional_dependencies.stdout_lines }}"
        extra_args: "--index-url https://wheels.galaxyproject.org/simple/ --extra-index-url https://pypi.python.org/simple {{ pip_extra_args | default('') }}"
        virtualenv: "{{ galaxy_venv_dir }}"
        virtualenv_command: "{{ galaxy_virtualenv_command | default(pip_virtualenv_command | default(omit)) }}"
      environment:
        PYTHONPATH: null
        VIRTUAL_ENV: "{{ galaxy_venv_dir }}"
      when: (not ansible_check_mode) and conditional_dependencies.stdout_lines | length > 0

If your job config file is written out prior to these tasks executing, it should have installed drmaa.

You can also add arbitrary packages to install in the list galaxy_additional_venv_packages.

@microfuge
Copy link
Author

Hi Nate,

Thanks a ton!
The issue was caused by mismanagement of configs from my side and also me not checking the correct venv dir.

The role correctly and appropriately installs the requirements as they arise. Thanks also for pointing out the source snippets which are useful and answer all my queries.

Just to add, this role has been a lifesaver for me and thanks for creating/maintaining. I consider the issue closed from my side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants