Skip to content

Commit 2bd7d4b

Browse files
Use bash login shell for cylc commands (#149)
Addresses problems caused by recent changes to system profile scripts by wrapping cylc commands with bash -l. Also retire old fcm support.
1 parent a07f821 commit 2bd7d4b

File tree

3 files changed

+11
-497
lines changed

3 files changed

+11
-497
lines changed

nightly_testing/example_meto_configs.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ um_heads_all:
117117
- USE_EXAB=true
118118
- HOUSEKEEPING=false
119119
- PREBUILDS=false
120-
monitoring: True
121120
time_launch: 00:05
122121
time_clean: 00:15
123122
period: weekly
@@ -185,7 +184,6 @@ um_heads_nightly:
185184
- USE_EXAB=true
186185
- HOUSEKEEPING=false
187186
- PREBUILDS=false
188-
monitoring: True
189187
time_launch: 00:05
190188
time_clean: 00:15
191189
period: nightly

nightly_testing/generate_test_suite_cron.py

Lines changed: 11 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
Optional:
2727
* revisions: heads to use the HoT for sub-repos, set to use the set revisions
2828
* vars: strings that follow the -S command on the command line
29-
* monitoring: Boolean, whether to run the monitoring script on this suite
3029
* cylc_version: Can be any string beginning 8 that is a valid cylc install
3130
at the site, such that `export CYLC_VERSION=<cylc_version>`
3231
works.
@@ -57,9 +56,8 @@
5756
CLONE_DIR = os.path.join(os.environ["TMPDIR"], os.environ["USER"])
5857
MIRROR_PATH = "/data/users/gitassist/git_mirrors/"
5958
UMDIR = os.environ["UMDIR"]
60-
PROFILE = ". /etc/profile"
59+
CYLC = "bash -l cylc"
6160
DATE_BASE = "date +\\%Y-\\%m-\\%d"
62-
MONITORING_TIME = "00 06"
6361

6462

6563
def run_command(command):
@@ -82,7 +80,7 @@ def create_git_clone_cron(repo):
8280

8381
command = f"# Clone {repo} - every day at 23:30 #"
8482
length = len(command)
85-
command = f"{length*'#'}\n{command}\n{length*'#'}\n30 23 * * * {PROFILE} ; "
83+
command = f"{length*'#'}\n{command}\n{length*'#'}\n30 23 * * * "
8684
command += f"rm -rf {clone_path} ; "
8785
command += f"git clone {repo_mirror} {clone_path}"
8886
return command + "\n\n\n"
@@ -93,9 +91,7 @@ def generate_cron_timing_str(suite, mode):
9391
Return a string with the cron timing info included but no commands
9492
"""
9593

96-
if mode == "monitoring":
97-
cron = f"{MONITORING_TIME}"
98-
elif mode == "main":
94+
if mode == "main":
9995
cron = suite["cron_launch"]
10096
elif mode == "clean":
10197
cron = suite["cron_clean"]
@@ -104,17 +100,17 @@ def generate_cron_timing_str(suite, mode):
104100
cron += " * * "
105101

106102
if suite["period"] == "weekly":
107-
if mode == "main" or mode == "monitoring":
103+
if mode == "main":
108104
cron += "1 "
109105
else:
110106
cron += "7 "
111107
elif suite["period"] == "nightly_all":
112-
if mode == "main" or mode == "monitoring":
108+
if mode == "main":
113109
cron += "1-5 "
114110
else:
115111
cron += "2-6 "
116112
else:
117-
if mode == "main" or mode == "monitoring":
113+
if mode == "main":
118114
cron += "2-5 "
119115
else:
120116
cron += "3-6 "
@@ -146,38 +142,14 @@ def generate_header(name, suite):
146142
return header
147143

148144

149-
def generate_monitoring(name, suite, log_file):
150-
"""
151-
Generate the monitoring command cron job
152-
Default to off if not specified in config
153-
"""
154-
155-
# Return empty string if not required - default to this state
156-
if "monitoring" not in suite or not suite["monitoring"]:
157-
return ""
158-
159-
script = os.path.join(UMDIR, "bin", "monitoring.py")
160-
cylc_dir = os.path.expanduser(os.path.join("~", "cylc-run", name))
161-
162-
monitoring = generate_cron_timing_str(suite, "monitoring")
163-
164-
monitoring += (
165-
f"{PROFILE} ; module load scitools/default-current ; "
166-
f"{script} {cylc_dir} >> {log_file} 2>&1"
167-
)
168-
169-
return monitoring + "\n"
170-
171-
172145
def generate_clean_commands(cylc_version, name, log_file):
173146
"""
174147
Generate the commands used to clean the suite
175148
"""
176149
return (
177-
f"{PROFILE} ; "
178150
f"export CYLC_VERSION={cylc_version} ; "
179-
f"cylc stop --kill '{name}' >/dev/null 2>&1 ; sleep 10 ; "
180-
f"cylc clean --timeout=7200 -y -q {name} "
151+
f"{CYLC} stop --kill '{name}' >/dev/null 2>&1 ; sleep 10 ; "
152+
f"{CYLC} clean --timeout=7200 -y -q {name} "
181153
f">> {log_file} 2>&1\n"
182154
)
183155

@@ -208,7 +180,7 @@ def generate_cylc_command(suite, wc_path, cylc_version, name):
208180

209181
command = (
210182
f"export CYLC_VERSION={cylc_version} ; "
211-
f"cylc vip -z g={suite['groups']} "
183+
f"{CYLC} vip -z g={suite['groups']} "
212184
f"-n {name} "
213185
f"-S USE_MIRRORS=true "
214186
)
@@ -242,7 +214,7 @@ def generate_main_job(name, suite, log_file, wc_path, cylc_version):
242214
# Set up the timing for this job
243215
cron_job = generate_cron_timing_str(suite, "main")
244216

245-
job_command = f"{PROFILE} ; "
217+
job_command = " "
246218

247219
# Begin rose-stem command
248220
job_command += generate_cylc_command(suite, wc_path, cylc_version, name)
@@ -282,10 +254,9 @@ def generate_cron_job(suite_name, suite, log_file):
282254

283255
header = generate_header(suite_name, suite)
284256
cron_job = generate_main_job(name, suite, log_file, wc_path, cylc_version)
285-
monitoring = generate_monitoring(name, suite, log_file)
286257
clean_cron = generate_clean_cron(suite_name, suite, log_file, cylc_version)
287258

288-
return header + cron_job + monitoring + clean_cron
259+
return header + cron_job + clean_cron
289260

290261

291262
def parse_cl_args():

0 commit comments

Comments
 (0)