% Created 2021-02-23 Tue 18:13
% Intended LaTeX compiler: pdflatex
\documentclass[presentation]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{grffile}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\usepackage{minted}
\usepackage{pdfpages}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{xspace}
\usepackage{libertine}
\usepackage{fontawesome}
\mode<beamer>{\usetheme{Boadilla}}
\setbeamertemplate{navigation symbols}{}
\hypersetup{colorlinks}
\setbeamerfont{alerted text}{series=\bfseries}
\usetheme{default}
\author{Brett Viren}
\date{\today}
\title{Command line control of runs}
\subtitle{But, not run-control}
\hypersetup{
 pdfauthor={Brett Viren},
 pdftitle={Command line control of runs},
 pdfkeywords={},
 pdfsubject={},
 pdfcreator={Emacs 27.1.90 (Org mode 9.4.4)}, 
 pdflang={English}}
\begin{document}

\maketitle

\begin{frame}[label={sec:org43b192a},fragile]{Interim command line interface proposal}
 We want to \alert{run} some command line program to \alert{control} the DAQ
\begin{itemize}
\item Call it generically ``\texttt{cli}'' to avoid any implication of grandeur.
\item Not \texttt{run-control}, but \texttt{cli} may talk to something of that name.
\item It is an \alert{interim} thing, we will likely throw it away at next scale-up.
\begin{itemize}
\item Ultimately we want some nice web based human-DAQ UI
\end{itemize}
\end{itemize}
\end{frame}

\begin{frame}[label={sec:org28e9a25},fragile]{\texttt{cli}'s CLI}
 \begin{verbatim}
cli -c run-NNN.json [cmd] [cmdargs] 
\end{verbatim}
\end{frame}

\begin{frame}[label={sec:orgd8b344f},fragile]{The config file}
 The \texttt{run-NNN.json} holds \alert{all} command information for run \texttt{NNN}.

Produced by script, not directly by humans (unless masochist).

Composed of top attributes:

\begin{description}
\item[{\texttt{.boot}}] the boot command from Gio's proposal, discussed last week.
Includes information needed to run a \texttt{daq\_application} command line to
create a running process.

\item[{\texttt{.inits}}] all \emph{init} command objects correlated to each process

\item[{\texttt{.confs}}] all \emph{conf} command objects correlated to each process

\item[{etc}] potentially other collections of commands
\end{description}

Ie, what we discussed last week.
\end{frame}

\begin{frame}[label={sec:orgd73a2f5},fragile]{\texttt{cli}'s CLI - a full startup}
 Full, monolithic startup of a (mini)DAQ:

\begin{verbatim}
$ cli -c run-42.json 
\end{verbatim}

No qualifying options so it applies:

\begin{enumerate}
\item the \emph{boot} command to start all processes then
\item the \emph{init} commands to each process and then
\item the \emph{conf} commands to each process and then maybe
\item the \emph{start} commands to each process.
\end{enumerate}

And then exits because we'd not want to immediately stop.
\end{frame}

\begin{frame}[label={sec:orge249a08},fragile]{\texttt{cli}'s CLI - fine grained}
 Piecemeal operations for experts/developers:

\begin{verbatim}
$ cli -c run-42.json boot                      # 1
$ cli -c run-42.json boot --procs proc1,proc2  # 2
\end{verbatim}

\begin{enumerate}
\item Would apply just \emph{boot} to all processes in the run config file.
\item Would apply just \emph{boot} to just the identified processes.
\end{enumerate}

Same patterns would be available for \emph{init}, \emph{conf} and the other
``standard'' (and custom?) commands.
\end{frame}

\begin{frame}[label={sec:org5282bd0},fragile]{What about \emph{start}, \emph{stop}, \emph{scrap}, etc}
 These are trivial command (\emph{start} has additional run number).

Despite the redundancy, we might as well provide them in \texttt{run-NNN.json}
in the same way as \emph{boot}, \emph{init} and \emph{conf}.  The \texttt{cli} may then become
\alert{agnostic} to the command semantics

In any case, same CLI pattern:

\begin{verbatim}
$ cli -c run-42.json start 
$ cli -c run-42.json start --procs proc1,proc2
\end{verbatim}
\end{frame}

\begin{frame}[label={sec:orgb874f89},fragile]{What about expert commands}
 Given command agnosticism, an expert may add their own expert commands
to a \texttt{run-NNN.json} file to enable issuing like:

\begin{verbatim}
$ cli -c run-42.json mycmd --proc myproc
\end{verbatim}
\end{frame}


\begin{frame}[label={sec:orgde15b06},fragile]{Questions}
 \begin{itemize}
\item Can \texttt{cli}, as described, be the human-DAQ UI to drive Glenn's system?
\item What desired human-DAQ interactions are not captured by these examples?
\end{itemize}
\end{frame}
\end{document}
