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

Fix traceback print usage #2166

Merged
merged 1 commit into from
Feb 18, 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
39 changes: 17 additions & 22 deletions lib/cylc/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,19 +264,19 @@ def start(self):
except KeyboardInterrupt as exc:
try:
self.shutdown(str(exc))
except Exception as exc1:
except Exception:
# In case of exceptions in the shutdown method itself.
traceback.print_exc(exc1)
ERR.warning(traceback.format_exc())
sys.exit(1)

except Exception as exc:
traceback.print_exc()
ERR.critical(traceback.format_exc())
ERR.error("error caught: cleaning up before exit")
try:
self.shutdown('ERROR: ' + str(exc))
except Exception, exc1:
except Exception:
# In case of exceptions in the shutdown method itself
traceback.print_exc(exc1)
ERR.warning(traceback.format_exc())
if cylc.flags.debug:
raise
else:
Expand Down Expand Up @@ -605,15 +605,15 @@ def _load_task_pool(self, row_idx, row):
message_queue=self.pool.message_queue)
except TaskNotDefinedError as exc:
if cylc.flags.debug:
traceback.print_exc()
ERR.error(traceback.format_exc())
else:
ERR.error(str(exc))
ERR.warning((
"ignoring task %s from the suite run database file\n"
"(the task definition has probably been deleted from the "
"suite).") % name)
except Exception:
traceback.print_exc()
ERR.error(traceback.format_exc())
ERR.error("could not load task %s" % name)
else:
if status in (TASK_STATUS_SUBMITTED, TASK_STATUS_RUNNING):
Expand Down Expand Up @@ -668,23 +668,18 @@ def _load_task_action_timers(self, row_idx, row):
ctx_key = pickle.loads(str(ctx_key_pickle))
ctx = pickle.loads(str(ctx_pickle))
delays = pickle.loads(str(delays_pickle))
num = int(num)
if delay is not None:
delay = float(delay)
if timeout is not None:
timeout = float(timeout)
except (EOFError, TypeError, LookupError):
if ctx_key and ctx_key[0] in ["poll_timers", "try_timers"]:
getattr(itask, ctx_key[0])[ctx_key[1]] = TaskActionTimer(
ctx, delays, num, delay, timeout)
else:
itask.event_handler_try_timers[ctx_key] = TaskActionTimer(
ctx, delays, num, delay, timeout)
except (EOFError, TypeError, LookupError, ValueError):
ERR.warning(
"%(id)s: skip action timer %(ctx_key)s" %
{"id": id_, "ctx_key": ctx_key})
ERR.warning(traceback.format_exc())
return
if ctx_key and ctx_key[0] in ["poll_timers", "try_timers"]:
getattr(itask, ctx_key[0])[ctx_key[1]] = TaskActionTimer(
ctx, delays, num, delay, timeout)
else:
itask.event_handler_try_timers[ctx_key] = TaskActionTimer(
ctx, delays, num, delay, timeout)
OUT.info("+ %s.%s %s" % (name, cycle, ctx_key))

def process_command_queue(self):
Expand Down Expand Up @@ -1594,7 +1589,7 @@ def run(self):
assert contact_data == self.contact_data
except (AssertionError, IOError, ValueError,
SuiteServiceFileError):
traceback.print_exc()
ERR.critical(traceback.format_exc())
exc = SchedulerError(
("%s: suite contact file corrupted/modified and" +
" may be left") %
Expand Down Expand Up @@ -1887,7 +1882,7 @@ def _task_event_email_callback(self, ctx):
try_timers[(key1, submit_num)].unset_waiting()
except KeyError:
if cylc.flags.debug:
traceback.print_exc()
ERR.debug(traceback.format_exc())

def _process_task_job_logs_retrieval(self, ctx, id_keys):
"""Process retrieval of task job logs from remote user@host."""
Expand Down Expand Up @@ -1949,7 +1944,7 @@ def _task_job_logs_retrieval_callback(self, ctx):
try_timers[(key1, submit_num)].unset_waiting()
except KeyError:
if cylc.flags.debug:
traceback.print_exc()
ERR.debug(traceback.format_exc())

def shutdown(self, reason=None):
"""Shutdown the suite."""
Expand Down
10 changes: 7 additions & 3 deletions lib/cylc/task_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,15 @@ class TaskActionTimer(object):
def __init__(self, ctx=None, delays=None, num=0, delay=None, timeout=None):
self.ctx = ctx
if delays is None:
self.delays = [0]
self.delays = [float(0)]
else:
self.delays = list(delays)
self.num = num
self.delays = [float(delay) for delay in delays]
self.num = int(num)
if delay is not None:
delay = float(delay)
self.delay = delay
if timeout is not None:
timeout = float(timeout)
self.timeout = timeout
self.is_waiting = False

Expand Down