Skip to content

Commit

Permalink
Grand naming ceremony
Browse files Browse the repository at this point in the history
  • Loading branch information
sadielbartholomew committed Jun 22, 2018
1 parent 9519dfd commit e5abc7d
Show file tree
Hide file tree
Showing 94 changed files with 90 additions and 90 deletions.
18 changes: 9 additions & 9 deletions bin/cylc-nameless → bin/cylc-review
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@
#
#-------------------------------------------------------------------------------
# NAME
# cylc nameless
# cylc review
#
# SYNOPSIS
# cylc nameless start [PORT] # start ad-hoc web service server (on PORT)
# cylc nameless stop # stop ad-hoc web service server
# cylc nameless stop -y # stop ad-hoc web service server w/o prompting
# cylc nameless # print status of ad-hoc web service server
# cylc review start [PORT] # start ad-hoc web service server (on PORT)
# cylc review stop # stop ad-hoc web service server
# cylc review stop -y # stop ad-hoc web service server w/o prompting
# cylc review # print status of ad-hoc web service server
#
# DESCRIPTION
# Start/stop ad-hoc Cylc Nameless web service server.
# Start/stop ad-hoc Cylc Review web service server.
#
# For "cylc nameless start", if PORT is not specified, use port 8080.
# For "cylc review start", if PORT is not specified, use port 8080.
#
# Cylc Nameless is a web service for browsing users' suite logs via
# Cylc Review is a web service for browsing users' suite logs via
# an HTTP interface.
#
# OPTIONS
Expand All @@ -42,4 +42,4 @@
# (For start only.) Include web service name under root of URL.
#-------------------------------------------------------------------------------

exec python -m cylc.nameless "$@"
exec python -m cylc.review "$@"
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<link rel="shortcut icon" href="{{script}}/favicon.png" />
<link type="text/css" href="{{script}}/css/bootstrap.min.css"
rel="stylesheet" media="screen" />
<link type="text/css" href="{{script}}/css/cylc-nameless.css" rel="stylesheet" media="screen" />
<link type="text/css" href="{{script}}/css/cylc-review.css" rel="stylesheet" media="screen" />
</head>
<body>
<div class="container-fluid">
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<link rel="shortcut icon" href="{{script}}/favicon.png" />
<link type="text/css" href="{{script}}/css/bootstrap.min.css"
rel="stylesheet" media="screen" />
<link type="text/css" href="{{script}}/css/cylc-nameless.css" rel="stylesheet" media="screen" />
<link type="text/css" href="{{script}}/css/cylc-review.css" rel="stylesheet" media="screen" />
{% if file_content is defined and file_content -%}
<link type="text/css" href="{{script}}/css/prettify.css"
rel="stylesheet" media="screen" />
Expand Down Expand Up @@ -150,7 +150,7 @@ <h4 class="modal-title">Suite Info</h4>
</script>
<script type="text/javascript" src="{{script}}/js/livestamp.min.js">
</script>
<script type="text/javascript" src="{{script}}/js/cylc-nameless.js">
<script type="text/javascript" src="{{script}}/js/cylc-review.js">
</script>
{% if path is defined and path -%}
<script type="text/javascript" src="{{script}}/js/search.js">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<link rel="shortcut icon" href="{{script}}/favicon.png" />
<link type="text/css" href="{{script}}/css/bootstrap.min.css"
rel="stylesheet" media="screen" />
<link type="text/css" href="{{script}}/css/cylc-nameless.css" rel="stylesheet" media="screen" />
<link type="text/css" href="{{script}}/css/cylc-review.css" rel="stylesheet" media="screen" />
</head>
<body>

Expand Down Expand Up @@ -207,7 +207,7 @@
</script>
<script type="text/javascript" src="{{script}}/js/livestamp.min.js">
</script>
<script type="text/javascript" src="{{script}}/js/cylc-nameless.js">
<script type="text/javascript" src="{{script}}/js/cylc-review.js">
</script>
</body>
</html>
File renamed without changes.
File renamed without changes.
34 changes: 17 additions & 17 deletions lib/cylc/nameless.py → lib/cylc/review.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,20 @@

