Skip to content

Commit

Permalink
gscan: display cylc versions of suites
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewrmshin committed Sep 10, 2018
1 parent 0769691 commit a65da5c
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 17 deletions.
3 changes: 2 additions & 1 deletion lib/cylc/cfgspec/gscan.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,11 @@ class GScanConfig(config):
COL_TITLE = "Title"
COL_UPDATED = "Updated"
COL_STATUS = "Status"
COL_VERSION = "Version"
COLS_DEFAULT = (COL_SUITE.lower(), COL_STATUS.lower())
COLS = [col.lower() for col in (
COL_GROUP, COL_HOST, COL_OWNER, COL_SUITE, COL_TITLE, COL_UPDATED,
COL_STATUS)]
COL_STATUS, COL_VERSION)]

def check(self):
"""Custom configuration check."""
Expand Down
38 changes: 25 additions & 13 deletions lib/cylc/gui/gscan.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
from cylc.network.port_scan import re_compile_filters
from cylc.suite_status import (
KEY_GROUP, KEY_META, KEY_STATES, KEY_TASKS_BY_STATE, KEY_TITLE,
KEY_UPDATE_TIME)
KEY_UPDATE_TIME, KEY_VERSION)
from cylc.task_state import (
TASK_STATUSES_ORDERED, TASK_STATUS_RUNAHEAD, TASK_STATUS_FAILED,
TASK_STATUS_SUBMIT_FAILED)
Expand All @@ -48,12 +48,13 @@ class ScanApp(object):

"""Summarize running suite statuses for a given set of hosts."""

WARNINGS_COLUMN = 9
STATUS_COLUMN = 8
CYCLE_COLUMN = 7
UPDATE_TIME_COLUMN = 6
TITLE_COLUMN = 5
STOPPED_COLUMN = 4
WARNINGS_COLUMN = 10
STATUS_COLUMN = 9
CYCLE_COLUMN = 8
UPDATE_TIME_COLUMN = 7
TITLE_COLUMN = 6
STOPPED_COLUMN = 5
VERSION_COLUMN = 4
SUITE_COLUMN = 3
OWNER_COLUMN = 2
HOST_COLUMN = 1
Expand Down Expand Up @@ -90,6 +91,7 @@ def __init__(
str, # host
str, # owner
str, # suite
str, # version
bool, # is_stopped
str, # title
int, # update_time
Expand All @@ -111,6 +113,8 @@ def __init__(
(gsfg.COL_HOST, self.HOST_COLUMN, self._set_cell_text_host),
(gsfg.COL_OWNER, self.OWNER_COLUMN, self._set_cell_text_owner),
(gsfg.COL_SUITE, self.SUITE_COLUMN, self._set_cell_text_name),
(gsfg.COL_VERSION, self.VERSION_COLUMN,
self._set_cell_text_version),
(gsfg.COL_TITLE, self.TITLE_COLUMN, self._set_cell_text_title),
(gsfg.COL_UPDATED, self.UPDATE_TIME_COLUMN,
self._set_cell_text_time),
Expand Down Expand Up @@ -698,6 +702,13 @@ def _set_cell_text_name(self, _, cell, model, iter_):
cell.set_property("sensitive", not is_stopped)
cell.set_property("text", name)

def _set_cell_text_version(self, _, cell, model, iter_):
"""Set cell text for (suite version) "version" column."""
value = model.get_value(iter_, self.VERSION_COLUMN)
is_stopped = model.get_value(iter_, self.STOPPED_COLUMN)
cell.set_property("sensitive", not is_stopped)
cell.set_property("text", value)

def _set_cell_text_title(self, _, cell, model, iter_):
"""Set cell text for "title" column."""
title = model.get_value(iter_, self.TITLE_COLUMN)
Expand Down Expand Up @@ -911,6 +922,7 @@ def update(self):
suite_updated_time = suite_info.get(KEY_UPDATE_TIME)
if suite_updated_time is None:
suite_updated_time = int(time())
suite_version = suite_info.get(KEY_VERSION, '(< 7.8.0)')
try:
title = suite_info[KEY_META].get(KEY_TITLE)
group = suite_info[KEY_META].get(KEY_GROUP)
Expand Down Expand Up @@ -940,7 +952,7 @@ def update(self):
summary_text = "%s - %d" % (
group, group_counts[group]['total'])
group_iters[group] = self.suite_treemodel.append(None, [
summary_text, None, None, None, False, None,
summary_text, None, None, None, None, False, None,
suite_updated_time, None, states_text, None])

tasks = sorted(self._get_warnings(key), reverse=True)
Expand All @@ -953,8 +965,8 @@ def update(self):
# Total count of each state
parent_iter = self.suite_treemodel.append(
group_iters.get(group), [
None, host, owner, suite, is_stopped, title,
suite_updated_time, None,
None, host, owner, suite, suite_version,
is_stopped, title, suite_updated_time, None,
self._states_to_text(suite_info[KEY_STATES][0]),
warning_text])
# Count of each state by cycle points
Expand All @@ -965,13 +977,13 @@ def update(self):
continue
self.suite_treemodel.append(
parent_iter, [
None, None, None, None, is_stopped, None,
suite_updated_time, str(point),
None, None, None, None, suite_version, is_stopped,
None, suite_updated_time, str(point),
states_text, warning_text])
else:
# No states in suite_info
self.suite_treemodel.append(group_iters.get(group), [
None, host, owner, suite, is_stopped, title,
None, host, owner, suite, suite_version, is_stopped, title,
suite_updated_time, None, None, warning_text])

self.suite_treemodel.foreach(self._expand_row, row_ids)
Expand Down
3 changes: 2 additions & 1 deletion lib/cylc/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
SuiteSrvFilesManager, SuiteServiceFileError)
from cylc.suite_status import (
KEY_DESCRIPTION, KEY_GROUP, KEY_META, KEY_NAME, KEY_OWNER, KEY_STATES,
KEY_TASKS_BY_STATE, KEY_TITLE, KEY_UPDATE_TIME)
KEY_TASKS_BY_STATE, KEY_TITLE, KEY_UPDATE_TIME, KEY_VERSION)
from cylc.taskdef import TaskDef
from cylc.task_id import TaskID
from cylc.task_job_mgr import TaskJobManager
Expand Down Expand Up @@ -755,6 +755,7 @@ def info_get_identity(self, privileges):
if PRIVILEGE_LEVELS[0] in privileges:
result[KEY_NAME] = self.suite
result[KEY_OWNER] = self.owner
result[KEY_VERSION] = CYLC_VERSION
if PRIVILEGE_LEVELS[1] in privileges:
result[KEY_META] = self.config.cfg[KEY_META]
for key in (KEY_TITLE, KEY_DESCRIPTION, KEY_GROUP):
Expand Down
1 change: 1 addition & 0 deletions lib/cylc/suite_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
KEY_TASKS_BY_STATE = "tasks-by-state"
KEY_TITLE = "title"
KEY_UPDATE_TIME = "update-time"
KEY_VERSION = "version"

