Skip to content

Commit

Permalink
Fix formats, styles and logic conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewrmshin committed Oct 29, 2018
1 parent 433a9e9 commit a1cc893
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 22 deletions.
23 changes: 8 additions & 15 deletions lib/cylc/review.py
Expand Up @@ -47,7 +47,6 @@
TASK_STATUSES_ORDERED, TASK_STATUS_GROUPS)
from cylc.version import CYLC_VERSION
from cylc.ws import get_util_home
from cylc.suite_logging import get_logs
from cylc.suite_srv_files_mgr import SuiteSrvFilesManager


Expand Down Expand Up @@ -740,20 +739,14 @@ def _get_suite_logs_info(self, user, suite):
"size": f_stat.st_size}

# Get cylc suite log files
log_files = ["log/suite/err", "log/suite/log", "log/suite/out"]
for key in log_files:
f_name = os.path.join(dir_, key)
if os.path.isfile(f_name):
f_stat = os.stat(f_name)
full_name = ["log/suite/%s" % name for name in
get_logs(dir_, key, absolute_path=False)]
logs_info[key] = {"path": key,
"paths": [key] + full_name,
"mtime": f_stat.st_mtime,
"size": f_stat.st_size}

k, logs_info = ("cylc", logs_info)
data["files"][k] = logs_info
for f_name in glob(os.path.join(dir_, "log/suite/log*")):
key = os.path.relpath(f_name, dir_)
f_stat = os.stat(f_name)
logs_info[key] = {"path": key,
"mtime": f_stat.st_mtime,
"size": f_stat.st_size}

data["files"]["cylc"] = logs_info
return data

@classmethod
Expand Down
8 changes: 3 additions & 5 deletions lib/cylc/rundb.py
Expand Up @@ -531,7 +531,7 @@ def select_checkpoint_id(self, callback, id_key=None):
If id_key is specified, add where id == id_key to select.
"""
stmt = r"SELECT id,time,event FROM %s" % self.TABLE_CHECKPOINT_ID
stmt = r"SELECT id,time,event FROM checkpoint_id"
stmt_args = []
if id_key is not None:
stmt += r" WHERE id==?"
Expand All @@ -542,8 +542,7 @@ def select_checkpoint_id(self, callback, id_key=None):

def select_checkpoint_id_restart_count(self):
"""Return number of restart event in checkpoint_id table."""
stmt = r"SELECT count(event) FROM %s WHERE event==?" % (
self.TABLE_CHECKPOINT_ID)
stmt = r"SELECT COUNT(event) FROM checkpoint_id WHERE event==?"
stmt_args = ['restart']
for row in self.connect().execute(stmt, stmt_args):
return row[0]
Expand Down Expand Up @@ -821,8 +820,7 @@ def take_checkpoints(self, event, other_daos=None):
"""
id_ = 1
for max_id, in self.connect().execute(
"SELECT MAX(id) FROM %(table)s" %
{"table": self.TABLE_CHECKPOINT_ID}):
"SELECT MAX(id) FROM checkpoint_id"):
if max_id >= id_:
id_ = max_id + 1
daos = [self]
Expand Down
1 change: 0 additions & 1 deletion lib/cylc/task_events_mgr.py
Expand Up @@ -33,7 +33,6 @@
from pipes import quote
import shlex
from time import time
import traceback

from parsec.config import ItemNotFoundError

Expand Down
2 changes: 1 addition & 1 deletion lib/cylc/task_pool.py
Expand Up @@ -1214,7 +1214,7 @@ def set_expired_task(self, itask, now):
itask.get_offset_as_seconds(itask.tdef.expiration_offset))
if now > itask.expire_time:
msg = 'Task expired (skipping job).'
LOG.warning('[%s] -', itask, msg)
LOG.warning('[%s] -%s', itask, msg)
self.task_events_mgr.setup_event_handlers(itask, "expired", msg)
itask.state.reset_state(TASK_STATUS_EXPIRED)
return True
Expand Down

0 comments on commit a1cc893

Please sign in to comment.