Hello,
I started to use cylc to improve the usage of a software to handle climate simulations, that runs in ksh.
The software that I try to manage with cylc is using some ksh functions and I wonder If I have to reload the functions at each cylc step or if I can load it once for the entire workflow.
(functions are loaded this way
. ./module.ksh
)
Thank you,
Bests,
Chloé azria
Hi, welcome to the Cylc community.
that runs in ksh.
Cylc jobs are implemented as Bash scripts, so this file is probably being run by Bash not KSH, e.g:
flow.cylc
[runtime]
[[my_task]]
script = """
# Cylc will run this with Bash
. module.ksh
myscript
"""
You can still get Cylc to run KSH scripts though:
flow.cylc
[runtime]
[[my_task]]
script = """
my-ksh-script
"""
bin/my-ksh-script
#!/usr/bin/env/ksh
echo "Hello $SHELL" # this will print "Hello /bin/ksh"
I have to reload the functions at each cylc step or if I can load it once for the entire workflow
Each Cylc job submission runs in its own independent environment, this is how Cylc is able to submit jobs to remote platforms such as supercomputers. So you will need to source these functions once in each job.
However, you can avoid having to write this out for each task individually by using a Cylc family, e.g:
flow.cylc
[runtime]
# all tasks will source the "module.bash" file
[[root]]
pre-script = ./module.bash
[[my_task]]
script = my_script
1 Like