from cylc.version import CYLC_VERSION
from cylc.hostuserutil import get_host
from cylc.rundb import CylcNamelessDAO
from cylc.rundb import CylcReviewDAO
from cylc.task_state import (
TASK_STATUSES_ORDERED, TASK_STATUS_GROUPS)
from cylc.ws import get_util_home
from cylc.suite_logging import get_logs


class CylcNamelessService(object):
class CylcReviewService(object):

"""'Cylc Nameless Service."""
"""'Cylc Review Service."""

NS = "cylc"
UTIL = "cylc nameless"
TITLE = "Cylc Nameless"
UTIL = "cylc review"
TITLE = "Cylc Review"

CYCLES_PER_PAGE = 100
JOBS_PER_PAGE = 15
Expand All @@ -64,15 +64,15 @@ class CylcNamelessService(object):

def __init__(self, *args, **kwargs):
self.exposed = True
self.suite_dao = CylcNamelessDAO()
self.suite_dao = CylcReviewDAO()
self.logo = get_util_home("doc", "src", "cylc-logo.png")
self.title = self.TITLE
self.host_name = get_host()
if self.host_name and "." in self.host_name:
self.host_name = self.host_name.split(".", 1)[0]
self.cylc_version = CYLC_VERSION
template_env = jinja2.Environment(loader=jinja2.FileSystemLoader(
get_util_home("lib", "cylc", "cylc-nameless", "template")))
get_util_home("lib", "cylc", "cylc-review", "template")))
template_env.filters['urlise'] = self.url2hyperlink
self.template_env = template_env

Expand Down Expand Up @@ -236,7 +236,7 @@ def taskjobs(
a glob like pattern for matching valid task names.
task_status -- Select by task statuses.
job_status -- Select by job status. See
CylcNamelessDAO.JOB_STATUS_COMBOS for detail.
CylcReviewDAO.JOB_STATUS_COMBOS for detail.
order -- Order search in a predetermined way. A valid value is one of
"time_desc", "time_asc",
"cycle_desc_name_desc", "cycle_desc_name_asc",
Expand Down Expand Up @@ -675,7 +675,7 @@ def _get_suite_logs_info(self, user, suite):
"mtime": stat.st_mtime,
"size": stat.st_size}

# Logic from old CylcNamelessDAO function of same name now here; it
# Logic from old CylcReviewDAO function of same name now here; it
# returns a tuple that looks like:
# ("cylc-run",
# {"err": {"path": "log/suite/err", "mtime": mtime, "size": size},
Expand Down Expand Up @@ -752,7 +752,7 @@ def _check_string_for_path(string):
"""Raise HTTP 403 error if the provided string contain path chars.
Examples:
>>> CylcNamelessService._check_string_for_path(
>>> CylcReviewService._check_string_for_path(
... os.path.join('foo', 'bar'))
Traceback (most recent call last):
...
Expand All @@ -770,23 +770,23 @@ def _check_path_normalised(path):
"""Raise HTTP 403 error if path is not normalised.
Examples:
>>> CylcNamelessService._check_path_normalised('foo//bar')
>>> CylcReviewService._check_path_normalised('foo//bar')
Traceback (most recent call last):
...
HTTPError: (403, None)
>>> CylcNamelessService._check_path_normalised('foo/bar/')
>>> CylcReviewService._check_path_normalised('foo/bar/')
Traceback (most recent call last):
...
HTTPError: (403, None)
>>> CylcNamelessService._check_path_normalised('foo/./bar')
>>> CylcReviewService._check_path_normalised('foo/./bar')
Traceback (most recent call last):
...
HTTPError: (403, None)
>>> CylcNamelessService._check_path_normalised('foo/../bar')
>>> CylcReviewService._check_path_normalised('foo/../bar')
Traceback (most recent call last):
...
HTTPError: (403, None)
>>> CylcNamelessService._check_path_normalised('../foo')
>>> CylcReviewService._check_path_normalised('../foo')
Traceback (most recent call last):
...
HTTPError: (403, None)
Expand Down Expand Up @@ -835,8 +835,8 @@ def _sort_summary_entries(suite1, suite2):

