Skip to content

Commit

Permalink
Merge pull request #1663 from hjoliver/AIX-tail-fix
Browse files Browse the repository at this point in the history
Configurable job file tailer
  • Loading branch information
arjclark committed Nov 5, 2015
2 parents 13793c6 + 312fe6b commit b71de2b
Show file tree
Hide file tree
Showing 7 changed files with 172 additions and 78 deletions.
26 changes: 22 additions & 4 deletions bin/cylc-cat-log
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ def get_option_parser():
help="Name of log file (e.g. 'job.stats').", metavar="FILENAME",
action="store", dest="filename")

parser.add_option(
"--tail",
help="Tail the job log, if the task is running.", metavar="INT",
action="store_true", default=False, dest="tail")

parser.add_option(
"-s", "--submit-number", "-t", "--try-number",
help="Task job log only: submit number (default=NN).", metavar="INT",
Expand Down Expand Up @@ -256,6 +261,12 @@ def main():
filename = get_suite_log_path(options, args[0])
user_at_host, command0 = (None, None)

if user_at_host:
if "@" in user_at_host:
owner, host = user_at_host.split("@", 1)
else:
owner, host = (None, user_at_host)

# Construct the shell command
commands = []
if options.location_mode:
Expand All @@ -270,15 +281,22 @@ def main():
elif command0:
commands.append(command0)
commands.append(["cat", filename])
elif options.tail:
if user_at_host:
# Replace 'cat' with the remote tail command.
cmd_tmpl = str(GLOBAL_CFG.get_host_item(
"remote tail command template", host, owner))
commands.append(shlex.split(cmd_tmpl % {"filename": filename}))
else:
# Replace 'cat' with the local tail command.
cmd_tmpl = str(GLOBAL_CFG.get_host_item(
"local tail command template"))
commands.append(shlex.split(cmd_tmpl % {"filename": filename}))
else:
commands.append(["cat", filename])

# Deal with remote [user@]host
if user_at_host:
if "@" in user_at_host:
owner, host = user_at_host.split("@", 1)
else:
owner, host = (None, user_at_host)
ssh = str(GLOBAL_CFG.get_host_item(
"remote shell template", host, owner)).replace(" %s", "")
for i, command in enumerate(commands):
Expand Down
2 changes: 1 addition & 1 deletion doc/cug.tex
Original file line number Diff line number Diff line change
Expand Up @@ -6538,7 +6538,7 @@ \section{Other Topics In Brief}

\item Sub-suites: to run another suite inside a task, just invoke the
sub-suite, with appropriate start and end cycle points (probably a
single cycle point), via the host task's \item=script= item:
single cycle point), via the host task's \lstinline=script= item:

\lstset{language=suiterc}
\begin{lstlisting}
Expand Down
8 changes: 4 additions & 4 deletions doc/gcylcrc.tex
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,15 @@ \subsection{[themes]}

This section may contain task state color theme definitions.

\subsubsection[THEME]{[themes] $\rightarrow$ THEME}
\subsubsection[{[}THEME{]}]{[themes] $\rightarrow$ [[THEME]]}

The name of the task state color-theme to be defined in this section.

\begin{myitemize}
\item {\em type:} string
\end{myitemize}

\subsubsection[inherit]{[themes] $\rightarrow$ [THEME] $\rightarrow$ inherit}
\paragraph[inherit]{[themes] $\rightarrow$ [[THEME]] $\rightarrow$ inherit}

You can inherit from another theme in order to avoid defining all states.

Expand All @@ -123,7 +123,7 @@ \subsection{[themes]}
\item {\em default:} ``default''
\end{myitemize}

\subsubsection[defaults]{[themes] $\rightarrow$ [THEME] $\rightarrow$ defaults}
\paragraph[defaults]{[themes] $\rightarrow$ [[THEME]] $\rightarrow$ defaults}

Set default icon attributes for all state icons in this theme.

Expand All @@ -139,7 +139,7 @@ \subsection{[themes]}
See \lstinline@gcylc.rc.eg@ and \lstinline@themes.rc@ in
\lstinline@$CYLC_DIR/conf/gcylcrc/@ for examples.

\subsubsection[STATE]{[themes] $\rightarrow$ [THEME] $\rightarrow$ STATE}
\paragraph[STATE]{[themes] $\rightarrow$ [[THEME]] $\rightarrow$ STATE}

Set icon attributes for all task states in THEME, or for a subset of them if
you have used theme inheritance and/or defaults. Legal values of STATE are
Expand Down
Loading

0 comments on commit b71de2b

Please sign in to comment.