Skip to content

Commit

Permalink
add conda --prefix param to mcreate
Browse files Browse the repository at this point in the history
  • Loading branch information
sternp committed Sep 19, 2024
1 parent d7706f7 commit af88a17
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
Binary file modified bin/htop
Binary file not shown.
Binary file added bin/htop-old
Binary file not shown.
22 changes: 18 additions & 4 deletions bin/mcreate
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Script to more easily submit jobs to the QUT HPC queuing system

__author__ = "Peter Sternes"
__copyright__ = "Copyright 2021"
__copyright__ = "Copyright 2024"
__credits__ = ["Peter Sternes"]
__license__ = "GPL3"
__maintainer__ = "Peter Sternes"
Expand Down Expand Up @@ -81,6 +81,7 @@ if __name__ == '__main__':
parser.add_argument('package',help='package to be installed')
parser.add_argument('-c', help='Use conda instead of the default mamba to install', action='store_true', default=False, dest='c')
parser.add_argument('-v', help='Display latest version of package without installing', action='store_true', default=False, dest='v')
parser.add_argument('--prefix', help='Set the conda prefix something other than the currently active env', default=False, dest='prefix')
args = parser.parse_args()

logging.basicConfig(level=logging.INFO, format='%(asctime)s %(levelname)s: %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p')
Expand All @@ -103,20 +104,33 @@ if __name__ == '__main__':
conda_env_path = run("conda config --show envs_dirs | sed -n 2p | sed 's/ - //;s/$/\//'").decode().rstrip()
version = str(run(("{} search {} | awk '{{print $2}}' | tail -n1").format(installer, package)).decode()).rstrip()
environment_name = package + '-v' + version
package_env_path = os.path.join(conda_env_path + environment_name)

if os.path.exists(package_env_path):
if os.path.exists(os.path.join(conda_env_path + environment_name)):
package_env_path = os.path.join(conda_env_path + environment_name)
print('A current version of this package is already installed. Exiting...')
print('Installation location: ' + package_env_path)
exit()
elif args.prefix:
prefix = args.prefix
package_env_path = os.path.join(prefix + environment_name)
print('Installer: ' + installer)
print('Package: ' + package)
print('Checking for latest version...')
print('Latest version: ' + version)
print('Creating a new environment entitled ' + environment_name + ' using ' + installer + '...')
print('Installation location: ' + package_env_path)
run(("{} create --prefix={} -y {}={}").format(installer, package_env_path, package, version))
else:
package_env_path = os.path.join(conda_env_path + environment_name)
print('Installer: ' + installer)
print('Package: ' + package)
print('Checking for latest version...')
print('Latest version: ' + version)
print('Creating a new environment entitled ' + environment_name + ' using ' + installer + '...')
print('Installation location: ' + package_env_path)
run(("{} create -y -n {} {}={}").format(installer, environment_name, package, version))
run(("{} create -y -n {} {}={}").format(installer, environment_name, package, version))





Expand Down
2 changes: 1 addition & 1 deletion cmr_bashrc_extras.bash
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND ; }"'echo $$ $USER \

#Path to kingfisher # symlinked /lustre/work-lustre/microbiome/sw/kingfisher-download/bin/kingfisher in $CONDA_PREFIX/envs/kingfisher/bin instead
export PATH=/work/microbiome/sw/kingfisher_repos/kingfisher-v0.4.1/kingfisher-download/bin:$PATH
export PATH=/work/microbiome/sw/recurm_repos/recurm/bin:$PATH
export PATH=/work/microbiome/sw/recurm_repos/recurm-v0.3.0/recurm/bin:$PATH

#add RAM usage limits
if [ `hostname` = "cl5n006" ] || [ `hostname` = "cl5n007" ] || [ `hostname` = "cl5n008" ] || [ `hostname` = "cl5n009" ]
Expand Down

0 comments on commit af88a17

Please sign in to comment.