if __name__ == "__main__":
from cylc.ws import ws_cli
ws_cli(CylcNamelessService)
ws_cli(CylcReviewService)
elif 'doctest' not in sys.argv[0]:
# If called as a module but not by the doctest module.
from cylc.ws import wsgi_app
application = wsgi_app(CylcNamelessService)
application = wsgi_app(CylcReviewService)
8 changes: 4 additions & 4 deletions lib/cylc/rundb.py
Original file line number Diff line number Diff line change
Expand Up @@ -939,8 +939,8 @@ def vacuum(self):
return self.connect().execute("VACUUM")


class CylcNamelessDAO(object):
"""Cylc Nameless data access object to the suite runtime database."""
class CylcReviewDAO(object):
"""Cylc Review data access object to the suite runtime database."""

JOB_STATUS_COMBOS = {
"all": "",
Expand Down Expand Up @@ -1029,10 +1029,10 @@ def get_suite_job_entries(
Display only jobs in the specified list. If not
specified, display all jobs.
job_status -- If specified, must be a string matching a key in
RoseBushDAO.JOB_STATUS_COMBOS. Select jobs by their
CylcReviewDAO.JOB_STATUS_COMBOS. Select jobs by their
statuses.
order -- Order search in a predetermined way. A valid value is one of
the keys in RoseBushDAO.ORDERS.
the keys in CylcReviewDAO.ORDERS.
limit -- Limit number of returned entries
offset -- Offset entry number
Return (entries, of_n_entries) where:
Expand Down
2 changes: 1 addition & 1 deletion lib/cylc/task_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
TASK_STATUS_FAILED,
])

# Tasks statuses grouped for cylc nameless 'create_suite_cycles_summary()'
# Tasks statuses grouped for cylc review 'create_suite_cycles_summary()'
TASK_STATUS_GROUPS = {
"active": list(TASK_STATUSES_NOT_STALLED),
"fail": list(TASK_STATUSES_FAILURE),
Expand Down
4 changes: 2 additions & 2 deletions lib/cylc/ws.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def _configure(service_cls):
cherrypy.config["tools.encode.on"] = True
cherrypy.config["tools.encode.encoding"] = "utf-8"
config = {}
static_lib = get_util_home("lib", "cylc", "cylc-nameless", "static")
static_lib = get_util_home("lib", "cylc", "cylc-review", "static")
for name in os.listdir(static_lib):
path = os.path.join(static_lib, name)
if os.path.isdir(path):
Expand All @@ -166,7 +166,7 @@ def _configure(service_cls):


def _get_server_status(service_cls):
"""Return a dict containing 'cylc nameless' quick server status."""
"""Return a dict containing 'cylc review' quick server status."""
ret = {}
log_root_glob = os.path.expanduser(LOG_ROOT_TMPL % {
"ns": service_cls.NS,
Expand Down
20 changes: 10 additions & 10 deletions tests/cylc-nameless/00-basic.t → tests/cylc-review/00-basic.t
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#-------------------------------------------------------------------------------
# Basic tests for "cycl nameless".
# Basic tests for "cylc review".
#-------------------------------------------------------------------------------
. "$(dirname "$0")/test_header"
if ! python -c 'import cherrypy' 2>'/dev/null'; then
Expand All @@ -34,13 +34,13 @@ export CYLC_CONF_PATH=
cylc register "${SUITE_NAME}" "${TEST_DIR}"
cylc run --no-detach --debug "${SUITE_NAME}" 2>'/dev/null'
#-------------------------------------------------------------------------------
# Initialise WSGI application for the cylc nameless web service
cylc_ws_init 'cylc' 'nameless'
# Initialise WSGI application for the cylc review web service
cylc_ws_init 'cylc' 'review'
if [[ -z "${TEST_CYLC_WS_PORT}" ]]; then
exit 1
fi
#-------------------------------------------------------------------------------
# Data transfer output check for nameless homepage
# Data transfer output check for review homepage
TEST_NAME="${TEST_NAME_BASE}-curl-root"
echo ${TEST_CYLC_WS_URL} >&2
# try -s opt to prvent weird header
Expand All @@ -55,7 +55,7 @@ TEST_NAME="${TEST_NAME_BASE}-200-curl-root-json"
run_ok "${TEST_NAME}" curl "${TEST_CYLC_WS_URL}/?form=json"
cylc_ws_json_greps "${TEST_NAME}.stdout" "${TEST_NAME}.stdout" \
"[('cylc_version',), '$(cylc version | cut -d' ' -f 2)']" \
"[('title',), 'Cylc Nameless']" \
"[('title',), 'Cylc Review']" \
"[('host',), '$(hostname)']"
#-------------------------------------------------------------------------------
# Data transfer output check for a specific user's page including non-existent
Expand All @@ -67,7 +67,7 @@ TEST_NAME="${TEST_NAME_BASE}-200-curl-suites-json"
run_ok "${TEST_NAME}" curl "${TEST_CYLC_WS_URL}/suites/${USER}?form=json"
cylc_ws_json_greps "${TEST_NAME}.stdout" "${TEST_NAME}.stdout" \
"[('cylc_version',), '$(cylc version | cut -d' ' -f 2)']" \
"[('title',), 'Cylc Nameless']" \
"[('title',), 'Cylc Review']" \
"[('host',), '$(hostname)']" \
"[('user',), '${USER}']" \
"[('entries', {'name': '${SUITE_NAME}'}, 'name',), '${SUITE_NAME}']" \
Expand Down Expand Up @@ -102,7 +102,7 @@ run_ok "${TEST_NAME}" \
curl "${TEST_CYLC_WS_URL}/cycles/${USER}/${SUITE_NAME}?form=json"
cylc_ws_json_greps "${TEST_NAME}.stdout" "${TEST_NAME}.stdout" \
"[('cylc_version',), '$(cylc version | cut -d' ' -f 2)']" \
"[('title',), 'Cylc Nameless']" \
"[('title',), 'Cylc Review']" \
"[('host',), '$(hostname)']" \
"[('user',), '${USER}']" \
"[('suite',), '${SUITE_NAME}']" \
Expand All @@ -127,7 +127,7 @@ FOO1="{'cycle': '20000101T0000Z', 'name': 'foo1', 'submit_num': 1}"
FOO1_JOB='log/job/20000101T0000Z/foo1/01/job'
cylc_ws_json_greps "${TEST_NAME}.stdout" "${TEST_NAME}.stdout" \
"[('cylc_version',), '$(cylc version | cut -d' ' -f 2)']" \
"[('title',), 'Cylc Nameless']" \
"[('title',), 'Cylc Review']" \
"[('host',), '$(hostname)']" \
"[('user',), '${USER}']" \
"[('suite',), '${SUITE_NAME}']" \
Expand Down Expand Up @@ -195,7 +195,7 @@ cylc_ws_json_greps "${TEST_NAME}.stdout" "${TEST_NAME}.stdout" \

#-------------------------------------------------------------------------------
# Data transfer output check for a suite run directory with only a "log/db"
TEST_DIR2="$(mktemp -d --tmpdir="${HOME}/cylc-run" "ctb-cylc-nameless-00-XXXXXXXX")"
TEST_DIR2="$(mktemp -d --tmpdir="${HOME}/cylc-run" "ctb-cylc-review-00-XXXXXXXX")"
SUITE_NAME2="$(basename "${TEST_DIR2}")"
cp "${TEST_DIR}/log/db" "${TEST_DIR2}/"
run_ok "${TEST_NAME}-bare" \
Expand Down Expand Up @@ -253,7 +253,7 @@ grep_ok 'HTTP/.* 403 Forbidden' "${TEST_NAME}.stdout"
# 2. By absolute path to imaginary suite directory.
TEST_NAME="${TEST_NAME_BASE}-403-curl-view-outside-imag"
IMG_TEST_DIR="$(mktemp -d --tmpdir="${HOME}/cylc-run" \
"ctb-cylc-nameless-00-XXXXXXXX")"
"ctb-cylc-review-00-XXXXXXXX")"
echo 'Welcome to the imaginery suite.'>"${IMG_TEST_DIR}/welcome.txt"
run_ok "${TEST_NAME}" \
curl -I \
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#-------------------------------------------------------------------------------
# Tests for "cylc nameless", "logo", "title" and "host" settings.
# Tests for "cylc review", "logo", "title" and "host" settings.
#-------------------------------------------------------------------------------
. "$(dirname "$0")/test_header"
if ! python -c 'import cherrypy' 2>'/dev/null'; then
Expand All @@ -26,7 +26,7 @@ set_test_number 10
#-------------------------------------------------------------------------------
# Initialise suite and associated config

# Rose conf to extract via nameless
# Rose conf to extract via review
mkdir 'conf'
cat >'conf/rose.conf' <<'__ROSE_CONF__'
[rose-bush]
Expand All @@ -45,8 +45,8 @@ export CYLC_CONF_PATH=
cylc register "${SUITE_NAME}" "${TEST_DIR}"
cylc run --no-detach --debug "${SUITE_NAME}" 2>'/dev/null'
#-------------------------------------------------------------------------------
# Initialise WSGI application for the cylc nameless web service
cylc_ws_init 'cylc' 'nameless'
# Initialise WSGI application for the cylc review web service
cylc_ws_init 'cylc' 'review'
if [[ -z "${TEST_CYLC_WS_PORT}" ]]; then
exit 1
fi
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# 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 for "cylc nameless", behaviour of job entry with no "job.stdout".
# Test for "cylc review", behaviour of job entry with no "job.stdout".
#-------------------------------------------------------------------------------
. "$(dirname "$0")/test_header"
if ! python -c 'import cherrypy' 2>'/dev/null'; then
Expand All @@ -38,8 +38,8 @@ cylc run --no-detach --debug "${SUITE_NAME}" 2>'/dev/null'
sqlite3 "${TEST_DIR}/log/db" \
'DELETE FROM task_job_logs WHERE filename=="job.stdout";' 2>'/dev/null' || true
#-------------------------------------------------------------------------------
# Initialise WSGI application for the cylc nameless web service
cylc_ws_init 'cylc' 'nameless'
# Initialise WSGI application for the cylc review web service
cylc_ws_init 'cylc' 'review'
if [[ -z "${TEST_CYLC_WS_PORT}" ]]; then
exit 1
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# 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 for "cylc nameless", jobs list no statuses filter logic, #1762.
# Test for "cylc review", jobs list no statuses filter logic, #1762.
#-------------------------------------------------------------------------------
. "$(dirname "$0")/test_header"
if ! python -c 'import cherrypy' 2>'/dev/null'; then
Expand All @@ -32,8 +32,8 @@ run_ok $TEST_NAME cylc validate $SUITE_NAME

cylc run --debug --no-detach $SUITE_NAME 2>'/dev/null'
#-------------------------------------------------------------------------------
# Initialise WSGI application for the cylc nameless web service
cylc_ws_init 'cylc' 'nameless'
# Initialise WSGI application for the cylc review web service
cylc_ws_init 'cylc' 'review'
if [[ -z "${TEST_CYLC_WS_PORT}" ]]; then
exit 1
fi
Expand Down
File renamed without changes.
Loading

0 comments on commit e5abc7d

Please sign in to comment.