Skip to content

Commit

Permalink
Merge pull request #48 from MetaboHUB-MetaToul-FluxoMet/47-conda-vali…
Browse files Browse the repository at this point in the history
…dation

implement conda envs validation
  • Loading branch information
elliotfontaine authored Jul 22, 2024
2 parents e3517e5 + 0c3bfb8 commit 9172b40
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 38 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ The raws files you provide should be numbered that way:

The workflow will automatically detect the files and process them. Results (metabolites, concentrations, etc) are in `share/cycle/N/` of the run directory.

For a more detailed guide, see the [Tutorial](https://rtmet.readthedocs.io/en/latest/getting_started/tutorial.html) in the docs.
For a more detailed guide, see the [Tutorial](https://rtmet.readthedocs.io/en/latest/getting_started/basic_tutorial.html) in the docs.

## 🪲 Bugs and feature requests

Expand Down
32 changes: 28 additions & 4 deletions cylc-src/bioreactor-workflow/envs/conda.cylc
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,40 @@
'CONDA_OPENMS': 'wf-pyopenms',
} %}

[scheduling]
[[graph]]
{% if cfg__validate_conda_envs %}
R1/^ = validate_cfg => validate_conda => is_setup
{% endif %}

[runtime]
{% for env, conda_env_name in conda_envs.items() %}
[[{{env}}]]

{% for FAMILY, conda_env_name in conda_envs.items() %}
[[{{FAMILY}}]]
pre-script = """
set +eu
conda activate {{ conda_env_name }}
set -eu
"""
[[[meta]]]
title = "{{ env }}"
title = "{{ FAMILY }}"
description = "Conda environment activation: {{ conda_env_name }}"
categories = family task, conda
{% endfor %}
{% endfor %}

[[validate_conda]]
script = """
>&2 echo "conda compare outputs errors to stdout. Check 'job.out' for errors."
{% for conda_env_name in conda_envs.values() %}
echo "Checking conda environment: {{ conda_env_name }}"
conda compare \
${CYLC_WORKFLOW_RUN_DIR}/envs/{{ conda_env_name }}.yml \
-n {{ conda_env_name }}
{% endfor %}
"""
[[[meta]]]
title = "Validate Conda Environments"
description = """
Check if the conda environments are up-to-date and all packages are present.
"""
categories = family task, conda
12 changes: 4 additions & 8 deletions cylc-src/bioreactor-workflow/envs/wf-binner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,12 @@ channels:
- conda-forge
- bioconda
dependencies:
- r-base=4.3.1
- r-essentials=4.3
- r-remotes=2.4
- r-furrr=0.3.1
- r-ggthemes=5.1.0
- r-essentials=4.3
- r-optparse=1.7.4
- r-tidyselect=1.2.1
- r-rcpp=1.0.12
- r-ggthemes=5.1.0
- r-furrr=0.3.1
- bioconductor-mzr=2.36
- bioconductor-rhdf5lib=1.24

# Inside R, install the binneR package from GitHub
# remotes::install_github('aberHRML/binneR')
# conda activate wf-binner && Rscript -e "remotes::install_github('aberHRML/binneR', upgrade='never')"
4 changes: 4 additions & 0 deletions cylc-src/bioreactor-workflow/meta/rose-meta.conf
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ compulsory=true
range=0:
type=real

[template variables=cfg__validate_conda_envs]
compulsory=true
type=python_boolean

[template variables=cfg__scans_window]
compulsory=false
pattern=^'(|(\d+)-(\d+))'$
Expand Down
56 changes: 32 additions & 24 deletions cylc-src/bioreactor-workflow/rose-suite.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,37 @@
# It is rendered directly from the docstrings here.


########## Scientific parameters ##########

################################### Global workflow parameters ####################################

# Should the workflow validate the conda environments for packages' presence
# and versions before running.
#
# :default: False
# :type: bool
cfg__validate_conda_envs = False

# `internal | local`.
#
# * *internal*: will look for .raw files in :file:`${CYLC_WORKFLOW_RUN_DIR}/raws`.
# * *local*: will look for .raw files in :file:`{cfg__local_runs_dir}/${CYLC_WORKFLOW_RUN_NAME}`.
#
# :default: 'internal'
# :type: str
cfg__input_strategy='internal'

# Used if :rose:conf:`cfg__input_strategy` is set to *local*. If there is a
# subdirectory in the one defined here that shares the same name as the
# :term:`workflow run`, the workflow will look for .raw files inside.
#
# :optional: yes
# :default: None
# :type: str (path)
cfg__local_runs_dir=''



###################################### Scientific parameters ######################################

# Tuple for the number of scans to trim at the start and at the end of the
# :term:`flowgram`. If set to [0, 0], no trimming will be done.
Expand Down Expand Up @@ -42,29 +72,7 @@ cfg__ppm_tol=5



########## Input Strategy ##########

# `internal | local`.
#
# * *internal*: will look for .raw files in :file:`${CYLC_WORKFLOW_RUN_DIR}/raws`.
# * *local*: will look for .raw files in :file:`{cfg__local_runs_dir}/${CYLC_WORKFLOW_RUN_NAME}`.
#
# :default: 'internal'
# :type: str
cfg__input_strategy='internal'

# Used if :rose:conf:`cfg__input_strategy` is set to *local*. If there is a
# subdirectory in the one defined here that shares the same name as the
# :term:`workflow run`, the workflow will look for .raw files inside.
#
# :optional: yes
# :default: None
# :type: str (path)
cfg__local_runs_dir=''



########## [OPTIONAL] InfluxDB Setup ##########
#################################### [OPTIONAL] InfluxDB Setup ####################################

# Should the workflow send data to an InfluxDB instance for visualization.
# If set to *True*, the following configuration options must be set.
Expand Down
2 changes: 1 addition & 1 deletion docs/source/getting_started/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ Bioinformatics tools are installed in separate Conda environments, for isolation
purposes. For binneR, you'll need to install it from the R console::

$ for file in wf-*.yml; do conda env create -f $file; done
$ conda activate wf-binner && Rscript -e "remotes::install_github('aberHRML/binneR', dependencies=FALSE, upgrade_dependencies=FALSE)"
$ conda activate wf-binner && Rscript -e "remotes::install_github('aberHRML/binneR', upgrade='never')"
$ conda deactivate

.. _installation.influxdb:
Expand Down

0 comments on commit 9172b40

Please sign in to comment.