Skip to content

Commit

Permalink
py3: respond to feedback(2)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver-sanders committed Mar 11, 2019
1 parent b0908b6 commit ff7a1d9
Show file tree
Hide file tree
Showing 18 changed files with 67 additions and 117 deletions.
4 changes: 2 additions & 2 deletions bin/cylc-cat-state
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if remrun():
sys.exit(0)

import os
import pickle
import json
import re
import sqlite3
import traceback
Expand Down Expand Up @@ -119,7 +119,7 @@ def extract_lines(state):
yield r"time : %(time_str)s (%(time_since_epoch)s)" % state
yield r"initial cycle : %(initial_point)s" % state
yield r"final cycle : %(final_point)s" % state
yield pickle.dumps(state["broadcast_states"]).splitlines()
yield json.dumps(state["broadcast_states"]).splitlines()
yield "Begin task states"
for item in state["task_pool"]:
yield (
Expand Down
2 changes: 1 addition & 1 deletion bin/cylc-check-software
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ latter grouped as Python, TeX or 'other' (neither). 'opt_spec' item format:
<MODULE>: [<MIN VER OR 'None'>, <FUNC TAG>, <GROUP>, <'OTHER' TUPLE>] with
<'OTHER' TUPLE> = ([<BASE CMD(S)>], <VER OPT>, <REGEX>, <OUTFILE ARG>).
"""
req_py_ver_range = ((3,),)
req_py_ver_range = ((3,6),)
opt_spec = {
'EmPy': [None, 'TEMPLATING', 'PY'],
'sphinx': [(1, 5, 3), 'HTMLDOCS', 'PY'],
Expand Down
2 changes: 1 addition & 1 deletion bin/cylc-check-versions
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def main():
print("All", contacted, "accounts have cylc-" + CYLC_VERSION)
else:
print("WARNING: failed to invoke cylc-%s on %d accounts:" % (
CYLC_VERSION, len(list(warn.keys()))))
CYLC_VERSION, len(warn)))
m = max(len(ac) for ac in warn)
for ac, warning in warn.items():
print(' ', ac.ljust(m), warning)
Expand Down
5 changes: 1 addition & 4 deletions bin/cylc-client
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,4 @@ def main():


if __name__ == '__main__':
try:
main()
except Exception as exc:
sys.exit(exc)
main()
4 changes: 2 additions & 2 deletions doc/src/appendices/suiterc-config-ref.rst
Original file line number Diff line number Diff line change
Expand Up @@ -953,8 +953,8 @@ Allows tasks to spawn out to ``max active cycle points``
submitted before its successor can be spawned.

*Important*: This should be used with care given the potential impact of
additional task proxies in terms of memory and cpu for the cylc daemon.
Also, use
additional task proxies in terms of memory and cpu for the cylc server
program. Also, use
of the setting may highlight any issues with suite design relying on the
default behaviour where downstream tasks would otherwise be waiting on ones
upstream submitting and the suite would have stalled e.g. a housekeeping task
Expand Down
14 changes: 7 additions & 7 deletions doc/src/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,14 @@
'pointsize': '11pt',
}

# Title for the cylc documentation section
CYLC_DOC_TITLE = 'Cylc Documentation'

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
('index', 'cylc.tex', 'Cylc Documentation',
'2008-2019 NIWA & British Crown (Met Office) & Contributors', 'manual'),
('index', 'cylc.tex', CYLC_DOC_TITLE, copyright, 'manual'),
]

# Image file to place at the top of the title page.
Expand All @@ -134,8 +136,7 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'cylc', 'cylc Documentation',
'2008-2019 NIWA & British Crown (Met Office) & Contributors', 1),
('index', 'cylc', CYLC_DOC_TITLE, copyright, 1),
]

# If true, show URL addresses after external links.
Expand All @@ -148,9 +149,8 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'cylc', 'Cylc Documentation',
'2008-2019 NIWA & British Crown (Met Office) & Contributors',
'cylc', 'The Cylc Suite Engine', 'Miscellaneous'),
('index', 'cylc', CYLC_DOC_TITLE, copyright, 'cylc', project,
'Miscellaneous'),
]

# How to display URL addresses.
Expand Down
1 change: 0 additions & 1 deletion doc/src/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ Requirements:

The following packages are necessary for running tests in Cylc:

- `mock <https://mock.readthedocs.io>`_
- `pytest <https://pytest.org>`_

To generate the HTML User Guide, you will need:
Expand Down
7 changes: 1 addition & 6 deletions lib/cylc/log_diagnosis.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,7 @@


class LogAnalyserError(Exception):
def __init__(self, msg):
Exception.__init__(self, msg)
self.msg = msg

def __str__(self):
return self.msg
pass


class LogSpec(object):
Expand Down
10 changes: 4 additions & 6 deletions lib/cylc/network/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

from cylc import LOG
import cylc.flags
from cylc.hostuserutil import get_host, get_fqdn_by_host
from cylc.hostuserutil import get_fqdn_by_host
from cylc.network import encrypt, decrypt, get_secret
from cylc.suite_srv_files_mgr import (
SuiteSrvFilesManager, SuiteServiceFileError)
Expand Down Expand Up @@ -286,11 +286,9 @@ def get_location(cls, suite, owner, host):
# exc.args = (cls.NOT_RUNNING % suite,)
# raise

if host and host.split('.')[0] == 'localhost':
host = get_host()
elif host and '.' not in host: # Not IP and no domain
host = get_fqdn_by_host(host)
else:
if not host:
host = contact[SuiteSrvFilesManager.KEY_HOST]
host = get_fqdn_by_host(host)

port = int(contact[SuiteSrvFilesManager.KEY_PORT])
return host, port
26 changes: 11 additions & 15 deletions lib/cylc/network/scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
def async_map(coroutine, iterator):
"""Map iterator iterator onto a coroutine.
* Yields results in order as an when they are ready
* Yields results in order as and when they are ready.
* Slow workers can block.
Args:
Expand All @@ -52,7 +52,7 @@ def async_map(coroutine, iterator):
Should yield tuples to be passed into the coroutine.
Yields:
list - List of results
list - List of results.
Example:
>>> async def square(number): return number ** 2
Expand All @@ -70,20 +70,18 @@ def async_map(coroutine, iterator):
awaiting.append(task)

index = 0
buff = []
completed_tasks = {}
while awaiting:
completed, awaiting = loop.run_until_complete(
asyncio.wait(awaiting, return_when=asyncio.FIRST_COMPLETED))
buff.extend(completed)
completed_tasks.update({t.ind: t.result() for t in completed})

old_len = -1
while len(buff) != old_len:
old_len = len(buff)
for task in buff:
if task.ind == index:
index += 1
buff.remove(task)
yield task.result()
changed = True
while changed and completed_tasks:
if index in completed_tasks:
yield completed_tasks.pop(index)
changed = True
index += 1


def async_unordered_map(coroutine, iterator):
Expand Down Expand Up @@ -196,7 +194,7 @@ def re_compile_filters(patterns_owner=None, patterns_name=None):
return (cres['owner'], cres['name'])


def get_scan_items_from_fs(owner_pattern=None, reg_pattern=None, updater=None):
def get_scan_items_from_fs(owner_pattern=None, reg_pattern=None):
"""Scrape list of suites from the filesystem.
Walk users' "~/cylc-run/" to get (host, port) from ".service/contact" for
Expand Down Expand Up @@ -231,8 +229,6 @@ def get_scan_items_from_fs(owner_pattern=None, reg_pattern=None, updater=None):
item[1] is not None)))
for run_d, owner in run_dirs:
for dirpath, dnames, _ in os.walk(run_d, followlinks=True):
if updater and updater.quit:
return
# Always descend for top directory, but
# don't descend further if it has a .service/ or log/ dir
if dirpath != run_d and (
Expand Down
Loading

0 comments on commit ff7a1d9

Please sign in to comment.