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

[BUG] - Environments Accumulate Non-Reproducible States #169

Open
viniciusdc opened this issue Aug 12, 2024 · 2 comments · May be fixed by #172
Open

[BUG] - Environments Accumulate Non-Reproducible States #169

viniciusdc opened this issue Aug 12, 2024 · 2 comments · May be fixed by #172
Labels
bug Something isn't working

Comments

@viniciusdc
Copy link
Collaborator

viniciusdc commented Aug 12, 2024

Context

The current Ansible task for managing conda environments gradually accumulates old packages, leading to non-reproducible states. This issue is particularly noticeable with deployments migrated from pre-2024.3.1 Nebari Slurm versions, where outdated packages such as Gator remain in the JupyterLab environments.

- name: Create environments directory
become: true
ansible.builtin.file:
path: /opt/conda-environments
state: directory
- name: Copy environments files
become: true
ansible.builtin.template:
src: "{{ environment_path }}"
dest: /opt/conda-environments/{{ environment_path | basename }}
mode: "0644"
register: _environment
- name: Install conda environment {{ environment_path | basename }}
become: true
ansible.builtin.command:
cmd: "{{ miniforge_home }}/bin/mamba env update -f /opt/conda-environments/{{ environment_path | basename }} --prefix {{ miniforge_home }}/envs/{{ environment_path
| basename | splitext | first }}"
when: _environment.changed

The mamba env update command in the task above only updates the existing environment without removing outdated packages that are no longer needed. Over time, this results in an environment that includes outdated dependencies, making it non-reproducible and prone to issues.

Suggested Ansible Tasks:

- name: Remove existing conda environment {{ environment_path | basename | splitext | first }}
  become: true
  ansible.builtin.command:
    cmd: "{{ miniforge_home }}/bin/mamba env remove --name {{ environment_path | basename | splitext | first }}"
  ignore_errors: true

- name: Install conda environment {{ environment_path | basename }}
  become: true
  ansible.builtin.command:
    cmd: "{{ miniforge_home }}/bin/mamba env create -f /opt/conda-environments/{{ environment_path | basename }} --prefix {{ miniforge_home }}/envs/{{ environment_path | basename | splitext | first }}"

Value and/or benefit

Implementing this solution will prevent the accumulation of outdated packages and ensure that environments remain clean, reproducible, and free from legacy issues.

Anything else?

No response

@viniciusdc viniciusdc added the bug Something isn't working label Aug 12, 2024
@viniciusdc
Copy link
Collaborator Author

@viniciusdc
Copy link
Collaborator Author

Also, this would be something nice to be tested, in order to make sure the environments are being properly being re-created

@aktech aktech linked a pull request Sep 30, 2024 that will close this issue
18 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant