Skip to content

Commit

Permalink
#2786: download and install as separate tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
katherinetomkins-mo committed Sep 9, 2022
1 parent 2835ed3 commit 4f3fd26
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
BASH_XTRACEFD=1
set -eux

# Remove source directories, if they exists.
# Remove esmvaltool and esmvalcore directories, if they exist.
if [[ -d ${ESMVALTOOL_DIR} ]]; then
rm -rf "${ESMVALTOOL_DIR}"
fi
Expand All @@ -12,20 +12,21 @@ if [[ -d ${ESMVALCORE_DIR} ]]; then
rm -rf "${ESMVALCORE_DIR}"
fi

# Copy the site specific environment launch file to the cylc run /bin
# Where it will be identified by rose task-run
SOURCE_PATH="${CYLC_WORKFLOW_RUN_DIR}/site/${SITE}-env"
TARGET_DIR="${CYLC_WORKFLOW_RUN_DIR}/bin"
ENV_FILE="rrw-env"
ENV_FILE="rrw-launch"

# Create the 'bin' directory in the installed workflow.
mkdir "${TARGET_DIR}"

# Copy the environment file to the 'bin' directory.
# Copy the environment launch file to the 'bin' directory.
cp "${SOURCE_PATH}" "${TARGET_DIR}/${ENV_FILE}"

# Checkout ESMValTool.
# Launch the local site environment for access to pip
rrw-launch

# Checkout main branch for ESMValTool and ESMValCore from github.
git clone -b "${BRANCH}" "${ESMVALTOOL_URL}" "${ESMVALTOOL_DIR}"
git clone -b "${BRANCH}" "${ESMVALCORE_URL}" "${ESMVALCORE_DIR}"

# Install ESMValTool.
cd "${ESMVALTOOL_DIR}"
# pip install . --prefix="${CYLC_WORKFLOW_RUN_DIR}"
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
default = install_cold.sh

[env]
SITE=${SITE}
MODULE_NAME=${MODULE_NAME}
ESMVALTOOL_DIR = ${CYLC_SUITE_RUN_DIR}/ESMValTool
ESMVALCORE_DIR = ${CYLC_SUITE_RUN_DIR}/ESMValCore
ESMVALTOOL_URL = [email protected]:ESMValGroup/ESMValTool.git
ESMVALCORE_URL = [email protected]:ESMValGroup/ESMValCore.git
BRANCH = main
ESMVALTOOL_DIR = ${CYLC_SUITE_RUN_DIR}/ESMValTool
ESMVALCORE_DIR = ${CYLC_SUITE_RUN_DIR}/ESMValCore
SITE=${SITE}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
# Send the output from 'set -x' to 'stdout' rather than 'stderr'.
BASH_XTRACEFD=1
set -eux

# install esmvaltool from main branch
cd "${ESMVALTOOL_DIR}"
pip install . --prefix="${CYLC_WORKFLOW_RUN_DIR}"

# install esmvaltool from main branch
cd "${ESMVALCORE_DIR}"
pip install . --prefix="${CYLC_WORKFLOW_RUN_DIR}"

# this currently fails due to permissions issues when trying to install.
# currently assuming it is trying to overwrite something in the installed
# scitools module? (the launch file from task 1)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[command]
default = install_esmvaltool.sh

[env]
ESMVALTOOL_DIR = ${CYLC_SUITE_RUN_DIR}/ESMValTool
ESMVALCORE_DIR = ${CYLC_SUITE_RUN_DIR}/ESMValCore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
allow implicit tasks = True
[scheduling]
[[graph]]
R1 = install_cold
R1 = install_cold => install_esmvaltool

[runtime]
[[root]]
Expand All @@ -18,5 +18,13 @@
platform = localhost
[[[environment]]]
SITE = {{ SITE }}
MODULE_NAME = {{ MODULE_NAME }}

[[install_esmvaltool]]
platform = localhost
[[[environment]]]
SITE = {{ SITE }}
MODULE_NAME = {{ MODULE_NAME }}


{% include 'site/' ~ SITE ~ '.cylc' %}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[template variables]
SITE="metoffice"
MODULE_NAME=""
MODULE_NAME="scitools"
PYTHON_VERSION = 3.10
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,3 @@ fi
if [[ -z ${QUIET_MODE:-} ]]; then
echo "[OK] Modules loaded."
fi

command="/usr/bin/time -v -o ${CYLC_TASK_LOG_ROOT}.time $@"
exec ${command}

0 comments on commit 4f3fd26

Please sign in to comment.