Skip to content

Commit a542523

Browse files
Fixed the issue where CPU / Max RSS data is not available in the event of job failure
1 parent 99f9ae5 commit a542523

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

cylc/flow/etc/job.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,6 @@ cylc__job__main() {
164164
fi
165165
}
166166
# Grab the max rss and cpu_time value before moving directory
167-
if [[ -f "max_rss" ]]; then
168-
max_rss=$(cat max_rss)
169-
rm max_rss
170-
fi
171-
if [[ -f "cpu_time" ]]; then
172-
cpu_time=$(cat cpu_time)
173-
rm cpu_time
174-
fi
175167
cylc__kill_profiler
176168
# Empty work directory remove
177169
cd
@@ -208,6 +200,14 @@ cylc__set_return() {
208200
###############################################################################
209201
# Save the data using cylc message and exit the profiler
210202
cylc__kill_profiler() {
203+
if [[ -f "max_rss" ]]; then
204+
max_rss=$(cat max_rss)
205+
rm max_rss
206+
fi
207+
if [[ -f "cpu_time" ]]; then
208+
cpu_time=$(cat cpu_time)
209+
rm cpu_time
210+
fi
211211
if [[ -n "${cpu_time:-}" ]]; then
212212
cylc message -- "${CYLC_WORKFLOW_ID}" "${CYLC_TASK_JOB}" "DEBUG: cpu_time $cpu_time" || true
213213
fi

tests/functional/jobscript/02-profiler.t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ create_test_global_config "
2828
[[${CYLC_TEST_PLATFORM}]]
2929
[[[profile]]]
3030
activate = True
31-
# TODO: set the interval to something like 1s
31+
polling interval = 1
3232
[[localhost]]
3333
[[[profile]]]
3434
activate = True
@@ -50,7 +50,7 @@ init_workflow "${TEST_NAME_BASE}" <<'__FLOW_CONFIG__'
5050
[[the_bad]]
5151
# this task should fail (it should still send profiling info)
5252
platform = {{ environ['CYLC_TEST_PLATFORM'] }}
53-
script = false
53+
script = sleep 5; false
5454
[[the_ugly]]
5555
# this task should succeed despite the broken profiler configuration
5656
platform = localhost

0 commit comments

Comments
 (0)