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

gui: fix raw graph for cycling suite, again #2209

Merged
merged 2 commits into from
Mar 22, 2017
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
5 changes: 4 additions & 1 deletion lib/cylc/network/https/suite_info_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,11 @@ def get_graph_raw(self, start_point_string, stop_point_string,
if isinstance(stop_point_string, basestring):
try:
stop_point_string = ast.literal_eval(stop_point_string)
except ValueError:
except (SyntaxError, ValueError):
pass
else:
if stop_point_string is not None:
stop_point_string = str(stop_point_string)
return self._put(
"get_graph_raw", (start_point_string, stop_point_string),
{"group_nodes": group_nodes,
Expand Down
56 changes: 56 additions & 0 deletions tests/api-suite-info/02-get-graph-raw-3.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/bash
# THIS FILE IS PART OF THE CYLC SUITE ENGINE.
# Copyright (C) 2008-2017 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 suite info API, get_graph_raw, simple usage
. "$(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}"
suite_run_ok "${TEST_NAME_BASE}-run" \
cylc run --reference-test --debug "${SUITE_NAME}"
cmp_ok "${SUITE_RUN_DIR}/ctb-get-graph-raw.out" <<'__OUT__'
[
[
[
"t1.2020",
null,
null,
false,
false
],
[
"t1.2020",
"t1.2021",
null,
false,
false
]
],
{},
[
"t1"
],
[
"t1"
]
]
__OUT__

purge_suite "${SUITE_NAME}"
exit
44 changes: 44 additions & 0 deletions tests/api-suite-info/02-get-graph-raw-3/bin/ctb-get-graph-raw
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env python

# THIS FILE IS PART OF THE CYLC SUITE ENGINE.
# Copyright (C) 2008-2017 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/>.
"""Suite Info API test, get_graph_raw."""

import json
import os
import sys

from cylc.network.suite_info_client import SuiteInfoClient


def main():
kwargs = {
'start_point_string': None,
'stop_point_string': None,
'group_nodes': None,
'ungroup_nodes': None,
'ungroup_recursive': False,
'group_all': False,
'ungroup_all': False}
for item in sys.argv[1:]:
key, value = item.split('=', 1)
kwargs[key] = value
client = SuiteInfoClient(os.environ['CYLC_SUITE_NAME'])
print json.dumps(client.get_info('get_graph_raw', **kwargs), indent=4)


if __name__ == "__main__":
main()
4 changes: 4 additions & 0 deletions tests/api-suite-info/02-get-graph-raw-3/reference.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
2013/09/30 16:48:11 INFO - Initial point: 2020
2013/09/30 16:48:11 INFO - Final point: 2021
2013/09/30 16:48:11 INFO - [t1.2020] -triggered off []
2013/09/30 16:48:11 INFO - [t1.2021] -triggered off ['t1.2020']
20 changes: 20 additions & 0 deletions tests/api-suite-info/02-get-graph-raw-3/suite.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[cylc]
cycle point format = %Y
[[reference test]]
required run mode = live
live mode suite timeout = PT30S
[scheduling]
initial cycle point = 2020
final cycle point = 2021
[[dependencies]]
[[[P1Y]]]
graph = t1[-P1Y] => t1
[runtime]
[[t1]]
script = """
if [[ "${CYLC_TASK_CYCLE_POINT}" == '2020' ]]; then
ctb-get-graph-raw \
'start_point_string=2020' 'stop_point_string=2021' 'group_nodes=T' \
>"${CYLC_SUITE_RUN_DIR}/ctb-get-graph-raw.out"
fi
"""
56 changes: 56 additions & 0 deletions tests/api-suite-info/03-get-graph-raw-4.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/bash
# THIS FILE IS PART OF THE CYLC SUITE ENGINE.
# Copyright (C) 2008-2017 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 suite info API, get_graph_raw, simple usage, non-digit ICP
. "$(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}"
suite_run_ok "${TEST_NAME_BASE}-run" \
cylc run --reference-test --debug "${SUITE_NAME}"
cmp_ok "${SUITE_RUN_DIR}/ctb-get-graph-raw.out" <<'__OUT__'
[
[
[
"t1.20200202T0000Z",
null,
null,
false,
false
],
[
"t1.20200202T0000Z",
"t1.20200203T0000Z",
null,
false,
false
]
],
{},
[
"t1"
],
[
"t1"
]
]
__OUT__

purge_suite "${SUITE_NAME}"
exit
44 changes: 44 additions & 0 deletions tests/api-suite-info/03-get-graph-raw-4/bin/ctb-get-graph-raw
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env python

# THIS FILE IS PART OF THE CYLC SUITE ENGINE.
# Copyright (C) 2008-2017 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/>.
"""Suite Info API test, get_graph_raw."""

import json
import os
import sys

from cylc.network.suite_info_client import SuiteInfoClient


def main():
kwargs = {
'start_point_string': None,
'stop_point_string': None,
'group_nodes': None,
'ungroup_nodes': None,
'ungroup_recursive': False,
'group_all': False,
'ungroup_all': False}
for item in sys.argv[1:]:
key, value = item.split('=', 1)
kwargs[key] = value
client = SuiteInfoClient(os.environ['CYLC_SUITE_NAME'])
print json.dumps(client.get_info('get_graph_raw', **kwargs), indent=4)


if __name__ == "__main__":
main()
4 changes: 4 additions & 0 deletions tests/api-suite-info/03-get-graph-raw-4/reference.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
2013/09/30 16:48:11 INFO - Initial point: 20200202T0000Z
2013/09/30 16:48:11 INFO - Final point: 20200203T0000Z
2013/09/30 16:48:11 INFO - [t1.20200202T0000Z] -triggered off []
2013/09/30 16:48:11 INFO - [t1.20200203T0000Z] -triggered off ['t1.20200202T0000Z']
21 changes: 21 additions & 0 deletions tests/api-suite-info/03-get-graph-raw-4/suite.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[cylc]
[[reference test]]
required run mode = live
live mode suite timeout = PT30S
[scheduling]
initial cycle point = 20200202T0000Z
final cycle point = 20200203T0000Z
[[dependencies]]
[[[P1D]]]
graph = t1[-P1D] => t1
[runtime]
[[t1]]
script = """
if [[ "${CYLC_TASK_CYCLE_POINT}" == '20200202T0000Z' ]]; then
ctb-get-graph-raw \
'start_point_string=20200202T0000Z' \
'stop_point_string=20200203T0000Z' \
'group_nodes=T' \
>"${CYLC_SUITE_RUN_DIR}/ctb-get-graph-raw.out"
fi
"""