Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't repeatedly mark queued tasks as ready to run. #1789

Merged
merged 4 commits into from
Apr 20, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/cylc/task_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,10 +498,13 @@ def retry_delay_done(self):
self.sub_try_state.is_delay_done(now))

def ready_to_run(self):
"""Is this task ready to run?"""
"""Am I in a pre-run state but ready to run?

Queued tasks are not counted as they've already been deemed ready.

"""
ready = (
(
self.state.is_currently('queued') or
(
self.state.is_currently('waiting') and
self.prerequisites_are_all_satisfied() and
Expand Down
18 changes: 18 additions & 0 deletions tests/lib/bash/test_header
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
# (stdin if FILE_CONTROL is "-" or missing).
# grep_ok PATTERN FILE
# Run "grep -q PATTERN FILE".
# count_ok PATTERN FILE COUNT
# Test that PATTERN occurs in exactly COUNT lines of FILE.
# exists_ok FILE
# Test that FILE exists
# exists_fail FILE
Expand Down Expand Up @@ -235,6 +237,22 @@ function grep_ok() {
fail $TEST_NAME
}

function count_ok() {
local BRE=$1
local FILE=$2
local COUNT=$3
local TEST_NAME=$(basename "$FILE")-count-ok
NEW_COUNT=$(grep -c "$BRE" "$FILE")
if (( NEW_COUNT == COUNT )); then
ok $TEST_NAME
return
fi
echo "Found $NEW_COUNT (not $COUNT) of $BRE in $FILE" > $TEST_NAME.stderr
mkdir -p $TEST_LOG_DIR
cp $TEST_NAME.stderr $TEST_LOG_DIR/$TEST_NAME.stderr
fail $TEST_NAME
}

function exists_ok() {
local FILE=$1
local TEST_NAME=$(basename "$FILE")-file-exists-ok
Expand Down
36 changes: 36 additions & 0 deletions tests/task-proc-loop/00-count.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash
# THIS FILE IS PART OF THE CYLC SUITE ENGINE.
# Copyright (C) 2008-2015 NIWA
#
# 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/>.

# Test that presence of queued tasks does not cause dependency matching etc. in
# the absence of other activity - GitHub #1787. WARNING: this test is sensitive
# to the number of times the task pool gets processed as the suite runs, in
# response to task state changes. It will need to be updated if that number
# changes in the future.

. $(dirname $0)/test_header

set_test_number 3
install_suite "${TEST_NAME_BASE}" "${TEST_NAME_BASE}"

run_ok "${TEST_NAME_BASE}-validate" cylc validate "${SUITE_NAME}"
run_ok "${TEST_NAME_BASE}" cylc run --debug "${SUITE_NAME}"

SUITE_LOG_DIR="$(cylc get-global-config --print-run-dir)/${SUITE_NAME}/log/suite"
count_ok "BEGIN TASK PROCESSING" $SUITE_LOG_DIR/log 6

purge_suite "${SUITE_NAME}"
exit
13 changes: 13 additions & 0 deletions tests/task-proc-loop/00-count/suite.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[cylc]
[[event hooks]]
timeout = PT1M
abort on timeout = True
[scheduling]
[[queues]]
[[[default]]]
limit = 1
[[dependencies]]
graph = m1 & m2
[runtime]
[[m1, m2]]
script = sleep 10
1 change: 1 addition & 0 deletions tests/task-proc-loop/test_header