Skip to content

Commit

Permalink
Minor style changes
Browse files Browse the repository at this point in the history
  • Loading branch information
challurip committed May 4, 2017
1 parent 046f43f commit 0b98671
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 27 deletions.
23 changes: 7 additions & 16 deletions bin/cylc-cat-log
Original file line number Diff line number Diff line change
Expand Up @@ -294,15 +294,12 @@ def main():
if os.path.exists(filename):
lines = read_and_proc(filename)
else:
print
print >> sys.stderr, (
'No such file or directory: ')
print >> sys.stderr, filename
print
print >> sys.stderr, 'No such file or directory: %s' % filename
sys.exit(1)

viewfile = NamedTemporaryFile(
suffix='.' + os.path.basename(filename), prefix=suite + '.', dir=cylc_tmpdir)
suffix='.' + os.path.basename(filename),
prefix=suite + '.', dir=cylc_tmpdir)

for line in lines:
viewfile.write(line + '\n')
Expand Down Expand Up @@ -338,11 +335,11 @@ def main():
"local tail command template"))
commands.append(shlex.split(cmd_tmpl % {"filename": filename}))
elif options.geditor or options.editor:
command_list = re.split(' ', editor)
command_list = editor.split()
command_list.append(viewfile.name)
commands.append(command_list)
else:
commands.append(['cat', filename])
commands.append(["cat", filename])

# Deal with remote [user@]host
if user_at_host:
Expand Down Expand Up @@ -371,17 +368,11 @@ def main():
modtime2 = os.stat(viewfile.name).st_mtime

if modtime2 > modtime1:
print
print >> sys.stderr, (
'WARNING: YOU HAVE EDITED A TEMPORARY READ_ONLY LOG/JOB COPY:')
'WARNING: YOU HAVE EDITED A TEMPORARY READ_ONLY COPY OF: ')
print >> sys.stderr, filename
print
else:
print
print >> sys.stderr, (
'NO CHANGES MADE TO:')
print >> sys.stderr, viewfile.name
print
print >> sys.stderr, 'NO CHANGES MADE TO: %s' % viewfile.name

viewfile.close()

Expand Down
22 changes: 11 additions & 11 deletions lib/cylc/gui/app_gcylc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1236,27 +1236,27 @@ def view_in_editor(self, w, e, task_id, choice):
try:
task_state_summary = self.updater.full_state_summary[task_id]
except KeyError:
warning_dialog(task_id + ' is not live', self.window).warn()
warning_dialog('%s is not live' % task_id, self.window).warn()
return False
if (not task_state_summary['logfiles'] and
not task_state_summary.get('job_hosts')):
warning_dialog('%s has no log files' % task_id, self.window).warn()
else:
if choice == 'job-activity.log':
command = ("cylc cat-log --activity --geditor" + " " +
self.cfg.suite + " " + task_id)
command_opt = "--activity"
elif choice == 'job.status':
command = ("cylc cat-log --status --geditor" + " " +
self.cfg.suite + " " + task_id)
command_opt = "--status"
elif choice == 'job.out':
command = ("cylc cat-log --stdout --geditor" + " " +
self.cfg.suite + " " + task_id)
command_opt = "--stdout"
elif choice == 'job.err':
command = ("cylc cat-log --stderr --geditor" + " " +
self.cfg.suite + " " + task_id)
command_opt = "--stderr"
elif choice == 'job':
command = ("cylc cat-log --geditor" + " " +
self.cfg.suite + " " + task_id)
command_opt = ""

command = (
"cylc cat-log %s --geditor %s %s" % (
command_opt, self.cfg.suite, task_id)
)

foo = gcapture_tmpfile(command, self.cfg.cylc_tmpdir, 400, 400)
self.gcapture_windows.append(foo)
Expand Down

0 comments on commit 0b98671

Please sign in to comment.