mirror of
https://github.com/cp2k/cp2k.git
synced 2026-07-28 06:05:29 -04:00
Docker: Handle preemption gracefully
This commit is contained in:
parent
10272510ad
commit
0c57f232ce
1 changed files with 10 additions and 0 deletions
|
|
@ -29,6 +29,16 @@ function upload_file {
|
|||
wget --quiet --output-document=- --method=PUT --header="content-type: ${CONTENT_TYPE}" --header="cache-control: no-cache" --body-file="${FILE}" "${URL}" > /dev/null
|
||||
}
|
||||
|
||||
# Handle preemption gracefully.
|
||||
function sigterm_handler {
|
||||
echo -e "\nThis job just got preempted. No worries, it should restart soon.\n" | tee -a $REPORT
|
||||
echo -n "EndDate: " | tee -a $REPORT
|
||||
date --utc --rfc-3339=seconds | tee -a $REPORT
|
||||
upload_file "${REPORT_UPLOAD_URL}" "${REPORT}" "text/plain;charset=utf-8"
|
||||
exit 1
|
||||
}
|
||||
trap sigterm_handler SIGTERM
|
||||
|
||||
# Upload preliminary report every 30s in the background.
|
||||
(
|
||||
while true ; do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue