-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(node/hexrot) add conda install ts_m2gui
- Loading branch information
Showing
3 changed files
with
125 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# @summary | ||
# Installs anaconda | ||
# @param python_env_name | ||
# if exist, sets the name of the virtual environment | ||
# | ||
# @param python_env_version | ||
# if exist, sets the version of python for the virtual environment | ||
# | ||
class profile::core::anaconda ( | ||
String $python_env_name, | ||
String $python_env_version, | ||
Tuple $conda_packages, | ||
) { | ||
case $facts['os']['family'] { | ||
'RedHat': { | ||
#package { 'wget': | ||
# ensure => installed, | ||
#} | ||
exec { 'install_anaconda': | ||
command => '/bin/wget https://repo.anaconda.com/archive/Anaconda3-2023.07-2-Linux-x86_64.sh -O /tmp/anaconda_installer.sh && /bin/bash /tmp/anaconda_installer.sh -b -p /opt/anaconda', | ||
creates => '/opt/anaconda/bin/conda', | ||
path => '/usr/bin:/bin:/opt/anaconda/bin', | ||
require => Package['wget'], | ||
} | ||
} | ||
default: { | ||
notify { 'unsupported_os': | ||
message => 'This Anaconda installation is only for RedHat family', | ||
} | ||
} | ||
} | ||
# Create a Conda environment with Python if parameters are set | ||
if ($python_env_name and $python_env_version) { | ||
exec { 'create_conda_env': | ||
command => "/opt/anaconda/bin/conda create -y --name ${python_env_name} python=${python_env_version}", | ||
creates => "/opt/anaconda/envs/${python_env_name}/", | ||
require => Exec['install_anaconda'], | ||
} | ||
file { '/etc/profile.d/conda_source.sh': | ||
ensure => file, | ||
mode => '0644', | ||
require => Exec['create_conda_env'], | ||
# lint:ignore:strict_indent | ||
content => @("SOURCE"), | ||
#!/usr/bin/bash | ||
source /opt/anaconda/bin/activate ${python_env_name} | ||
| SOURCE | ||
# lint:endignore | ||
} | ||
# Install libmamba inside the environment with conda | ||
exec { 'install_libmamba_env': | ||
command => "/opt/anaconda/bin/conda install -y -n ${python_env_name} conda-libmamba-solver", | ||
creates => "/opt/anaconda/envs/${python_env_name}/lib/libmamba.so", | ||
require => Exec['create_conda_env'], | ||
path => ['/usr/bin', '/bin', '/opt/anaconda/bin'], | ||
} | ||
# Sets libmamba as dependencies solver | ||
exec { 'set_libmamba': | ||
command => 'conda config --set solver libmamba', | ||
require => Exec['install_libmamba_env'], | ||
unless => 'conda config --get solver | grep libmamba', | ||
path => ['/usr/bin', '/bin', '/opt/anaconda/bin'], | ||
} | ||
} | ||
#cycle and install conda stuff | ||
if !empty($conda_packages) { | ||
$conda_packages.each |$package_info| { | ||
exec { "install_${package_info['name']}_via_conda": | ||
command => "conda install -y -n ${python_env_name} -c ${package_info['channel']} ${package_info['name']}", | ||
path => ['/usr/bin', '/bin', '/opt/anaconda/bin'], | ||
require => Exec['set_libmamba'], | ||
unless => "conda list -n ${python_env_name} | grep ${package_info['name']}", | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# @summary | ||
# Sets up repos and symlinks for hexrot | ||
|
||
class profile::ts::hexrot { | ||
|
||
$user = 73006 | ||
|
||
vcsrepo { '/opt/ts_config_mttcs': | ||
ensure => present, | ||
provider => git, | ||
source => 'https://github.com/lsst-ts/ts_config_mttcs.git', | ||
keep_local_changes => true, | ||
user => $user, | ||
owner => $user, | ||
group => $user, | ||
require => Class[profile::core::anaconda], | ||
} | ||
file { '/etc/profile.d/hexrot_path.sh': | ||
ensure => file, | ||
mode => '0644', | ||
require => Vcsrepo['/opt/ts_config_mttcs'], | ||
# lint:ignore:strict_indent | ||
content => @(ENV), | ||
#!/usr/bin/bash | ||
export QT_API="PySide2" | ||
export PYTEST_QT_API="PySide2" | ||
export TS_CONFIG_MTTCS="/opt/ts_config_mttcs" | ||
| ENV | ||
# lint:endignore | ||
} | ||
file { '/opt/anaconda/envs/py311/bin/python': | ||
ensure => link, | ||
target => '/rubin/mtm2/python/python', | ||
require => '/opt/anaconda/envs/py311', | ||
} | ||
} |