Skip to content

Commit

Permalink
Merge pull request cylc#5096 from wxtim/8.0.x.patch
Browse files Browse the repository at this point in the history
8.0.x.patch
  • Loading branch information
MetRonnie authored Aug 25, 2022
2 parents 38c932e + 397712b commit ba06b80
Show file tree
Hide file tree
Showing 7 changed files with 139 additions and 21 deletions.
17 changes: 17 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,30 @@ numbers of Cylc Lint's style issues and allow users to ignore Cylc Lint issues
using `--ignore <Issue Code>`.


-------------------------------------------------------------------------------
## __cylc-8.0.2 (<span actions:bind='release-date'>Upcoming</span>)__

Maintenance release.

### Fixes

[#5067](https://github.com/cylc/cylc-flow/pull/5067) - Datastore fix for
taskdefs removed before restart.

[#5066](https://github.com/cylc/cylc-flow/pull/5066) - Fix bug where
.cylcignore only found if `cylc install` is run in source directory.


-------------------------------------------------------------------------------
## __cylc-8.0.1 (<span actions:bind='release-date'>Released 2022-08-16</span>)__

Maintenance release.

### Fixes

[#5025](https://github.com/cylc/cylc-flow/pull/5025) - Fix a bug where polling
causes a failed task to be shown as submitted when the workflow is reloaded.

[#5045](https://github.com/cylc/cylc-flow/pull/5045) -
Fix issue where unsatisfied xtriggers could be wiped on reload.

Expand Down
9 changes: 6 additions & 3 deletions cylc/flow/data_store_mgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -818,12 +818,15 @@ def generate_ghost_task(self, tp_id, itask, is_parent=False):
if is_orphan:
self.generate_orphan_task(itask)

# Most the time the definition node will be in the store,
# so use try/except.
# Most of the time the definition node will be in the store.
try:
task_def = self.data[self.workflow_id][TASKS][t_id]
except KeyError:
task_def = self.added[TASKS][t_id]
try:
task_def = self.added[TASKS][t_id]
except KeyError:
# Task removed from workflow definition.
return False

update_time = time()
tp_stamp = f'{tp_id}@{update_time}'
Expand Down
5 changes: 4 additions & 1 deletion cylc/flow/task_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ def load_db_task_pool_for_restart(self, row_idx, row):
# Create a task proxy corresponding to this DB entry.
(cycle, name, flow_nums, is_late, status, is_held, submit_num, _,
platform_name, time_submit, time_run, timeout, outputs_str) = row

try:
itask = TaskProxy(
self.config.get_taskdef(name),
Expand All @@ -442,7 +443,9 @@ def load_db_task_pool_for_restart(self, row_idx, row):
else:
if status in (
TASK_STATUS_SUBMITTED,
TASK_STATUS_RUNNING
TASK_STATUS_RUNNING,
TASK_STATUS_FAILED,
TASK_STATUS_SUCCEEDED
):
# update the task proxy with platform
itask.platform = get_platform(platform_name)
Expand Down
5 changes: 3 additions & 2 deletions cylc/flow/workflow_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -1477,8 +1477,9 @@ def get_rsync_rund_cmd(src, dst, reinstall=False, dry_run=False):
if (Path(src).joinpath(exclude).exists() or
Path(dst).joinpath(exclude).exists()):
rsync_cmd.append(f"--exclude={exclude}")
if Path(src).joinpath('.cylcignore').exists():
rsync_cmd.append("--exclude-from=.cylcignore")
cylcignore_file = Path(src).joinpath('.cylcignore')
if cylcignore_file.exists():
rsync_cmd.append(f"--exclude-from={cylcignore_file}")
rsync_cmd.append(f"{src}/")
rsync_cmd.append(f"{dst}/")

Expand Down
44 changes: 29 additions & 15 deletions tests/functional/cylc-install/03-file-transfer.t
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
if ! command -v 'tree' >'/dev/null'; then
skip_all '"tree" command not available'
fi
set_test_number 6
set_test_number 9

# Need to override any symlink dirs set in global.cylc:
create_test_global_config "" "
Expand Down Expand Up @@ -69,24 +69,36 @@ __OUT__
popd || exit 1
purge_rnd_workflow


# Test cylc install copies files to run dir successfully, exluding files from .cylcignore file.
TEST_NAME="${TEST_NAME_BASE}-cylcignore-file"
make_rnd_workflow
pushd "${RND_WORKFLOW_SOURCE}" || exit 1
mkdir .git .svn dir1 dir2 extradir1 extradir2
touch .git/file1 .svn/file1 dir1/file1 dir2/file1 extradir1/file1 extradir2/file1 file1 file2 .cylcignore
cat > .cylcignore <<__END__
# Test cylc install copies files to run dir successfully, exluding files from
# .cylcignore file.
# Should work if we run "cylc install" from source dir or not (see GH #5066)
for RUN_IN_SRC_DIR in true false; do
TEST_NAME="${TEST_NAME_BASE}-cylcignore-${RUN_IN_SRC_DIR}"
make_rnd_workflow
pushd "${RND_WORKFLOW_SOURCE}" || exit 1
mkdir .git .svn dir1 dir2 extradir1 extradir2
touch .git/file1 .svn/file1 dir1/file1 dir2/file1 extradir1/file1 extradir2/file1 file1 file2 .cylcignore
cat > .cylcignore <<__END__
dir*
extradir*
file2
__END__

run_ok "${TEST_NAME}" cylc install --no-run-name
if ${RUN_IN_SRC_DIR}; then
run_ok "${TEST_NAME}" cylc install --no-run-name
CWD="${PWD}"
else
DTMP=$(mktemp -d)
pushd "${DTMP}" || exit 1
run_ok "${TEST_NAME}" cylc install --no-run-name "${RND_WORKFLOW_SOURCE}"
CWD="${PWD}"
popd || exit 1
fi

tree -a -v -I '*.log|03-file-transfer*' --charset=ascii --noreport "${RND_WORKFLOW_RUNDIR}/" > 'cylc-ignore-tree.out'
OUT="cylc-ignore-tree-${RUN_IN_SRC_DIR}.out"
tree -a -v -I '*.log|03-file-transfer*' --charset=ascii --noreport "${RND_WORKFLOW_RUNDIR}/" > "$OUT"

cmp_ok 'cylc-ignore-tree.out' <<__OUT__
cmp_ok "$OUT" <<__OUT__
${RND_WORKFLOW_RUNDIR}/
|-- _cylc-install
| \`-- source -> ${RND_WORKFLOW_SOURCE}
Expand All @@ -96,8 +108,10 @@ ${RND_WORKFLOW_RUNDIR}/
\`-- install
__OUT__

contains_ok "${TEST_NAME}.stdout" <<__OUT__
contains_ok "${CWD}/${TEST_NAME}.stdout" <<__OUT__
INSTALLED $RND_WORKFLOW_NAME from ${RND_WORKFLOW_SOURCE}
__OUT__
popd || exit 1
purge_rnd_workflow

popd || exit 1
purge_rnd_workflow
done
48 changes: 48 additions & 0 deletions tests/functional/restart/58-removed-task.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/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/>.
#-------------------------------------------------------------------------------

# GitHub 5067: if a task is removed from the graph after shutdown, it should not
# cause an error at restart. If it was a failed incomplete task, however, it
# should still be polled and logged at restart.

. "$(dirname "$0")/test_header"

set_test_number 7

install_workflow "${TEST_NAME_BASE}" "${TEST_NAME_BASE}"

run_ok "${TEST_NAME_BASE}-validate" cylc validate --set="INCL_B_C=True" "${WORKFLOW_NAME}"
run_ok "${TEST_NAME_BASE}-validate" cylc validate --set="INCL_B_C=False" "${WORKFLOW_NAME}"

TEST_NAME="${TEST_NAME_BASE}-run"
workflow_run_ok "${TEST_NAME}" cylc play -n "${WORKFLOW_NAME}"

# Restart with removed tasks should not cause an error.
# It should shut down cleanly after orphaned task a and incomplete failed task
# b are polled (even though b has been removed from the graph) and a finishes
# (after checking the poll results).
TEST_NAME="${TEST_NAME_BASE}-restart"
workflow_run_ok "${TEST_NAME}" cylc play --set="INCL_B_C=False" -n "${WORKFLOW_NAME}"

grep_workflow_log_ok "grep-3" "\[1/a running job:01 flows:1\] (polled)started"
grep_workflow_log_ok "grep-4" "\[1/b failed job:01 flows:1\] (polled)failed"

# Failed (but not incomplete) task c should not have been polled.
grep_fail "\[1/c failed job:01 flows:1\] (polled)failed" "${WORKFLOW_RUN_DIR}/log/scheduler/log"

purge
32 changes: 32 additions & 0 deletions tests/functional/restart/58-removed-task/flow.cylc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!Jinja2

# Task a shuts the scheduler down cleanly with --now after b and c have failed.
# On restart, a waits for a and b to be polled before finishing (otherwise we
# could shut down before poll results come in).

{% set INCL_B_C = INCL_B_C | default(True) %}
[scheduler]
[[events]]
stall timeout = PT0S
abort on stall timeout = True
inactivity timeout = PT30S
abort on inactivity timeout = True
[scheduling]
[[graph]]
R1 = """
a
{% if INCL_B_C %}
b & c?
{% endif %}
"""
[runtime]
[[a]]
script = """
cylc__job__poll_grep_workflow_log "1/b .*failed"
cylc__job__poll_grep_workflow_log "1/c .*failed"
cylc stop --now $CYLC_WORKFLOW_ID
cylc__job__poll_grep_workflow_log "1/a .*(polled)started"
cylc__job__poll_grep_workflow_log "1/b .*(polled)failed"
"""
[[b, c]]
script = "false"

0 comments on commit ba06b80

Please sign in to comment.