#LyX 2.0 created this file. For more info see http://www.lyx.org/ \lyxformat 413 \begin_document \begin_header \textclass article \use_default_options true \maintain_unincluded_children false \language english \language_package default \inputencoding auto \fontencoding global \font_roman default \font_sans default \font_typewriter default \font_default_family default \use_non_tex_fonts false \font_sc false \font_osf false \font_sf_scale 100 \font_tt_scale 100 \graphics default \default_output_format default \output_sync 0 \bibtex_command default \index_command default \paperfontsize 10 \spacing single \use_hyperref false \papersize a4paper \use_geometry true \use_amsmath 1 \use_esint 1 \use_mhchem 1 \use_mathdots 1 \cite_engine basic \use_bibtopic false \use_indices false \paperorientation portrait \suppress_date false \use_refstyle 1 \index Index \shortcut idx \color #008000 \end_index \secnumdepth 3 \tocdepth 3 \paragraph_separation indent \paragraph_indentation 0bp \quotes_language english \papercolumns 1 \papersides 1 \paperpagestyle default \tracking_changes false \output_changes false \html_math_output 0 \html_css_as_file 0 \html_be_strict false \end_header \begin_body \begin_layout Title STOPOS \end_layout \begin_layout Author Willem Vermin, willem.vermin@surfsara.nl \begin_inset Newline newline \end_inset Bas van der Vlies, bas.vandervlies@surfsara.nl \end_layout \begin_layout Date 2013-02-01 \end_layout \begin_layout Abstract In this article we describe the internals and externals of the program stopos. Stopos is primarily designed to facilitate the running of many tasks on a cluster computer. It is based on managing lines in a pool. These lines will in general be used as command lines to define tasks. Stopos is heavily inspired by ToPoS (https://grid.sara.nl/wiki/index.php/Using_the _Grid/ToPoS) and experiences with disparm (https://www.surfsara.nl/systems/lisa/so ftware/disparm). This project was carried out as a \begin_inset Quotes eld \end_inset seed-fund project \begin_inset Quotes erd \end_inset at SURFsara. \end_layout \begin_layout Subsection* Introduction \end_layout \begin_layout Standard A typical use of a cluster computer, such as SURFsara's Lisa system \begin_inset Foot status open \begin_layout Plain Layout https://www.surfsara.nl/systems/lisa \end_layout \end_inset , is running many tasks each task with different parameters. A typical example is a parameter scan. A typical job allocates a node, and runs a number of tasks in parallel. The number of tasks should in general be equal to the amount of cores and/or the amount of memory. Sometimes, thousands of these jobs are necessary, and normally, the job scripts are generated by a script. In a homogeneous cluster (all nodes have the same amount of cores and the same amount of memory) this is clumsy but doable, but when the cluster is heterogeneous (such as the Lisa cluster), it becomes very hard to use all types of nodes available, and adapt the number of processes to the node where the job runs on. To deal with this problems, stopos was created: a server that manages a pool of lines. These lines are defined by the user, and the server serves the lines to jobs, such that each line is produced once. Earlier successful solutions are ToPoS \begin_inset Foot status open \begin_layout Plain Layout https://grid.sara.nl/wiki/index.php/Using_the_Grid/ToPoS \end_layout \end_inset and disparm \begin_inset Foot status open \begin_layout Plain Layout https://www.surfsara.nl/systems/lisa/software/disparm \end_layout \end_inset . ToPoS is designed to be used on a server that can be accessed from the Grid, while disparm is based on files in the user's home directory. We think that ToPoS is not optimal for the Lisa system because of lack of cluster-based authentication and the universal access. The disparm approach is in these respects better, but in practice it appeared that the performance under heavy usage the performance was too low, and the reliability was not 100%: sometimes a line was produced more than once, or lines were not produced at all. Also, it is not possible to add lines dynamically: all lines have to be inserted at the beginning. We think that the approach followed in stopos is a well balanced solution, particularly fit to be used in a cluster environment. \end_layout \begin_layout Subsection* Usage \end_layout \begin_layout Standard A typical usage of stopos is: \end_layout \begin_layout Itemize fill the pool with lines \end_layout \begin_layout Itemize start jobs, each job gets one or more lines from the pool, and remove the lines that are not needed any more \begin_inset Foot status open \begin_layout Plain Layout Normally, a line is produced only once. However, the user can request that a line is produced and used again, for example in the case the previous task handling this line ran into a time limit. \end_layout \end_inset \end_layout \begin_layout Itemize maybe: add more lines to the pool \end_layout \begin_layout Standard Stopos is implemented as a shell function in the bash shell, or as an alias in the (t)csh shell. Stopos calls the program stoposclient and transforms it's output to environment variables, the most important being STOPOS_RC and STOPOS_VALUE. \end_layout \begin_layout Standard The commands to create the pool: \begin_inset Newline newline \end_inset \end_layout \begin_layout Standard \family typewriter \begin_inset space ~ \end_inset module load stopos \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset # activate the stopos software \end_layout \begin_layout Standard \family typewriter \begin_inset space ~ \end_inset stopos create \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset # create the pool \end_layout \begin_layout Standard \family typewriter \begin_inset space ~ \end_inset stopos add parmfile \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset # add the lines in the file parmfile to the pool \begin_inset Newline newline \end_inset \end_layout \begin_layout Standard In a job script, one could use code like this: \begin_inset Newline newline \end_inset \begin_inset Newline newline \end_inset \family typewriter \begin_inset space ~ \end_inset module load stopos \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset # activate the stopos software \end_layout \begin_layout Standard \family typewriter \begin_inset space ~ \end_inset stopos next \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset # get a line from the pool \end_layout \begin_layout Standard \family typewriter \begin_inset space ~ \end_inset if [ $STOPOS_RC = OK] ; then # check the return code \end_layout \begin_layout Standard \family typewriter \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset run_my_prog $STOPOS_VALUE \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset # run the program using the line as parameter \end_layout \begin_layout Standard \family typewriter \begin_inset space ~ \end_inset fi \begin_inset Newline newline \end_inset \end_layout \begin_layout Standard A more elaborate job script, using all cores available on a node is available in the Appendix, together with the man page of stopos. \end_layout \begin_layout Subsection* Tasks and communication \end_layout \begin_layout Standard Stopos is a shell function or an alias that calls stoposclient. Stoposclient communicates with stoposserver via an http server (apache \begin_inset Foot status open \begin_layout Plain Layout http://httpd.apache.org/ \end_layout \end_inset , thttpd \begin_inset Foot status open \begin_layout Plain Layout http://opensource.dyc.edu/sthttpd \end_layout \end_inset , ...). The server sends commands to the server, and transforms the answers to a format that are sourced by stopos to define environment variables. Care is taken that communications between the client and the server are short in length: at most a few kilobytes are sent between client and server. \end_layout \begin_layout Subsubsection* Tasks of the client \end_layout \begin_layout Standard The client parses it's command line, sends the appropriate command to the server and receives the response. This response is put in a form that can be 'eval-ed' so that environment variables are set. \begin_inset Newline newline \end_inset \begin_inset Newline newline \end_inset The client recognizes the following commands on its command line: \end_layout \begin_layout Itemize \family typewriter -h,--h \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset : prints a short usage message \end_layout \begin_layout Itemize \family typewriter -v,--v \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset : prints the version number \end_layout \begin_layout Itemize \family typewriter create [ -p,--pool POOL ] \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset : \family default create a pool \end_layout \begin_layout Itemize \family typewriter status [ -p,--pool POOL ] \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset : \family default get status from a pool \end_layout \begin_layout Itemize \family typewriter purge [ -p,--pool POOL] \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset : \family default remove a pool \end_layout \begin_layout Itemize \family typewriter pools \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset : \family default what are my pools \end_layout \begin_layout Itemize \family typewriter add [ -p,--pool POOL] [ FILENAME ]: \family default add a file to the pool \end_layout \begin_layout Itemize \family typewriter next [-m,--multi] \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset : \family default get next line from the pool \end_layout \begin_layout Itemize \family typewriter remove [ KEY ] \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset : \family default remove line \end_layout \begin_layout Itemize \family typewriter dump [ -p,--p POOL ] \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset : \family default dump a line from the pool \end_layout \begin_layout Standard For example: \begin_inset Newline newline \end_inset \begin_inset Newline newline \end_inset \family typewriter stopos create -p mypool1 \end_layout \begin_layout Standard \family typewriter stopos add -p mypool1 parmfile \begin_inset Newline newline \end_inset \end_layout \begin_layout Standard The -p (or --pool) flag defines the name of the pool file to be used ( \begin_inset Quotes eld \end_inset parmfile \begin_inset Quotes erd \end_inset in this example). If no -p or --pool flag is present, the value of the pool is taken from the environment variable STOPOS_POOL. If that is not available, the value \begin_inset Quotes eld \end_inset pool \begin_inset Quotes erd \end_inset is used. \end_layout \begin_layout Standard The -m (or --multi) flag signifies that lines that are already produces, may be produced again. \end_layout \begin_layout Standard The default for FILENAME is standard input. \end_layout \begin_layout Standard If no value is given for KEY with the \begin_inset Quotes eld \end_inset remove \begin_inset Quotes erd \end_inset command, the value of the environment variable STOPOS_KEY is used. This value is set by the \begin_inset Quotes eld \end_inset next \begin_inset Quotes erd \end_inset command. \begin_inset Newline newline \end_inset \begin_inset Newline newline \end_inset The following environment variables are set by the command \begin_inset Quotes eld \end_inset stopos \begin_inset Quotes erd \end_inset : \end_layout \begin_layout Itemize \family typewriter STOPOS_RC \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset : \family default return code of the command. The value \begin_inset Quotes eld \end_inset OK \begin_inset Quotes erd \end_inset means that things went well \end_layout \begin_layout Itemize \family typewriter STOPOS_VALUE \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset : \family default result of the \begin_inset Quotes eld \end_inset next \begin_inset Quotes erd \end_inset and \begin_inset Quotes eld \end_inset pools \begin_inset Quotes erd \end_inset command \end_layout \begin_layout Itemize \family typewriter STOPOS_COMMITTED : \family default number of times the \begin_inset Quotes eld \end_inset next \begin_inset Quotes erd \end_inset line was produced \end_layout \begin_layout Itemize \family typewriter STOPOS_KEY \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset : \family default set by the \begin_inset Quotes eld \end_inset next \begin_inset Quotes erd \end_inset command. Used by the \begin_inset Quotes eld \end_inset remove \begin_inset Quotes erd \end_inset command \end_layout \begin_layout Itemize \family typewriter STOPOS_COUNT \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset : \family default set by \begin_inset Quotes eld \end_inset status \begin_inset Quotes erd \end_inset : number of lines added to the pool \end_layout \begin_layout Itemize \family typewriter STOPOS_PRESENT \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset : \family default set by \begin_inset Quotes eld \end_inset status \begin_inset Quotes erd \end_inset : number of lines in the pool \end_layout \begin_layout Itemize \family typewriter STOPOS_PRESENT0 \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset : \family default set by \begin_inset Quotes eld \end_inset status \begin_inset Quotes erd \end_inset : number of lines never been committed \end_layout \begin_layout Standard Another task is creating a unique id for the user. This id, combined with the login name of the user and the name of the pool, will be used by the server to identify the pool to be used. The id is stored in the HOME directory of the user, in the file $HOME/.stopos/rc. If this file is missing, or inappropriate, the client will create this file. \begin_inset Newline newline \end_inset \begin_inset Newline newline \end_inset All commands result in a single communication with the server, except the \begin_inset Quotes eld \end_inset add \begin_inset Quotes erd \end_inset command: the client will send a number of \begin_inset Quotes eld \end_inset add \begin_inset Quotes erd \end_inset commands to the server, one for each line of the file. \begin_inset Newline newline \end_inset \begin_inset Newline newline \end_inset The \begin_inset Quotes eld \end_inset dump \begin_inset Quotes erd \end_inset command is kind of special. It is created for the case a user wants to inspect the actual contents of the pool. The \begin_inset Quotes eld \end_inset dump \begin_inset Quotes erd \end_inset command will produce one line per call, and does not interfere with the other commands. (More specific: the \begin_inset Quotes eld \end_inset next \begin_inset Quotes erd \end_inset command and the \begin_inset Quotes eld \end_inset dump \begin_inset Quotes erd \end_inset command use different pointers) When the last line has been produced, the next call will result in an error code (STOPOS_RC != OK). Then the next call will start again at the first available record in the pool. \end_layout \begin_layout Subsubsection* Messages from client to server \end_layout \begin_layout Standard A message from client to server consists of the following fields: \end_layout \begin_layout Itemize \family typewriter stopos \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset : \family default the string \begin_inset Quotes eld \end_inset stopos \begin_inset Quotes erd \end_inset \end_layout \begin_layout Itemize \family typewriter prot \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset : \family default the protocol to be used (i.e. which kind of database) \end_layout \begin_layout Itemize \family typewriter id \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset : \family default the identification of the user \end_layout \begin_layout Itemize \family typewriter pool \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset : \family default the name of the pool to be used \end_layout \begin_layout Itemize \family typewriter command \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset : \family default the command for the server \end_layout \begin_layout Itemize \family typewriter multi \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset : \family default the value of \begin_inset Quotes eld \end_inset multi \begin_inset Quotes erd \end_inset : can a line be produced more than once? \end_layout \begin_layout Itemize \family typewriter value \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset : \family default a parameter \end_layout \begin_layout Standard All fields are coded in hexadecimal strings, embraced by a fixed header and trailer. This is to ensure that no problematic things (spaces, tabs, slashes, empty strings etc.) have to be transmitted. The fields are separated with the character \begin_inset Quotes eld \end_inset - \begin_inset Quotes erd \end_inset . Example: to send a message to the server located at \begin_inset Quotes eld \end_inset http://www.stoposserver.surfsara.nl \begin_inset Quotes erd \end_inset with: \end_layout \begin_layout Itemize protocol = \begin_inset Quotes eld \end_inset gdbm \begin_inset Quotes erd \end_inset \end_layout \begin_layout Itemize user identification = \begin_inset Quotes eld \end_inset willem.qR7w3XQp \begin_inset Quotes erd \end_inset \end_layout \begin_layout Itemize poolname = \begin_inset Quotes eld \end_inset mypool \begin_inset Quotes erd \end_inset \end_layout \begin_layout Itemize command = \begin_inset Quotes eld \end_inset add \begin_inset Quotes erd \end_inset \end_layout \begin_layout Itemize multi = \begin_inset Quotes eld \end_inset no \begin_inset Quotes erd \end_inset \end_layout \begin_layout Itemize parameter = \begin_inset Quotes eld \end_inset 1 2 3 \begin_inset Quotes erd \end_inset \end_layout \begin_layout Standard The client would create the following url: \begin_inset Newline newline \end_inset \begin_inset Newline newline \end_inset \family typewriter http://www.stoposserver.surfsara.nl?ZZZ73746f706f73YY \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset Quotes eld \end_inset stopos \begin_inset Quotes erd \end_inset \end_layout \begin_layout Standard \family typewriter \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset -ZZZ6764626dYY \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset Quotes eld \end_inset gdbm \begin_inset Quotes erd \end_inset \end_layout \begin_layout Standard \family typewriter \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset -ZZZ77696c6c656d2e7152377733585170YY \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset Quotes eld \end_inset willem. \family default qR7w3XQp \begin_inset Quotes erd \end_inset \end_layout \begin_layout Standard \family typewriter \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset -ZZZ6d79706f6f6cYY \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset Quotes eld \end_inset mypool \begin_inset Quotes erd \end_inset \end_layout \begin_layout Standard \family typewriter \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset -ZZZ616464YY \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset Quotes eld \end_inset add \begin_inset Quotes erd \end_inset \end_layout \begin_layout Standard \family typewriter \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset -ZZZ6e6fYY \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset Quotes eld \end_inset no \begin_inset Quotes erd \end_inset \end_layout \begin_layout Standard \family typewriter \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset -ZZZ3120322033YY \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset Quotes eld \end_inset 1 2 3 \begin_inset Quotes erd \end_inset \begin_inset Newline newline \end_inset \end_layout \begin_layout Standard The header is \begin_inset Quotes eld \end_inset ZZZ \begin_inset Quotes erd \end_inset , the trailer is \begin_inset Quotes eld \end_inset YY \begin_inset Quotes erd \end_inset . \begin_inset Newline newline \end_inset \begin_inset Newline newline \end_inset \end_layout \begin_layout Subsubsection* Tasks for the server \end_layout \begin_layout Standard The server parses the message from the client, executes the command and sends the results back. The commands the the server recognizes are: \end_layout \begin_layout Itemize \family typewriter create \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset : \family default create a pool \end_layout \begin_layout Itemize \family typewriter status \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset : \family default send the status of the pool \end_layout \begin_layout Itemize \family typewriter purge \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset : \family default remove the pool \end_layout \begin_layout Itemize \family typewriter add \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset : \family default add a line, taken from the \begin_inset Quotes eld \end_inset value \begin_inset Quotes erd \end_inset field of the message \end_layout \begin_layout Itemize \family typewriter next \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset : \family default send the next line together with the \begin_inset Quotes eld \end_inset key \begin_inset Quotes erd \end_inset and \begin_inset Quotes eld \end_inset committed \begin_inset Quotes erd \end_inset . Take care of \begin_inset Quotes eld \end_inset multi \begin_inset Quotes erd \end_inset \end_layout \begin_layout Itemize \family typewriter remove \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset : \family default remove a line with key given in the \begin_inset Quotes eld \end_inset value \begin_inset Quotes erd \end_inset field \end_layout \begin_layout Itemize \family typewriter dump \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset : \family default return next line to be dumped, together with \begin_inset Quotes eld \end_inset key \begin_inset Quotes erd \end_inset and \begin_inset Quotes eld \end_inset committed \begin_inset Quotes erd \end_inset \end_layout \begin_layout Itemize \family typewriter pools \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset : \family default return the names of the available pools for the user \end_layout \begin_layout Standard Not accidentally: these commands have the same names as the commands for the client, but the context is different. \end_layout \begin_layout Subsubsection* Communication from server to client \end_layout \begin_layout Standard The server parses the message from the client and sends the result back, using \begin_inset Quotes eld \end_inset Content-type: text/plain \begin_inset Quotes erd \end_inset . The server puts the following string in the output: \begin_inset Newline newline \end_inset \begin_inset Newline newline \end_inset \family typewriter STOPOS: \family default \begin_inset Newline newline \end_inset \begin_inset Newline newline \end_inset This string is immediately followed by the desired output, which consists of the following fields: \end_layout \begin_layout Itemize \family typewriter return message \begin_inset space ~ \end_inset : \family default \begin_inset Quotes eld \end_inset OK \begin_inset Quotes erd \end_inset or some error message \end_layout \begin_layout Itemize \family typewriter key \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset : \family default key of the record just retrieved or empty \end_layout \begin_layout Itemize \family typewriter committed \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset : \family default number of times the record has been committed or empty \end_layout \begin_layout Itemize \family typewriter count \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset : \family default number of records added so far or empty \end_layout \begin_layout Itemize \family typewriter present \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset : \family default number of records present or empty \end_layout \begin_layout Itemize \family typewriter present0 \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset : \family default number of records never been committed or empty \end_layout \begin_layout Itemize \family typewriter value \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset : \family default return value or empty \end_layout \begin_layout Itemize \family typewriter new line character \end_layout \begin_layout Standard The client will search for the string \begin_inset Quotes eld \end_inset STOPOS: \begin_inset Quotes erd \end_inset and use the string immediately following as the result. The developer can, if she wishes, print extra information and have a look at the total output of the server, as long as she does not use the string \begin_inset Quotes eld \end_inset STOPOS: \begin_inset Quotes erd \end_inset . The fields are encoded, just like is done with the message from the client to the server, only the separator here is \begin_inset Quotes eld \end_inset + \begin_inset Quotes erd \end_inset for no special reason. \end_layout \begin_layout Subsection* Internals of the client \end_layout \begin_layout Standard The client parses the command line, using getopt(3). It performs some basic checks on the parameters given, and sends an appropriate command to the server, using libcurl(3). The output from the server is parsed and transformed into statements that can be executed in the shell. These commands set environment variables, with names starting with \begin_inset Quotes eld \end_inset STOPOS_ \begin_inset Quotes erd \end_inset . \end_layout \begin_layout Subsection* Internals of the server \end_layout \begin_layout Standard The server parses the command sent from the client and an http-server (apache, thttpd), executes it and sends the results back to the client. Most of the interesting work is done in the class \begin_inset Quotes eld \end_inset stopos_pool \begin_inset Quotes erd \end_inset . This class, from which a database-specific class has to be derived, maintains a double linked list of lines. The addressing of the lines is based on keys that are computed from the counter that is incremented each time a line is added. The derived class has to deal with some basic I/O operations: creating, opening, closing and removing of the database; reading, writing and removing records. In this code, four database implementations are provided: \end_layout \begin_layout Itemize based on gdbm \begin_inset Foot status open \begin_layout Plain Layout http://www.gnu.org.ua/software/gdbm/ \end_layout \end_inset \end_layout \begin_layout Itemize based om mysql \begin_inset Foot status open \begin_layout Plain Layout http://www.mysql.com/ \end_layout \end_inset \end_layout \begin_layout Itemize based on a flat ascii file \end_layout \begin_layout Itemize based on files in a folder, each file containing one line \end_layout \begin_layout Standard The client determines which implementation the server has to use. Storage of a record is based on the key, but, if desirable, the derived class can provide a suitable slot for storing the record. This feature is used in the \begin_inset Quotes eld \end_inset flat file \begin_inset Quotes erd \end_inset solution, in order to be able to re-use space occupied by removed records. \end_layout \begin_layout Subsubsection* Storage of lines \end_layout \begin_layout Standard Lines are stored in records, which also contain extra fields. The records are hexadecimal coded, just like the communication from client to server. The separation character is here '/'. Records are stored using unique keys, generated by the class \begin_inset Quotes eld \end_inset stopos_pool \begin_inset Quotes erd \end_inset . The derived class has no knowledge about the meaning of the records: it's only task is to store, retrieve and delete them. \end_layout \begin_layout Subsection* Performance \end_layout \begin_layout Standard A program \begin_inset Quotes eld \end_inset test_pool.cpp \begin_inset Quotes erd \end_inset has been provided which runs all four implementations, without an http server, but directly calling the functions from the class \begin_inset Quotes eld \end_inset stopos_pool \begin_inset Quotes erd \end_inset and reports how much time a implementation takes. Furthermore, it does some consistency checks. The pool consists of a few hundreds of lines. The results are \begin_inset Foot status open \begin_layout Plain Layout The program was run on a Linux workstation, equipped with a \begin_inset Quotes eld \end_inset normal \begin_inset Quotes erd \end_inset (no SSD) disk \end_layout \end_inset : \begin_inset Newline newline \end_inset \begin_inset Newline newline \end_inset \family typewriter database \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset time (sec) \begin_inset Newline newline \end_inset gdbm \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset 3.31 \end_layout \begin_layout Standard \family typewriter flatfile \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset 0.19 \end_layout \begin_layout Standard \family typewriter files \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset 0.73 \end_layout \begin_layout Standard \family typewriter mysql \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset 4.7 \family default 1 \begin_inset Newline newline \end_inset \begin_inset Newline newline \end_inset The winner is clearly the \begin_inset Quotes eld \end_inset flat file \begin_inset Quotes erd \end_inset implementation. Disadvantage of this solution (and also of the \begin_inset Quotes eld \end_inset files \begin_inset Quotes erd \end_inset and \begin_inset Quotes eld \end_inset mysql \begin_inset Quotes erd \end_inset solution) is the amount of space that is used for the database: each line takes 4 Kbyte. The \begin_inset Quotes eld \end_inset gdbm \begin_inset Quotes erd \end_inset solution does not have this problem. \begin_inset Newline newline \end_inset Normally, the stopos software will be used using an http server, so it is more relevant to have look at the timings in this case. As an example, that man page of bash (5459 lines) was put in the pool, and all lines were retrieved and removed: \begin_inset Newline newline \end_inset \begin_inset Newline newline \end_inset \family typewriter database \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset time(sec) \end_layout \begin_layout Standard \family typewriter gdbm \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset 187 \end_layout \begin_layout Standard \family typewriter flatfile \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset 182 \end_layout \begin_layout Standard \family typewriter files \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset 190 \end_layout \begin_layout Standard \family typewriter mysql \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \begin_inset space ~ \end_inset \family default 309 \begin_inset Newline newline \end_inset \begin_inset Newline newline \end_inset These timings show, that for performance reasons, there is not much difference between \begin_inset Quotes eld \end_inset gdbm \begin_inset Quotes erd \end_inset , \begin_inset Quotes eld \end_inset flatfile \begin_inset Quotes erd \end_inset and \begin_inset Quotes eld \end_inset files \begin_inset Quotes erd \end_inset . We choose the \begin_inset Quotes eld \end_inset gdbm \begin_inset Quotes erd \end_inset implementation, because of it's economy with disk space used. \end_layout \begin_layout Subsection* Installation \end_layout \begin_layout Standard The source tree contains a file \begin_inset Quotes eld \end_inset Make.inc \begin_inset Quotes erd \end_inset , defining variables that determine the version of the program, the installation directories and which database versions should be produced. This file will be included in the Makefile. A trivial script \begin_inset Quotes eld \end_inset makeit \begin_inset Quotes erd \end_inset sets the umask and calls make(1) to create and install the executables. The script \begin_inset Quotes eld \end_inset clean \begin_inset Quotes erd \end_inset executes a \begin_inset Quotes eld \end_inset make clean \begin_inset Quotes erd \end_inset to get rid of compilation products. \end_layout \begin_layout Subsubsection* Extra tools \end_layout \begin_layout Standard The source tree also contains the scripts \begin_inset Quotes eld \end_inset sara-get-num-cores \begin_inset Quotes erd \end_inset and \begin_inset Quotes eld \end_inset sara-get-mem-size \begin_inset Quotes erd \end_inset , along with their man pages. Sara-get-num-cores prints the number of available cores, while sara-get-mem-siz e prints the amount of memory. Both numbers can be used to determine how many processes should run in parallel on a given node. These scripts and man pages will be installed also by calling \begin_inset Quotes eld \end_inset ./makeit \begin_inset Quotes erd \end_inset . \end_layout \begin_layout Subsection* Example of a job using stopos \end_layout \begin_layout Standard \begin_inset listings inline false status open \begin_layout Plain Layout 1 #PBS -lnodes=1 -lwalltime=3:00:00 \end_layout \begin_layout Plain Layout 2 module load stopos \end_layout \begin_layout Plain Layout 3 ncores=`sara-get-num-cores` \end_layout \begin_layout Plain Layout 4 for ((i=1; i<=ncores; i++)) ; do \end_layout \begin_layout Plain Layout 5 ( \end_layout \begin_layout Plain Layout 6 for ((j=1; j<=10; j++)) ; do \end_layout \begin_layout Plain Layout 7 stopos next -p pool1 \end_layout \begin_layout Plain Layout 8 if [ "$STOPOS_RC" != "OK" ]; then \end_layout \begin_layout Plain Layout 9 break \end_layout \begin_layout Plain Layout 10 fi \end_layout \begin_layout Plain Layout 11 eval "scanner $STOPOS_VALUE" \end_layout \begin_layout Plain Layout 12 stopos remove -p pool1 \end_layout \begin_layout Plain Layout 13 done \end_layout \begin_layout Plain Layout 14 ) & \end_layout \begin_layout Plain Layout 15 done \end_layout \begin_layout Plain Layout 16 wait \end_layout \end_inset \end_layout \begin_layout Itemize 1 Note: we do not specify how many cores a node should have. \end_layout \begin_layout Itemize 2 Load the stopos module. \end_layout \begin_layout Itemize 3 Determine the number of cores available on this node: Module stopos contains 'sara-get-num-cores': this command prints the number of cores available on the node. The command 'sara-get-mem-size' prints the available amount of memory in Mbytes. We do not use it here, but this number could be interesting when running memory intensive programs. \end_layout \begin_layout Itemize 4 Loop over the number of cores. The content of the loop is placed in the background (see 14) \end_layout \begin_layout Itemize 6 Loop over the number of the desired number of repetitions. \end_layout \begin_layout Itemize 7 Here we get the value of the next line, delivered in the environment variable STOPOS_VALUE. The environment variable STOPOS_RC has the value "OK" if everything went ok. STOPOS_KEY contains a value that can be used to remove the line from the pool. We use the pool 'pool1', created before. \end_layout \begin_layout Itemize 8 .. 10 Break out the loop if stopos fails (usually because there are no lines left). \end_layout \begin_layout Itemize 11 Use the parameters in $STOPOS_VALUE. The 'eval' and quotes ensure that spaces and quotes in the parameters are correctly interpreted. \end_layout \begin_layout Itemize 12 Remove the line we just processed from the pool. \end_layout \begin_layout Itemize 14 Notice the &: this takes care that ncores instantiations of scanner will be started in parallel. \end_layout \begin_layout Itemize 16 The 'wait' ensures that the job script will only finish after all background processes are ended. \end_layout \begin_layout Itemize The job can be submitted a number of times with one 'qsub' command, for example: \family typewriter qsub -t 1-100 job \end_layout \begin_layout Subsection* Man page of stopos \end_layout \begin_layout Standard \family typewriter \begin_inset listings inline false status open \begin_layout Plain Layout \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout STOPOS(1) STOPOS(1) \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout NAME \end_layout \begin_layout Plain Layout stopos - alias to call the program stoposclient and eval it's output \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout SYNOPSIS \end_layout \begin_layout Plain Layout stopos -h,--help \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout stopos -v,--version \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout stopos create [ -p,--pool POOL ] \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout stopos status [ -p,--pool POOL] \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout stopos purge [ -p,--pool POOL ] \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout stopos pools \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout stopos add [ -p,--pool POOL ] [ FILENAME ] \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout stopos next [ -p,--pool POOL ] [ -m,--multi ] \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout stopos remove [ -p,--pool POOL] [ KEY ] \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout stopos dump [ -p,--pool POOL] \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout The -q,--quiet flag supresses most output. \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout DESCRIPTION \end_layout \begin_layout Plain Layout Stopos is an alias using the program stoposclient, an utility to store \end_layout \begin_layout Plain Layout and retrieve text lines in a pool. In general, the text lines are used \end_layout \begin_layout Plain Layout as command parameters, see Examples. \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout COMMANDS \end_layout \begin_layout Plain Layout -h,--help \end_layout \begin_layout Plain Layout Prints usage information. \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout -v,--version \end_layout \begin_layout Plain Layout Prints version. \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout create [ -p,--pool POOL ] [ FILENAME ] \end_layout \begin_layout Plain Layout Creates new pool. A pool with the same name will be removed first. \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout status \end_layout \begin_layout Plain Layout Prints to standard error environment variable \end_layout \begin_layout Plain Layout --------------------------------------------------- \end_layout \begin_layout Plain Layout total number of lines added STOPOS_COUNT \end_layout \begin_layout Plain Layout number of lines present STOPOS_PRESENT \end_layout \begin_layout Plain Layout number of lines never committed STOPOS_PRESENT0 \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout purge [-p,--pool POOL ] \end_layout \begin_layout Plain Layout Removes the pool. \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout pools [-p,--pool POOL ] \end_layout \begin_layout Plain Layout Lists on standard error the pools available. The environment \end_layout \begin_layout Plain Layout variable STOPOS_VALUE is set accordingly. \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout add [ -p,--pool POOL ] [ FILENAME ] \end_layout \begin_layout Plain Layout Adds lines from FILENAME, default from stdin. The environ‐ \end_layout \begin_layout Plain Layout ment variables STOPOS_RC and STOPS_KEY are set. \end_layout \begin_layout Plain Layout NOTE: when stopos is reading from a pipe as in: \end_layout \begin_layout Plain Layout cat parmfile | stopos add \end_layout \begin_layout Plain Layout no environment variables are set. \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout next [ -p,--pool POOL ] [ -m,--multi ] \end_layout \begin_layout Plain Layout Gets the next line from the pool. The environment variables \end_layout \begin_layout Plain Layout STOPOS_VALUE, STOPOS_COMMITTED and STOPOS_KEY are set, see \end_layout \begin_layout Plain Layout ENVIRONMENT. By default, the same line in the pool will be \end_layout \begin_layout Plain Layout produced only once. When all lines are commited, STOPS_RC \end_layout \begin_layout Plain Layout will not be equal to OK. Using the --multi flag, the same \end_layout \begin_layout Plain Layout line can be produced more than once, if necessary stopos \end_layout \begin_layout Plain Layout will wrap around. This can be useful for dealing with \end_layout \begin_layout Plain Layout crashed jobs. \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout remove [-p,--pool POOL ] [ KEY ] \end_layout \begin_layout Plain Layout Removes the line with key KEY as ready. If not specified on \end_layout \begin_layout Plain Layout the commandline, the value of environment variable STO‐ \end_layout \begin_layout Plain Layout POS_KEY is used. \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout dump [-p,--pool POOL ] \end_layout \begin_layout Plain Layout Reads the next available line, and puts it, preceded by it's \end_layout \begin_layout Plain Layout key and number of commitments in environment variable STO‐ \end_layout \begin_layout Plain Layout POS_VALUE. The first call will produce the first line. When \end_layout \begin_layout Plain Layout all lines have been delivered, STOPOS_RC gets a value other \end_layout \begin_layout Plain Layout than OK. A subsequent call will start the dump with the \end_layout \begin_layout Plain Layout first line again. \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout OPTIONS \end_layout \begin_layout Plain Layout -p,--pool POOL \end_layout \begin_layout Plain Layout POOL is a unique name of the pool. Default: pool. The name \end_layout \begin_layout Plain Layout of the pool can also be set using the environment variable \end_layout \begin_layout Plain Layout STOPOS_POOL. The command line flag has precedence. \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout ENVIRONMENT \end_layout \begin_layout Plain Layout Stopos sets the following environment variables: \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout STOPOS_RC if the value is OK, than no errors were found \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout STOPOS_KEY contains the keyvalue of the line produced with the \end_layout \begin_layout Plain Layout 'next' command \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout STOPOS_COMMITTED contains the number of times the line has been \end_layout \begin_layout Plain Layout committed \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout STOPOS_VALUE contains the line produced by the 'next' command or \end_layout \begin_layout Plain Layout the result of the 'pools' command \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout STOPOS_COUNT STOPOS_PRESENT STOPOS_PRESENT0 see the 'status' \end_layout \begin_layout Plain Layout command above \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout Stopos uses the following environment variables: \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout STOPOS_POOL see the description of the --pool flag under OPTIONS \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout STOPOS_KEY see the 'remove' flag above \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout STOPOS_SERVER_URL the url stopos uses to access the server, \end_layout \begin_layout Plain Layout default http://stopos.osd.surfsara.nl/cgi-bin/stoposserver \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout EXAMPLES \end_layout \begin_layout Plain Layout Create a pool with the first 10 lines from the man page of sed: \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout man sed | head > parmfile \end_layout \begin_layout Plain Layout stopos create \end_layout \begin_layout Plain Layout stopos add parmfile \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout Get a line: \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout stopos next \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout The environment variable STOPOS_VALUE contains now one of \end_layout \begin_layout Plain Layout the first ten lines of the man page of sed. \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout You can use this in a command like this: \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout eval "myparser $STOPOS_VALUE" \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout The line can be removed by: \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout stopos remove \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout Finally, the pool can be completely removed by: \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout stopos purge \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout FILES \end_layout \begin_layout Plain Layout $HOME/.stopos/id \end_layout \begin_layout Plain Layout This file is set by stopos to store an unique id, which, \end_layout \begin_layout Plain Layout together with the login name, will be used to identify which \end_layout \begin_layout Plain Layout pools are yours. \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout SEE ALSO \end_layout \begin_layout Plain Layout sara-get-mem-size(1), sara-get-num-cores(1), stoposclient(1), \end_layout \begin_layout Plain Layout stoposdump(1) \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout AUTHORS \end_layout \begin_layout Plain Layout Willem Vermin \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout BUGS \end_layout \begin_layout Plain Layout No bugs known yet. \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout STOPOS(1) \end_layout \begin_layout Plain Layout \end_layout \end_inset \end_layout \end_body \end_document