-
Notifications
You must be signed in to change notification settings - Fork 94
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
Add run mode skip to cylc show #6554
Open
wxtim
wants to merge
11
commits into
cylc:master
Choose a base branch
from
wxtim:feat.skip_shown_in_cylc_show
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+113
−14
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
147020a
add run mode skip to cylc show
wxtim 818efc0
test changing task mode with broadcast
wxtim 7c626a3
fixed a broken test
wxtim 4ca26a0
Apply suggestions from code review
wxtim c397b61
fix broken test
wxtim c651f70
make run mode enum extend string to allow easier comparison, and allo…
wxtim 1bbecbb
remove run-mode inheriting str
wxtim 37aa3e4
added a test for RunMode._missing_
wxtim d2b701d
Update cylc/flow/scripts/show.py
wxtim a72e4b0
Update changes.d/6554.feat.md
wxtim e87e8ce
Merge branch 'master' into feat.skip_shown_in_cylc_show
wxtim File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
`cylc show` now displays when a task has been set to skip mode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -16,6 +16,7 @@ | |||
|
||||
import json | ||||
import pytest | ||||
import re | ||||
from types import SimpleNamespace | ||||
|
||||
from colorama import init as colour_init | ||||
|
@@ -26,6 +27,9 @@ | |||
) | ||||
|
||||
|
||||
RE_STATE = re.compile('state:.*') | ||||
|
||||
|
||||
@pytest.fixture(scope='module') | ||||
def mod_my_conf(): | ||||
"""A workflow configuration with some workflow metadata.""" | ||||
|
@@ -59,8 +63,8 @@ def mod_my_conf(): | |||
'destroyedtheworldyet.com/' | ||||
), | ||||
'question': 'mutually exclusive', | ||||
} | ||||
} | ||||
}, | ||||
}, | ||||
}, | ||||
} | ||||
|
||||
|
@@ -128,6 +132,7 @@ async def test_task_meta_query(mod_my_schd, capsys): | |||
) | ||||
assert ret == 0 | ||||
out, err = capsys.readouterr() | ||||
|
||||
assert out.splitlines() == [ | ||||
'title: Task Title', | ||||
'question: mutually exclusive', | ||||
|
@@ -170,9 +175,9 @@ async def test_task_instance_query( | |||
'scheduling': { | ||||
'graph': {'R1': 'zed & dog & cat & ant'}, | ||||
}, | ||||
} | ||||
}, | ||||
), | ||||
paused_start=False | ||||
paused_start=False, | ||||
) | ||||
async with start(schd): | ||||
await schd.update_data_structure() | ||||
|
@@ -195,20 +200,32 @@ async def test_task_instance_query( | |||
] | ||||
|
||||
|
||||
@pytest.mark.parametrize( | ||||
'workflow_run_mode, run_mode_info', | ||||
( | ||||
('live', 'Skip'), | ||||
('dummy', 'Dummy'), | ||||
('simulation', 'Simulation'), | ||||
) | ||||
) | ||||
@pytest.mark.parametrize( | ||||
'attributes_bool, flow_nums, expected_state, expected_flows', | ||||
[ | ||||
pytest.param( | ||||
False, [1], 'state: waiting', None, | ||||
False, [1], 'state: waiting (run mode={})', None, | ||||
), | ||||
pytest.param( | ||||
True, [1, 2], 'state: waiting (held,queued,runahead)', 'flows: [1,2]', | ||||
True, | ||||
[1, 2], | ||||
'state: waiting (held,queued,runahead,run mode={})', | ||||
'flows: [1,2]', | ||||
) | ||||
] | ||||
) | ||||
async def test_task_instance_state_flows( | ||||
flow, scheduler, start, capsys, | ||||
attributes_bool, flow_nums, expected_state, expected_flows | ||||
workflow_run_mode, run_mode_info, | ||||
attributes_bool, flow_nums, expected_state, expected_flows | ||||
): | ||||
"""It should print task instance state, attributes, and flows.""" | ||||
|
||||
|
@@ -225,9 +242,13 @@ async def test_task_instance_state_flows( | |||
'scheduling': { | ||||
'graph': {'R1': 'a'}, | ||||
}, | ||||
} | ||||
'runtime': { | ||||
'a': {'run mode': 'skip'} | ||||
} | ||||
}, | ||||
), | ||||
paused_start=True | ||||
paused_start=True, | ||||
run_mode=workflow_run_mode, | ||||
) | ||||
async with start(schd): | ||||
|
||||
|
@@ -257,7 +278,7 @@ async def test_task_instance_state_flows( | |||
line for line in out.splitlines() | ||||
if line.startswith("state:") | ||||
] == [ | ||||
expected_state, | ||||
expected_state.format(run_mode_info), | ||||
] | ||||
if expected_flows is not None: | ||||
assert [ | ||||
|
@@ -266,3 +287,47 @@ async def test_task_instance_state_flows( | |||
] == [ | ||||
expected_flows, | ||||
] | ||||
|
||||
|
||||
async def test_task_run_mode_changes(flow, scheduler, start, capsys): | ||||
"""Broadcasting a change of run mode changes run mode shown by cylc show. | ||||
""" | ||||
opts = SimpleNamespace( | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have the cylc-flow/cylc/flow/scripts/show.py Line 256 in e87e8ce
|
||||
comms_timeout=5, | ||||
json=False, | ||||
task_defs=None, | ||||
list_prereqs=False, | ||||
) | ||||
schd = scheduler( | ||||
flow({'scheduling': {'graph': {'R1': 'a'}}}), | ||||
run_mode='live' | ||||
) | ||||
|
||||
async with start(schd): | ||||
# Control: No mode set, the Run Mode setting is not shown: | ||||
await schd.update_data_structure() | ||||
ret = await show( | ||||
schd.workflow, | ||||
[Tokens('//1/a')], | ||||
opts, | ||||
) | ||||
assert ret == 0 | ||||
out, _ = capsys.readouterr() | ||||
state, = RE_STATE.findall(out) | ||||
assert 'waiting' in state | ||||
|
||||
# Broadcast change task to skip mode: | ||||
schd.broadcast_mgr.put_broadcast(['1'], ['a'], [{'run mode': 'skip'}]) | ||||
await schd.update_data_structure() | ||||
|
||||
# show now shows skip mode: | ||||
ret = await show( | ||||
schd.workflow, | ||||
[Tokens('//1/a')], | ||||
opts, | ||||
) | ||||
assert ret == 0 | ||||
|
||||
out, _ = capsys.readouterr() | ||||
state, = RE_STATE.findall(out) | ||||
assert 'run mode=Skip' in state |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI broadcasting a run mode of live or skip seems to override this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's correct right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't be able to broadcast task run mode = live when the workflow is running in simulation or dummy mode? Not that it matters too much
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah right, yes. Unfortunately rather hard to prevent but will result in
run mode
being set (and reported) with an erroneous value :(