# Suite status strings.
SUITE_STATUS_HELD = "held"
Expand Down
1 change: 1 addition & 0 deletions tests/authentication/00-identity.t
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ cmp_json_ok 'scan-j.out' 'scan-j.out' << __END__
${PORT},
{
"owner":"${USER}",
"version": "$(cylc version)",
"name":"${SUITE_NAME}"
}
]
Expand Down
3 changes: 2 additions & 1 deletion tests/authentication/01-description.t
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,9 @@ cmp_json_ok 'scan-j.out' 'scan-j.out' <<__END__
"${PORT}",
{
"group":"",
"description":"Stalls when the first task fails.\n Here we test out a multi-line description!",
"version":"$(cylc version)",
"title":"Authentication test suite.",
"description":"Stalls when the first task fails.\n Here we test out a multi-line description!",
"meta":{
"group":"",
"description":"Stalls when the first task fails.\n Here we test out a multi-line description!",
Expand Down
1 change: 1 addition & 0 deletions tests/authentication/02-state-totals.t
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ cmp_json_ok 'scan-j.out' 'scan-j.out' <<__END__
"${PORT}",
{
"group":"",
"version":"$(cylc version)",
"description":"Stalls when the first task fails.\n Here we test out a multi-line description!",
"title":"Authentication test suite.",
"states":[
Expand Down
1 change: 1 addition & 0 deletions tests/authentication/03-full-read.t
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ cmp_json_ok 'scan-j.out' 'scan-j.out' <<__END__
"${PORT}",
{
"group":"",
"version":"$(cylc version)",
"description":"Stalls when the first task fails.\n Here we test out a multi-line description!",
"title":"Authentication test suite.",
"states":[
Expand Down
3 changes: 2 additions & 1 deletion tests/authentication/04-shutdown.t
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ cmp_json_ok 'scan-j.out' 'scan-j.out' <<__END__
"${PORT}",
{
"group":"",
"version":"$(cylc version)",
"description":"Stalls when the first task fails.\n Here we test out a multi-line description!",
"title":"Authentication test suite.",
"states":[
Expand Down Expand Up @@ -182,4 +183,4 @@ TEST_NAME="${TEST_NAME_BASE}-stop"
run_ok "${TEST_NAME}" cylc stop --debug --max-polls=20 --interval=1 "${SUITE_NAME}"
purge_suite "${SUITE_NAME}"
exit


1 change: 1 addition & 0 deletions tests/authentication/05-full-control.t
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ cmp_json_ok 'scan-j.out' 'scan-j.out' <<__END__
"${PORT}",
{
"group":"",
"version":"$(cylc version)",
"description":"Stalls when the first task fails.\n Here we test out a multi-line description!",
"title":"Authentication test suite.",
"states":[
Expand Down
1 change: 1 addition & 0 deletions tests/authentication/06-suite-override.t
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ cmp_json_ok 'scan-j.out' 'scan-j.out' <<__END__
"${PORT}",
{
"group":"",
"version":"$(cylc version)",
"description":"Stalls when the first task fails.\nSuite overrides global authentication settings.",
"title":"Authentication test suite.",
"states":[
Expand Down
1 change: 1 addition & 0 deletions tests/authentication/07-sha-hash.t
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ cmp_json_ok 'scan-j.out' 'scan-j.out' <<__END__
"${PORT}",
{
"group":"",
"version":"$(cylc version)",
"description":"Stalls when the first task fails.\n Here we test out a multi-line description!",
"title":"Authentication test suite.",
"states":[
Expand Down

0 comments on commit a65da5c

Please sign in to comment.