-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add share/lib/python and share/bin to PYTHONPATH & PATH
- Loading branch information
Showing
3 changed files
with
70 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,32 @@ | ||
#!/usr/bin/env bash | ||
# THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE. | ||
# Copyright (C) NIWA & British Crown (Met Office) & Contributors. | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
#------------------------------------------------------------------------------- | ||
# CYLC_WORKFLOW_SHARE_DIR/bin is added to the PATH | ||
# CYLC_WORKFLOW_SHARE_DIR/lib/python is added to PYTHONPATH | ||
# | ||
# Workflow creates scripts in CYLC_WORKFLOW_SHARE_DIR in `install_cold` task | ||
# Which are then used in subsequent tasks. We check for the output of those | ||
# tasks. | ||
. "$(dirname "$0")/test_header" | ||
set_test_number 2 | ||
|
||
# Setup: | ||
install_workflow "${TEST_NAME_BASE}" "${TEST_NAME_BASE}" | ||
run_ok "${TEST_NAME_BASE}.validate" cylc validate "${WORKFLOW_NAME}" | ||
run_ok "${TEST_NAME_BASE}.play" cylc play --no-detach "${WORKFLOW_NAME}" | ||
|
||
purge |
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 @@ | ||
#!jinja2 | ||
[scheduler] | ||
[[events]] | ||
stall timeout = PT0M | ||
|
||
[scheduling] | ||
initial cycle point = 1266 | ||
[[graph]] | ||
R1 = install_cold => run_mypythonscript & run_myscript | ||
|
||
[runtime] | ||
[[install_cold]] | ||
script = """ | ||
mkdir -p "${CYLC_WORKFLOW_SHARE_DIR}/lib/python" | ||
mkdir -p "${CYLC_WORKFLOW_SHARE_DIR}/bin" | ||
cat > "${CYLC_WORKFLOW_SHARE_DIR}/lib/python/mypythonscript.py" <<__HERE__ | ||
def my_function(): | ||
print("I can speak Esparanto like a native.") | ||
__HERE__ | ||
cat > "${CYLC_WORKFLOW_SHARE_DIR}/bin/myscript.sh" <<__HERE__ | ||
#!/usr/bin/bash | ||
echo "A sure cure for seasickness is to sit under a tree." | ||
__HERE__ | ||
chmod +x "${CYLC_WORKFLOW_SHARE_DIR}/lib/python/mypythonscript.py" | ||
chmod +x "${CYLC_WORKFLOW_SHARE_DIR}/bin/myscript.sh" | ||
""" | ||
|
||
[[run_myscript]] | ||
script = myscript.sh | ||
|
||
[[run_mypythonscript]] | ||
script = python -c 'from mypythonscript import my_function; my_function()' | ||
|