Updated:
authorJan Pospíšil <honik@ntc.zcu.cz>
Wed, 12 Dec 2007 18:57:44 +0000 (18:57 +0000)
committerJan Pospíšil <honik@ntc.zcu.cz>
Wed, 12 Dec 2007 18:57:44 +0000 (18:57 +0000)
- new structure of the User's guide
-- Introduction taken from the JGCUF paper (Cesnet TR)
- proposed a new structure for Admin's and Developer's guide
- added some .T generated files

30 files changed:
org.glite.lb.doc/Makefile
org.glite.lb.doc/src/LBAG-Introduction.tex
org.glite.lb.doc/src/LBDG-Introduction.tex [new file with mode: 0644]
org.glite.lb.doc/src/LBDG.tex [new file with mode: 0644]
org.glite.lb.doc/src/LBUG-Appendix.tex [new file with mode: 0644]
org.glite.lb.doc/src/LBUG-Architecture.tex [deleted file]
org.glite.lb.doc/src/LBUG-Caveats.tex [deleted file]
org.glite.lb.doc/src/LBUG-Interaction.tex [deleted file]
org.glite.lb.doc/src/LBUG-Introduction.tex
org.glite.lb.doc/src/LBUG-QuickStartGuide.tex [deleted file]
org.glite.lb.doc/src/LBUG-Security.tex [deleted file]
org.glite.lb.doc/src/LBUG-Tools.tex [new file with mode: 0644]
org.glite.lb.doc/src/LBUG-UseCases.tex [new file with mode: 0644]
org.glite.lb.doc/src/LBUG.tex
org.glite.lb.doc/src/change_acl.tex
org.glite.lb.doc/src/consumer_api.tex
org.glite.lb.doc/src/definitions.tex
org.glite.lb.doc/src/events.tex.T [new file with mode: 0644]
org.glite.lb.doc/src/frontmatter.tex
org.glite.lb.doc/src/images/LB-components-gather.pdf [new file with mode: 0644]
org.glite.lb.doc/src/images/LB-components-query.pdf [new file with mode: 0644]
org.glite.lb.doc/src/images/seqtree.pdf [new file with mode: 0644]
org.glite.lb.doc/src/images/wms2-jobstat.pdf [new file with mode: 0644]
org.glite.lb.doc/src/log_usertag.tex
org.glite.lb.doc/src/logevent.tex [moved from org.glite.lb.doc/src/cmdln_interface.tex with 97% similarity]
org.glite.lb.doc/src/logging-arch-notif.pdf [deleted file]
org.glite.lb.doc/src/notification_api.tex
org.glite.lb.doc/src/producer_api.tex [new file with mode: 0644]
org.glite.lb.doc/src/status.tex.T [new file with mode: 0644]
org.glite.lb.doc/src/web_services.tex [new file with mode: 0644]

index 3141d77..d5a6ca3 100644 (file)
@@ -12,12 +12,16 @@ PREFIX=/opt/glite
 VPATH = ${top_srcdir}/src
 KPATH = TEXINPUTS=".:$(VPATH)//:"
 KPATHBIB = BIBINPUTS=".:$(VPATH)//:"
+
 LATEX = $(KPATH) latex
 PDFLATEX = $(KPATH) pdflatex
 BIBTEX = $(KPATHBIB) bibtex
 DVIPS = $(KPATH) dvips
+AT3=${stagedir}/sbin/glite-lb-at3
+
+default all: generate LBUG.pdf LBAG.pdf LBDG.pdf
 
-default: LBUG.pdf LBAG.pdf
+generate: events.tex status.tex
 
 # %.dvi: %.tex
 #      $(LATEX) $<
@@ -34,7 +38,12 @@ default: LBUG.pdf LBAG.pdf
        $(PDFLATEX) $<
        $(PDFLATEX) $<
 
+%.tex: %.tex.T
+       rm -f $@
+       ${AT3} $< >$@ || rm -f $@
+       chmod -w $@ >/dev/null
+
 clean:
-       rm -rvf LBUG* LBAG*
+       rm -rvf LBUG* LBAG* LBDG* events.tex status.tex
 
 .PHONY: all clean purge ps pdf
index 78c04d7..55d7858 100644 (file)
@@ -1,3 +1,10 @@
 \section{Introduction}
 
-\endinput
+This document should contain
+
+\subsection{deployment scenarios}
+\subsection{instalation}
+\subsection{configuration}
+\subsection{complete RMPs description}
+\subsection{daemons description}
+\subsection{CLI tools description: purge/dump/load}
diff --git a/org.glite.lb.doc/src/LBDG-Introduction.tex b/org.glite.lb.doc/src/LBDG-Introduction.tex
new file mode 100644 (file)
index 0000000..78c04d7
--- /dev/null
@@ -0,0 +1,3 @@
+\section{Introduction}
+
+\endinput
diff --git a/org.glite.lb.doc/src/LBDG.tex b/org.glite.lb.doc/src/LBDG.tex
new file mode 100644 (file)
index 0000000..ebdccc0
--- /dev/null
@@ -0,0 +1,44 @@
+\documentclass{egee}
+
+\input{definitions}
+
+\title{Logging and Bookkeeping}
+\Subtitle{Developer's Guide}
+\author{CESNET EGEE II JRA1 team}
+\DocIdentifier{EGEE-II....}
+\Date{\today}
+\Activity{JRA1: Middleware Engineering and Integration}
+\DocStatus{DRAFT}
+\Dissemination{PUBLIC}
+\DocumentLink{http://...}
+
+\Abstract{This developer's guide explains how to use the Logging and Bookkeeping
+(\LB) service API. Logging, querying and notification API as well as the Web Services 
+Interface is described in details together with programming examples. }
+
+\begin{document}
+
+\input{frontmatter}
+\tableofcontents
+
+\newpage
+\input{LBDG-Introduction}
+
+\newpage
+\input{producer_api}
+
+\newpage
+\input{consumer_api}
+
+\newpage
+\input{notification_api}
+
+\newpage
+\input{web_services}
+
+\newpage
+\bibliographystyle{unsrt}
+\bibliography{lbjp}
+
+\end{document}
+
diff --git a/org.glite.lb.doc/src/LBUG-Appendix.tex b/org.glite.lb.doc/src/LBUG-Appendix.tex
new file mode 100644 (file)
index 0000000..e1e575c
--- /dev/null
@@ -0,0 +1,16 @@
+\section*{Appendix}
+
+\section{\LB Event Types}
+\label{a:events}
+Complete list of all events' names together with their description follows.
+% see events.tex.T
+\input{events}
+
+\newpage
+\section{\LB Job States}
+\label{a:jobstat}
+Complete list of all job' states together with their description follows.
+% see status.tex.T
+\input{status}
+
+
diff --git a/org.glite.lb.doc/src/LBUG-Architecture.tex b/org.glite.lb.doc/src/LBUG-Architecture.tex
deleted file mode 100644 (file)
index 69cfc09..0000000
+++ /dev/null
@@ -1,117 +0,0 @@
-\subsection{Service Architecture}
-
-Within the gLite WMS, upon creation
- each job is assigned a~unique, virtually non-recyclable
-\emph{job identifier} (JobId) in an~URL form.
-The server part of the URL designates the \emph{bookkeeping server} which
-gathers and provides information on the job for its whole life.
-
-High level view on the \LB\ architecture is shown in Fig.~\ref{fig-arch}
-on page~\pageref{fig-arch}.
-
-\LB\ tracks jobs in terms of \emph{events} (\eg\ \emph{Transfer} from a~WMS
-component to another one, \emph{Run} and \emph{Done} when the jobs starts
-and stops execution, \dots).
-Each event type carries its specific attributes.
-The entire architecture is specialized for this purpose and is job-centric\Dash
-any event is assigned to a~unique Grid job.
-
-\subsubsection{Event delivery and storage}
-The events are gathered from various WMS components by the
-\emph{\LB\ producer library}
-and passed on to the \emph{locallogger} daemon,
-running physically close to avoid
-any sort of network problems.
-The locallogger's task is storing the accepted event in a~local disk file.
-Once it's done, confirmation is sent back and the logging library call
-returns, reporting success.
-Consequently, logging calls have local, virtually non-blocking semantics.
-
-Further on, event delivery is managed by the \emph{interlogger} daemon.
-It takes the events from the locallogger (or the disk files on crash recovery),
-and repeatedly tries to deliver them to the destination
-bookkeeping server (known from the JobId) until it succeeds finally.
-Therefore the entire event delivery is highly reliable.
-However, in the standard mode described so far it is asynchronous
-(there is a~synchronous mode for special usage not discussed here)
-there is no direct way for the caller to see whether an event has been
-already delivered.
-Our experience shows that the semantics is suitable in the prevailing number
-of cases while being the most efficient in the erratic Grid environment.
-
-The bookkeeping server processes the incoming events
-to give a~higher level view
-on the job states (\eg\ \emph{Submitted, Running, Done}),
-each having an appropriate set of attributes again.
-\LB\ provides a~public interface (Sect.~\ref{query-C})
-to retrieve them via synchronous queries.
-
-Further on, upon each event delivery to the \LB\ server the new computed 
-job state is matched against the set of registered requests for notification.
-If some of them match, special events\Dash\emph{notifications} are generated
-and passed to a~modified 
-\emph{notification interlogger}.
-It takes over the notification from LB server, stores it into file and
-periodically tries to deliver it to the address where the corresponding
-notification client is listening.
-If the user changes this address (IP or port) 
-\LB\ server instructs the notification interlogger to change 
-the destination of possible pending notifications.
-
-\subsubsection{Queries}
-\label{arch-queries}
-One part of the \LB\ interface is the query API (Sect.~\ref{query-C}).
-Two types of queries are supported\Dash\emph{job queries} which return
-one or more jobs, including a~detailed description of their states,
-and \emph{event queries} returning the raw \LB\ events.
-In general, job queries are used to track normal life of jobs,
-event queries are used mostly for tracing abnormal behaviour. 
-
-Each query is formed of several conditions (\eg\ concrete jobid's,
-owner of jobs, particular job state etc.).
-The \LB\ library formats the conditions into a~query message, passes it to
-the server, and waits for the response which is passed to the user
-synchronously.
-
-\subsubsection{Notifications}
-\label{notification}
-On the contrary, the notification API (Sect.~\ref{notify-C}) allows
-the user to 
-register for notifications. These are delivered to the listening
-client asynchronously, when the particular event (a~change of job status
-typically) occurs.
-The main purpose of this \LB\ functionality is avoiding unnecessary load
-on the \LB\ server serving many repeated queries (polling) with the same
-result most of the time.
-
-Using a~notification client (program that uses LB client
-API to handle notifications) the user registers with a~\LB\ server
-to receive notifications. 
-She  must specify conditions under which the
-notification is sent. These conditions are a~subset of the conditions
-available for synchronous queries (Sect.~\ref{arch-queries}).
-Currently due to implementation constraints, one
-or more jobid's are required among the conditions and only
-a~single occurrence of a~specific attribute is allowed. The registration is 
-sent to the \LB\ server in the same way as synchronous queries,
-and stored there.
-In response, the server generates a~unique notification ID which is used
-by the user to refer to this notification further on.
-The user may
-change conditions which trigger notification, prolong validity of
-the registration, remove the registration from LB server,
-or even change the destination of notifications, \ie\ the address where
-a~client listens for notifications.
-
-The registration is soft-state; it exists only for limited amount of time. The
-validity is returned by LB server together with notification ID.
-
-While the registration is valid, 
-the user may stop the notification client and launch another, even
-on a~different machine.
-Notifications generated during the time when there was no client listening
-for them are kept by the notification interlogger.
-Once a~new listening address is announced to the
-server, the pending notifications are delivered. 
-
-\endinput
diff --git a/org.glite.lb.doc/src/LBUG-Caveats.tex b/org.glite.lb.doc/src/LBUG-Caveats.tex
deleted file mode 100644 (file)
index ac04a14..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-\section{Known Problems and Caveats}
-
-\subsection{Indexed attributes}\label{ConsIndx}
-\LB\ queries can be fairly complicated and they can potentially return large 
-amounts of data. In such cases, there is a~risk of server overload.
-In order to prevent the overload, every \LB\ server configuration
-includes a~set of configurable \emph{indices}, empty by default
-(job ID is always indexed).
-In general, at least one indexed attribute must be
-present in each query\,---\,queries over only attributes without indices
-are refused.
-
-Unfortunately, in some cases queries that may be considered very important from
-the user's point of view (like all user's jobs) fall into this category. 
-Indexing specific attributes makes these queries tractable
-(while increasing the risk of server overload).
-It's left up to the server administrator to decide which query types are
-supported by configuring indices over attribute sets of desired queries using
-the \texttt{glite-lb-bkindex} utility.
-I.\,e.\ if the attribute \texttt{EDG\_WLL\_QUERY\_ATTR\_OWNER} is not indexed,
-some of 
-queries in the presented examples 
-% odkazuje na totez :-( (\eg\ Sect.'s~\ref{JQ-auj},\ref{JQ-rj})
-(Sect.'s~\ref{JQ-auj})
-are forbidden.
-
-\subsection{Timeouts}
-
-All blocking \LB\ API calls are subject to timeouts. Timeout values can be changed 
-from their respective defaults with \texttt{edg\_wll\_SetParam} 
-call or using variables of the process environment (floating point number of seconds).
-
-\begin{tabular}{lcll}
-affected calls&default(max)&parameter&env. variable\\
-async. logging&120 (1800)&\texttt{EDG\_WLL\_PARAM\_LOG\_TIMEOUT}&\texttt{EDG\_WL\_LOG\_TIMEOUT}\\
-sync. logging&120 (1800)&\texttt{EDG\_WLL\_PARAM\_LOG\_SYNC\_TIMEOUT}&\texttt{EDG\_WL\_LOG\_SYNC\_TIMEOUT}\\
-queries&120 (1800)&\texttt{EDG\_WLL\_PARAM\_QUERY\_TIMEOUT}&\texttt{EDG\_WL\_QUERY\_TIMEOUT}\\
-notifications&120 (1800)&\texttt{EDG\_WLL\_PARAM\_NOTIF\_TIMEOUT}&\texttt{EDG\_WL\_NOTIF\_TIMEOUT}\\
-\end{tabular}
-
-\subsection{Timestamps}
-Timestamps of \LB\ event is recorded by the process calling a~logging API call. It is strongly recommended
-to keep clocks of all systems that produce \LB\ events (UI, WM, WN) in reasonable synchronization so that
-timestamp attributes of events and job status can be interpreted easily.
-
-On the other hand, timestamps are not authoritative when \LB\ events
-are sorted in order to compute job state\Dash a~more robust mechanism
-of the hierarchical \LB\ sequence code is used instead. 
-Consequently, strict timestamp sorting of events coming from desynchronised
-sources may give different (incorrect) results from what \LB\ reports in job
-state.
-
-\subsection{Size limitations}
-
-Current implementation of \LB\ has a~few built-in size limits, mostly related
-to schema of underlaying MySQL database. By default, the limits are:
-
-\begin{tabular}{lc}
-item & maximum size\\
-user certificate subject&255 bytes\\
-event attribute (JDL etc.) &16 megabytes\\
-tag name&200 bytes\\
-tag value&255 bytes\\
-job ACL&16 megabytes\\
-notification destination&200 bytes\\
-\end{tabular}
-
-The restriction on tag value is twofold.
-Values up to 16\,MB may be logged and retrieved as raw events.
-However, when reported in job state longer values are truncated to 255 bytes.
-The restriction is inherited from MySQL limit on index size.
-
-\subsection{Running startup scripts}
-
-Startup scripts of the \LB\ service daemons should not be called without preconditions 
-being satisfied, \eg\ one should not try to start a~service when it is already running
-or try to restart it from a~cron job without checking whether the machine is shutting down
-at the time.
-
-\subsection{Dependencies}
-
-It is strongly discouraged to use \LB\ with different revisions
-of external dependencies (MySQL, Globus Toolkit)
-than those described in the release documentation. While the \LB\ has been designed to achieve
-reasonable backward and forward compatibility, some disruptive changes in minor revisions
-of external software have been observed before.
-
-\endinput
diff --git a/org.glite.lb.doc/src/LBUG-Interaction.tex b/org.glite.lb.doc/src/LBUG-Interaction.tex
deleted file mode 100644 (file)
index 85aabde..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-\subsection{Interactions with other Services}
-
-The main \LB\ functionality is keeping track of jobs managed by
-the Workload Management System otherwise.
-Therefore its basic usage is done internally by the WMS components.
-However, the query and notification interface is completely available
-to user-level applications. Upto limited extent (two event types)
-this holds for the event-logging interface too.
-
-\subsubsection{Event sources}
-\LB\ events are generated by the following WMS components:
-\begin{description}
-\item[User Interface] registers the job with \LB\ and provides details
-on transfer of the job to the resource broker.
-\item[Resource Broker,] consisting of several WMS components,
-logs various events as the job is passed among these components, 
-as well as other important job-related information (\eg\ the chosen
-destination Computing Element).
-\item[Computing Element,] via the Job Wrapper script, provides the immediate
-information on job execution.
-\end{description}
-Besides these WMS components the job payload may also log UserTag events
-(see Sect.~\ref{log_usertag}) containing arbitrary user information.
-
-Checkpointable jobs also use \LB\ to keep track of the job progress.
-This is done internally by the checkpoint support library.
-
-Finally, changes of job access control lists are done by logging
-another event. This may be done directly by the user or using the WMS
-user interface.
-
-\subsubsection{Queries}
-
-The \LB\ queries with a~user-visible output
-are executed from within WMS User Interface
-commands glite-job-status and glite-job-logging-info.
-
-Besides those several WMS components use \LB\ internally to query
-information on job status which is relevant for their processing.
-
-\subsubsection{Notifications}
-
-Notifications on job state change are used by WMS GUI 
-to monitor the state of jobs periodically.
-
-\subsubsection{Component and Interaction Diagrams}
-% \todo{nekdy priste}
-% To help understanding the service a set of component and interaction
-% diagrams might help. This section is not mandatory.
-
-\begin{figure}[h]
-\centering
-\includegraphics[width=.8\hsize]{logging-arch-notif}
-\caption{Overview of the \LB\ architecture}
-\label{fig-arch}
-\end{figure}
-
-
-\endinput
index 70fbb7d..68e1bad 100644 (file)
 \section{Introduction}
-%This Section should give a brief summary of what the service described
-%is supposed to achieve and how it fits into the overall
-%architecture. It should contain subsections on the service internal
-%architecture and its relations to other services. 
-
-The Logging and Bookkeeping (\LB) service tracks jobs managed by 
-the gLite WMS (workload management system).
-It gathers events from various WMS components in a~reliable way
-and processes them in order to give a~higher level view, the
-\emph{status of job}.
-
-Virtually all the important
-data are fed to \LB\ internally from various gLite middleware
-components, transparently from the user's point of view.
-On the contrary, \LB\ provides public interfaces for querying the job
-information synchronously as well as registering for asynchronous
-notifications.
-API's for this functionality are described in this document in detail.
-
-\endinput
+
+%historie: vyrobeno pro WMS v EDG, 1. a 2. verze (seq. èísla,
+%cache a dotazy na stavy), v EGEE gLite---ustabilnìní, proxy
+
+The Logging and Bookkeeping service (\LB\ for short) was initially
+developed in the EU DataGrid
+project\footnote{\url{http://eu-datagrid.web.cern.ch/eu-datagrid/}}
+as a~part of the 
+Workload Management System (WMS).
+The development continues in the EGEE and EGEE-II projects,
+where \LB became an independent part of the gLite middleware~\cite{glite}.
+
+\LB's primary purpose is tracking WMS jobs as they are processed by
+individual Grid components, not counting on the WMS to provide this data.
+The information gathered from individual sources is collected, stored in
+a database and made available at a single contact point. The user get a
+complete view on her job without the need to inspect several service logs
+(which she may not be authorized to see in the entirety or she may not be
+even aware of their existence).
+
+While \LB keeps track of submitted and running jobs, the information is
+kept by the \LB service also after the job has been finished (successfully
+completed its execution, failed, or has been canceled for any reason). The 
+information is usually available several days after the last event
+related to the job arrived, to give user an opportunity to check the job
+final state and eventually evaluate failure reasons.
+
+As \LB collects also information provided by the WMS, the WMS services are
+no longer required to provide job-state querying interface.  Most of the
+WMS services can be even designed as stateless---they process a~job and
+pass it over to another service, not keeping state information about the job
+anymore.  During development and deployment of the first WMS version this
+approach turned to be essential in order to scale the services to the
+required extent~\cite{jgc}. 
+
+\LB must collect information about all important events in the Grid job
+life. These include transitions between components or services, results
+of matching and brokerage, waiting in a queue systems or start and end of
+actual execution.
+We decided to achieve this
+goal through provision of an API (and the associated library) and
+instrumenting individual WMS services and other Grid components with direct
+calls to this API. But as \LB is a centralized service (there exists 
+a single point where all information about a particular job must
+eventually arrive), direct synchronous transfer of data could have
+prohibiting impact on the WMS operation.
+The temporary unavailability or overload of the remote \LB service
+must not prevent (nor block) the instrumented service to perform as usual.
+An asynchronous model with a clear \emph{asynchronous delivery
+semantics}, see Sect.~\ref{gathering}, is used to address this issue.
+
+As individual Grid components has only local and transient view about a
+job, they are able to send only information about individual events. This
+raw, fairly complex information is not 
+a~suitable form to be presented to the user for frequent queries. It must
+be processed at the central service and users are presented primarily this
+processed form. This form derives its form from the \emph{job state} and its
+transition, not from the job events themselves. The raw information is
+still available, in case more detailed insight is necessary.
+
+While the removal of state information from (some of) the WMS services
+helped to achieve the high scalability of the whole WMS, the state
+information is still essential for the decisions made within the resource
+broker or during the matchmaking process. 
+\Eg decision on job resubmission is usually affected by the number of
+previous resubmission attempts. This kind of information is currently
+available in the \LB only, so the next ``natural'' requirement has been
+to provide an interface for WMS (and other) services to the \LB to query
+for the state information. However, this requirement contains two
+contradictions: (i)~due to the asynchronous event delivery model, the \LB
+information may not be up to date and remote queries may lead to unexpected
+results
+(or even inconsistent one---some older information may not be available for 
+one query but may arrive before a subsequent query is issued),
+and (ii)~the dependence on a~remote service to provide vital state information
+may block the local service if the remote one is not responding.
+These problems are addressed by providing \emph{local view} on the \LB data,
+see Sect.~\ref{local}.
+
+
+
+
+\subsection{Concepts}
+
+\subsubsection{Jobs and events}
+To keep track of user jobs on the Grid, we first need some reliable
+way to identify them. This is accomplished by assigning a unique
+identifier, which we call \emph{jobid} (``Grid jobid''), to every job
+before it enters the Grid. A~unique jobid is assigned, making it the
+primary index to unambiguously identify any Grid job. This jobid is then
+passed between Grid
+components together with the job description as the job flows through
+the Grid; the components themselves may have (and usually do) their
+own job  identifiers, which are unique only within these components.
+
+Every Grid component dealing with the job during its lifetime 
+may be a source of information about the job. The \LB gathers information
+from all the 
+relevant components. This information is obtained in the form of
+\LB events, pieces of data generated by Grid components, which mark
+important points in the job lifetime (\eg passing of job control
+between the Grid components are important milestones in job lifetime
+independently on the actual Grid architecture); see Appendix~\ref{a:events}
+for a~complete list. We collect those
+events, store them into a database and simultaneously process them to
+provide higher level view on the job's state.  The \LB collects redundant
+information---the event scheme has been designed to be as redundant as
+possible---and this redundancy is used to improve resiliency in a
+presence of component or network failures, which are omnipresent on any
+Grid. 
+
+The \LB events themselves are structured into \emph{attribute}~=
+\emph{value} pairs, the set of required and optional attributes is defined by the
+event \emph{type} (or scheme). For the purpose of tracking job status on
+the Grid and with the knowledge of WMS Grid middleware structure we
+defined an \LB schema with specific \LB event
+types\footnote{\url{https://edms.cern.ch/document/571273/}}.
+The schema contains a common base, the attributes that must be assigned
+to every single event. The primary key is the jobid, which is also one of
+the required attributes. The other common attributes are currently the
+timestamp of the event origin, generating component name and the event
+sequence code (see Sect.~\ref{evprocess}).
+
+While the necessary and sufficient condition for a global jobid is
+to be Grid-wide unique, additional desired property relates to the
+transport of events through the network: All events belonging to the same
+job must be sent to the same \LB database. This must be done on a~per
+message basis, as each message may be generated by a different component.
+The same problem is encountered
+by users when they look for information about their job---they need
+to know where to find the appropriate \LB database too.
+While it is possible to devise a global service where each job registers
+its jobid together with the address of the appropriate database, such a
+service could easily become a bottleneck. We opted for another solution,
+to keep the address of the \LB database within the jobid. This way,
+finding appropriate \LB database address becomes a local operation
+(at most parsing the jobid) and users can use the same mechanism when
+connecting to the \LB database to retrieve information about a particular
+job (users know its jobid). To simplify the situation even further, 
+the jobid has the form of an URL, where the protocol part is
+``https'', server and port identify the machine running the appropriate 
+\LB server
+(database) and the path contains base64 encoded MD5 hash of random
+number, timestamp, PID of the generating process and IP address of the
+machine, where the jobid was generated. Jobid in this form can be
+used even in the web browser to obtain information about the job,
+provided the \LB database runs a web server interface. This jobid is
+reasonably unique---while in theory two different job identifications can
+have the same MD5 hash, the probability is low enough for this jobid to
+represent a globally unique job identification.
+
+%zajímá nás job, globální id, v¹echna data vzta¾ena k~nìmu, syrové události
+%
+%více zdrojù dat pro jeden job, redundance, shromá¾dìní na jednom místì
+
+\subsubsection{Event gathering}
+\label{gathering}
+%zdroje událostí, lokální semantika logování, store-and-forward
+
+As described in the previous section, information about jobs are
+gathered from all the Grid components processing the job in the form
+of \LB events. The gathering is based on the \emph{push} model where
+the components are actively producing and sending events. The push model
+offers higher performance and scalability than the pull model, where the
+components are to be queried by the server. In the push model, the \LB
+server does not even have to know the event sources, it is sufficient
+to listen for and accept events on defined interface. 
+
+The event delivery to the destination \LB server is asynchronous and
+based on the store--and--forward model to minimize the performance
+impact on component processing. Only the local processing is synchronous,
+the \LB event is sent synchronously only to the nearest \LB component
+responsible for event delivery. This component 
+is at the worst located in the same local area network (LAN) and usually
+it runs on the same host as
+the producing component. The event is stored there (using persistent
+storage -- disk file) and confirmation is sent back to the
+producing component. From the component's point of view, the
+send event operation is fast and reliable, but its success only means
+the event was accepted for later delivery. The \LB delivery components
+then handle the event asynchronously and ensure its delivery to the
+\LB server even in the presence of network failures and host reloads.
+
+It is important to note that this transport system does not guarantee
+ordered delivery of events to the \LB server; it \emph{does} guarantee
+reliable and secure delivery, however. The guarantees are statistical
+only, as the protocol is not resilient to permanent disk or node crashes
+nor to the complete purge of the data from local disk. Being part of the
+trusted infrastructure, even the local \LB components should run on
+a trusted and maintained machine, where additional reliability may be
+obtained \eg by a RAID disk subsystem.
+
+\subsubsection{Event processing}%
+\label{evprocess}
+
+%diagram stavù, mapování událostí na hrany
+
+%uspoøádání událostí -- seq. èísla, vèetnì shallow vìtví
+
+% ! abstraktne, nemame jeste komponenty
+
+% prichazeji udalosti, vice zdroju, zmenene poradi (az ztraty)
+% redundantni informace
+% motivace: usetrit uzivatele, hlasit agregovany stav jobu
+As described in the previous section, \LB gathers raw events from various
+Grid middleware components and aggregates them on a~single server
+on a per-job basis.
+The events contain a very low level detailed information about the job
+processing at individual Grid components. This level of detail is
+valuable for tracking various problems with the job and/or the
+components, and as complementary events are gathered (\eg each job control
+transfer is logged independently by two components), the information is
+highly redundant. Moreover, the events could arrive in wrong order,
+making the interpretation of raw information difficult and not
+straightforward.
+Users, on the other hand, are interested in a much higher view, the
+overall state of their job. 
+
+For these reasons the raw events undergo complex processing, yielding 
+a~high level view, the \emph{job state}, that is the primary type of data
+presented to the user.
+Various job states form nodes of the job state diagram (Fig.~\ref{f:jobstat}).
+See Appendix~\ref{a:jobstat} for a list of the individual states.
+
+% stavovy automat
+% obrazek: stavovy diagram
+
+\begin{figure}
+\centering
+\includegraphics[width=.8\hsize]{images/wms2-jobstat}
+\caption{\LB\ job state diagram}
+\label{f:jobstat}
+\end{figure}
+
+% typ udalosti -> zmeny typu stavu
+\LB\ defines a~\emph{job state machine} that is responsible for updating
+the job state on receiving a~new event.
+The logic of this algorithm is non-trivial; the rest of this section deals
+with its main features.
+
+Transitions between the job states happen on receiving events of particular
+type coming from particular sources.
+There may be more distinct events assigned to a~single edge of the state diagram.
+For instance, the job becomes \emph{Scheduled} when it enters batch system
+queue of a~Grid computing element.
+The fact is witnessed by either \emph{Transfer/OK} event reported by 
+the job submission service or by \emph{Accept} event reported by the computing
+element. Receiving any one of these events (in any order) triggers the
+state change.
+
+% fault tolerance
+This way, the state machine is highly fault-tolerant---it can cope with
+delayed, reordered or even lost events.
+For example, when a~job is in the \emph{Waiting} state and the \emph{Done}
+event arrives, it is not treated as inconsistency but it is assumed that
+the intermediate events are delayed or lost and the job state is switched
+to the \emph{Done} state directly.
+
+% udalosti nesou atributy, promitaji se do stavu 
+The \LB events carry various common and event-type specific attributes,
+\eg \emph{timestamp} (common) or \emph{destination} (\emph{Transfer} type).
+The job state record contains, besides the major state identification,
+similar attributes, \eg
+an array of timestamps indicating when the job entered each state,
+or \emph{location}---identification of the Grid component which is currently
+handling the job.
+Updating the job state attributes is also the task of the state machine,
+employing the above mentioned fault tolerance---despite a~delayed event
+cannot switch
+the major job state back
+it still may carry valuable information to update the job state attributes.
+
+\subsubsection{Event ordering}%
+\label{evorder}
+
+As described above, the ability to correctly order arriving events is
+essential for the job state computation.
+As long as the job state diagram was acyclic (which was true for the
+initial WMS release), each event had its unique place in the expected sequence
+hence event ordering could always be done implicitly from the
+context.
+However, this approach is not applicable once job resubmission
+yielding cycles in the job state diagram was introduced.
+
+Event ordering that would rely on timestamps assigned to events upon
+their generation, assuming strict clock synchronization over the Grid,
+turned to be a~naive approach.
+Clocks on real machines are not precisely synchronized and there are no reliable
+ways to enforce synchronization across administrative domains.
+
+To demonstrate a problem with desynchronized clocks, that may lead to
+wrong event interpretation, let us consider a~simplified example
+in Tab.~\ref{t:cefail}.
+%
+\iffalse %stare
+% usporadani udalosti -- seq. cisla
+% priklad problemu
+So far we assumed that the state machine is able to detect a~delayed event.
+As the state diagram contains cycles, delay cannot be detected from the type
+of the event only.
+The simplest approach is relying on the event timestamps.
+However, in the Grid environment one cannot assume strictly synchronized clocks.
+Table~\ref{t:cefail} shows a~simplified example of the problem caused by delayed
+clocks. 
+\fi
+%
+We assume that the workload manager (WM) sends the job to a~computing element
+(CE)~A, where it starts running but the job dies in the middle.
+The failure is detected and the job is resubmitted back to the WM which sends it to CE~B then.
+However, if A's clock is ahead in time and B's clock is correct (which
+means behind the A's clock), the events in the right column are treated
+as delayed. The state machine will interpret events incorrectly, assuming
+the job has been run on B before sending it to A.
+The job would always (assuming the A's events arrive before B's events to
+the \LB) be reported as ``\emph{Running} at A'' despite
+the real state should follow the \emph{Waiting} \dots \emph{Running} sequence.
+Even the \emph{Done} event can be sent by B with a timestamp that says
+this happened before the job has been submitted to A and the job state
+will end with a discrepancy---it has been reported to finish on B while
+still reported to run on A.
+
+\begin{table}[hb]
+\begin{tabular}{rlrl}
+1.&WM: Accept&
+6.&WM: Accept\\
+2.&WM: Match $A$&
+7.&WM: Match $B$\\
+3.&WM: Transfer to $A$&
+8.&WM: Transfer to $B$\\
+4.&CE~$A$: Accept &
+9.&CE~$B$: Accept \\
+5.&CE~$A$: Run &
+10.&CE~$B$: Run \\
+\dots & $A$ dies\\
+\end{tabular}
+\caption{Simplified \LB events in the CE failure scenario}
+\label{t:cefail}
+\end{table}
+
+Therefore we are looking for a~more robust and general solution. We can
+discover severe clock bias if the timestamp on an event is in a future
+with respect to the time on an \LB server, but this is generally a dangerous
+approach (the \LB server clock could be severely behind the real time).
+We decided not to rely on absolute time as reported by timestamps, but to
+introduce a kind of \emph{logical time} that is associated with the logic
+of event generation.
+The principal idea is arranging the pass through the job state 
+diagram (corresponding to a~particular job life), that may include
+loops, into an execution tree that represents the job history.
+Closing a~loop in the pass through the state diagram corresponds
+to forking a~branch in the execution tree.
+The scenario in Tab.~\ref{t:cefail} is mapped to the tree in
+Fig.~\ref{f:seqtree}.
+The approach is quite general---any finite pass through any state
+diagram (finite directed graph) can be encoded in this way.
+
+\begin{figure}
+\centering
+\includegraphics[scale=.833]{images/seqtree}
+\caption{Job state sequence in the CE failure scenario, arranged into a~tree.
+Solid lines form the tree, arrows show state transitions.}
+\label{f:seqtree}
+\end{figure}
+
+Our goal is augmenting \LB events with sufficient information that
+\begin{itemize}
+ \item identifies uniquely a~branch on the execution tree, 
+ \item determines the sequence of events on the branch, 
+ \item orders the branches themselves, which means that it determines
+   which one is more recent.  
+\end{itemize}
+If such information is available, the execution tree can be
+reconstructed on the fly as the events arrive, and even delayed events
+are sorted into the tree correctly.  An incoming event is considered
+for job state computation only if it belongs to the most recent
+branch.
+
+The situation becomes even more complicated when 
+the \emph{shallow resubmission} WM advanced feature is enabled.
+In this mode WM may resubmit the job before being sure the previous attempt
+is really unsuccessful, potentially creating multiple parallel instances
+of the job.
+The situation maps to several branches of the execution tree that
+evolve really in parallel.
+However, only one of the job instances becomes active (really running) finally;
+the others are aborted.
+Because the choice of active instance is done later, 
+it may not correspond to the most recent execution branch.
+Therefore, when an event indicating the choice of active instance arrives,
+the job state must be recomputed, using the corresponding active branch
+instead the most recent one.
+
+Section~\ref{seqcode} describes the current implementation of event
+ordering mechanism based on ideas presented here.
+
+\subsubsection{Queries and notifications}\label{retrieve}
+
+According to the GMA classification the user retrieves data from
+the infrastructure in two modes, called
+\emph{queries} and \emph{notifications} in~\LB.
+
+Querying \LB is fairly straightforward---the user specifies query
+conditions, connects to the querying infrastructure endpoint, and
+receives the results. 
+For ``single job'' queries, where jobid is known, the endpoint (the
+appropriate \LB server) is inhered from the jobid.
+More general queries must specify the \LB server explicitely,
+and their semantics is intentionally restricted 
+to ``all such jobs known here''.
+We trade off generality for performance and reliability,
+leaving the problem of finding the right query endpoint(s), the right
+\LB servers, to higher level information and service-discovery services.
+
+If the user is interested in one or more jobs, frequent polling of the
+\LB server may be cumbersome for the user and creates unnecessary overload
+on the sever. A notification subscription is therefore available,
+allowing users to subscribe to receive notification whenever a~job 
+starts matching user specified conditions.
+Every subscription contains also the location of the user's
+listener; 
+successful subscription returns time-limited \emph{notification handle}.
+During the validity period of the subscription, the \LB infrastructure
+is responsible for queuing and reliable delivery of the notifications.
+The user may even re-subscribe (providing the original handle) with different
+listener location (\eg moving from office to home), and \LB re-routes
+the notifications generated in the meantime to the new destination.
+The \LB event delivery infrastructure is reused for the notification
+transport.
+
+\subsubsection{Local views}\label{local}
+% motivace proxy
+
+%As outlined in Sect.~\ref{reqs} 
+WMS components are, besides logging
+information into \LB, interested in querying this information back in order
+to avoid the need of keeping per-job state information.
+However, despite the required information is present in \LB,
+the standard mode of \LB operation is not suitable for this purpose due
+to the following reasons:
+\begin{itemize}
+\item Query interface is provided on the \LB component which gathers
+events belonging to the same job but coming from different sources. 
+Typically, this is a~remote service with respect to the event sources (WMS components).
+Therefore the query operation is sensitive to any network failure that may
+occur, blocking the operation of the querying service for indefinite time.
+\item Due to the asynchronous logging semantics, there is a~non-zero time
+window between successful completion of the logging call and the point in
+time when the logged event starts affecting the query result.
+This semantics may yield unexpected, seemingly inconsistent outcome. 
+\end{itemize}
+
+The problem can be overcome by introducing \emph{local view} on job data.
+Besides forwarding events to
+the server where events belonging to a~job are gathered from multiple sources,
+\LB infrastructure can store the logged events temporarily
+on the event source, and perform the processing described
+in Sect.~\ref{evprocess}.
+In this setup, the logging vs.\ query semantics can be synchronous---it is
+guaranteed that a~successfully logged event is reflected in the result of
+an immediately following query,
+because no network operations are involved.
+Only events coming from this particular physical node (but potentially
+from all services running there) are considered, thus the locality of the view. 
+On the other hand, certain \LB events are designed to contain redundant
+information, therefore the local view on processed data (job state) 
+becomes virtually complete on a~reasonably rich \LB data source like
+the Resource Broker node.
+
+
+\subsection{Current \LB implementation}
+The principal components of the \LB service and their interactions
+are shown in Figures~\ref{f:comp-gather} (gathering and transferring
+\LB events) and~\ref{f:comp-query} (\LB query and notification services).
+
+\begin{figure}
+\centering
+\includegraphics[scale=.5]{images/LB-components-gather}
+\caption{\LB components involved in gathering and transferring the events}
+\label{f:comp-gather}
+\end{figure}
+
+\subsubsection{\LB API and library}
+Both logging events and querying the service are implemented via
+calls to a~public \LB API.
+The complete API (both logging and queries)
+is available in ANSI~C binding, most of the querying capabilities also in C++.
+These APIs are provided as sets of C/C++ header files and shared libraries.
+The library implements communication protocol with other \LB components
+(logger and server), including encryption, authentication etc.
+
+We do not describe the API here in detail; it is documented in~\LB User's
+Guide\footnote{\url{https://edms.cern.ch/file/571273/1/LB-guide.pdf}},
+including complete reference and both simple and complex usage examples.
+
+Events can be also logged with a~standalone program (using the C~API in turn),
+intended for usage in scripts.
+
+The query interface is also available as a~web-service provided by the
+\LB server (Sect.~\ref{server}).
+
+\subsubsection{Logger}
+The task of the \emph{logger} component is taking over the events from
+the logging library, storing them reliably, and forwarding to the destination
+server.
+The component should be deployed very close to each source of events---on the
+same machine ideally, or, in the case of computing elements with many
+worker nodes, on the head node of the cluster%
+\footnote{In this setup logger also serves as an application proxy,
+overcoming networking issues like private address space of the worker nodes,
+blocked outbound connectivity etc.}.
+
+Technically the functionality is realized with two daemons:
+\begin{itemize}
+\item \emph{Local-logger} accepts incoming events,
+appends them in a~plain disk file (one file per Grid job),
+and forwards to inter-logger.
+It is kept as simple as possible in order to achieve
+maximal reliability. 
+\item \emph{Inter-logger} accepts the events from the local-logger,
+implements the event routing (currently trivial as the destination
+address is a~part of the jobid), and manages
+delivery queues (one per destination server).
+It is also responsible for crash recovery---on startup, the queues are
+populated with undelivered events read from the local-logger files.
+Finally, the inter-logger purges the files when the events are delivered to
+their final destination.
+\end{itemize}
+
+\subsubsection{Server}
+\label{server}
+\emph{\LB server} is the destination component where the events are delivered,
+stored and processed to be made available for user queries.
+The server storage backend is implemented using MySQL database.
+
+Incoming events are parsed, checked for correctness, authorized (only the job
+owner can store events belonging to a~particular job), and stored into the
+database.
+In addition, the current state of the job is retrieved from the database,
+the event is fed
+into the state machine (Sect.~\ref{evprocess}), and the job state updated
+accordingly.
+
+On the other hand, the server exposes querying interface (Fig.~\ref{f:comp-query}, Sect.~\ref{retrieve}).
+The incoming user queries are transformed into SQL queries on the underlying
+database engine.
+The query result is filtered, authorization rules applied, and the result
+sent back to the user.
+
+While using the SQL database, its full query power is not made available
+to end users. 
+In order to avoid either intentional or unintentional denial-of-service
+attacks, the queries are restricted in such a~way that the transformed SQL
+query must hit a~highly selective index on the database.
+Otherwise the query is refused, as full database scan would yield unacceptable
+load.
+The set of indices is configurable, and it may involve both \LB system
+attributes (\eg job owner, computing element,
+timestamps of entering particular state,~\dots) and user defined ones.
+
+The server also maintains the active notification handles
+(Sect.~\ref{retrieve}), providing the subscription interface to the user.
+Whenever an event arrives and the updated job state is computed,
+it is matched against the active handles%
+\footnote{The current implementation enforces specifying an~actual jobid
+in the subscription hence the matching has minimal performance impact.}.
+Each match generates a~notification message, an extended \LB event
+containing the job state data, notification handle,
+and the current user's listener location.
+The event is passed to the \emph{notification inter-logger} 
+via persistent disk file and directly (see Fig.~\ref{f:comp-query}).
+The daemon delivers events in the standard way, using the specified
+listener as destination.
+In addition, the server generates control messages when the user re-subscribes,
+changing the listener location.
+Inter-logger recognizes these messages, and changes its routing of all
+pending events belonging to this handle accordingly.
+
+
+% asi nepotrebujeme \subsubsection{Clients}
+
+\subsubsection{Proxy}
+\emph{\LB proxy} is the implementation of the local view concept
+(Sect.~\ref{local}).
+When deployed (on the Resource Broker node in the current gLite middleware) 
+it takes over the role of the local-logger daemon---it accepts the incoming
+events, stores them in files, and forwards them to the inter-logger.
+
+In addition, the proxy provides the basic principal functionality of \LB server,
+\ie processing events into job state and providing a~query interface,
+with the following differences:
+\begin{itemize}
+\item only events coming from sources on this node are considered; hence
+the job state may be incomplete,
+\item proxy is accessed through local UNIX-domain socket instead of network
+interface,
+\item no authorization checks are performed---proxy is intended for
+privileged access only (enforced by the file permissions on the socket),
+\item aggressive purge strategy is applied---whenever a~job reaches
+a~known terminal state (which means that no further events are expected), it is purged
+from the local database immediately,
+\item no index checks are applied---we both trust the privileged parties
+and do not expect the database to grow due to the purge strategy.
+\end{itemize}
+
+\subsubsection{Sequence codes for event ordering}%
+\label{seqcode}
+
+As discussed in Sect.~\ref{evorder}, sequence codes are used as logical
+timestamps to ensure proper event ordering on the \LB server. The
+sequence code counter is incremented whenever an event is logged and the
+sequence code must be passed between individual Grid components together
+with the job control.
+However, a single valued counter is not sufficient to support detection of
+branch forks within the execution tree.
+When considering again the Computing Element failure scenario described
+in Sect.~\ref{evorder}, there is no way to know that the counter value of
+the last event logged by the failed CE A is 5 (Tab.~\ref{t:cefail}). 
+
+\begin{table}[b]
+\begin{tabular}{rlrl}
+1:x&WM: Accept&
+4:x&WM: Accept\\
+2:x&WM: Match $A$&
+5:x&WM: Match $B$\\
+3:x&WM: Transfer to $A$&
+6:x&WM: Transfer to $B$\\
+3:1&CE~$A$: Accept &
+6:1&CE~$B$: Accept \\
+3:2&CE~$A$: Run &
+6:2&CE~$B$: Run \\
+\dots & $A$ dies\\
+\end{tabular}
+\caption{The same CE failure scenario: hierarchical sequence codes.
+``x'' denotes an undefined and unused value.}
+\label{t:cefail2}
+\end{table}
+
+
+Therefore we define a~hierarchical \emph{sequence code}---an array of
+counters, each corresponding to a~single Grid component class handling the job%
+\footnote{Currently the following gLite components: Network Server, Workload
+Manager, Job Controller, Log Monitor, Job Wrapper, and the application itself.}.
+Table~\ref{t:cefail2} shows the same scenario with a~simplified two-counter
+sequence code. The counters correspond to the WM and CE component classes
+and they are incremented when each of the components logs an event.
+When WM receives the job back for resubmission, 
+the CE counter becomes irrelevant (as the job control is on WM now),
+and the WM counter is incremented again.
+
+%Events on a~branch are ordered following the lexicographical order
+%of the sequence codes.
+%Branches are identified according to the WM counter as WM is 
+%currently the only component where branching can occur.
+
+The state machine keeps the current (highest seen) code for the job, 
+being able to detect a~delayed event by simple lexicographic comparison
+of the sequence codes.
+Delayed events are not used for major state computation, then.
+Using another two assumptions (that are true for the current
+implementation):
+\begin{itemize}
+ \item events coming from a~single component arrive in order,
+ \item the only branching point is WM,
+\end{itemize}
+it is safe to qualify events with lower WM counter (than the already
+received one) to belong to inactive
+branches, hence ignore them even for update of job state attributes.
+
+\subsection{User interaction}
+\begin{figure}
+\centering
+\includegraphics[scale=.5]{images/LB-components-query}
+\caption{\LB queries and notifications}
+\label{f:comp-query}
+\end{figure}
+
+So far we focused on the \LB internals and the interaction between its
+components.
+In this section we describe the interaction of users with the service.
+
+\subsubsection{Event submission}
+%implicitní -- registrace jobu, systémové události na middlewarových komponentách
+The event submission is mostly implicit,
+\ie it is done transparently by the Grid middleware components
+on behalf of the user.
+Typically, whenever an important point in the job life is reached,
+the involved middleware component logs an appropriate \LB event.
+This process is not directly visible to the user.
+
+A specific case is the initial registration of the job.
+This must be done synchronously, as otherwise subsequent events logged for
+the same job may be refused with a ``no such job'' error report. 
+Therefore submission of a job to the WMS is the only synchronous event
+logging that does not return until the job is successfully registered with
+the \LB server.
+
+% explicitní -- user tagy, ACL
+However, the user may also store information into the \LB explicitly
+by logging user events---\emph{tags} (or annotations) of the
+form ``name = value''.
+Authorization information is also manipulated in this way, see
+\LB User's Guide for details.
+
+
+\subsubsection{Retrieving information}
+From the user point of view, the information retrieval is the most
+important interaction with the \LB service.
+
+%dotazy na stav
+The typical \LB usage are queries on the high-level job state information.
+\LB supports not only single job queries, it is also possible to
+retrieve information about jobs matching a specific condition.
+The conditions may refer to both the \LB system attributes
+and the user annotations. Rather complex query semantics can be
+supported, \eg 
+\emph{Which of my jobs annotated as ``apple'' or ``pear'' are already
+scheduled for execution and are heading to the ``garden'' computing element?}
+The \LB User's
+Guide\footnote{\url{https://edms.cern.ch/file/571273/1/LB-guide.pdf}} provides a~series of similar examples of
+complex queries.
+
+%dotazy na události
+As another option, the user may retrieve raw \LB events.
+Such queries are mostly used for debugging, identification of repeating
+problems, and similar purposes.
+The query construction refers to event attributes rather
+than job state.
+
+The query language supports common comparison operators, and it allows
+two-level nesting of conditions (logically \emph{and}-ed and \emph{or}-ed).
+Our experience shows that it is sufficiently strong to cover most user
+requirements while being simple enough to keep the query cost reasonable.
+Complete reference of the query language can be found in~\LB User's Guide.
+
+\ludek{%notifikace
+The other mode of user interactions are the \LB notifications
+(Sect.~\ref{retrieve}).}
+
+\subsubsection{Caveats}
+\LB is designed to perform well in the unreliable distributed Grid
+environment.
+An unwelcome but inevitable consequence of this design 
+are certain contra-intuitive features in the system behavior,
+namely:
+\begin{itemize}
+\item 
+Asynchronous, possibly delayed event delivery may yield seemingly
+inconsistent view on the job state \wrt\ information that is available
+to the user via different channels.
+\Eg the user may know that her job terminated because of monitoring the
+application progress directly, but the \LB \emph{Done} events indicating
+job termination are delayed so that \LB reports the job to be still
+in the \emph{Running} state.
+
+\item 
+% sekvenèní èísla -- ¹patnì øazené události jsou ignorovány pro výpoèet stavu
+Due to the reasons described in Sect.~\ref{evorder} \LB is rather sensitive
+to event ordering based on sequence codes.
+The situation becomes particularly complicated when there are multiple
+branches of job execution.
+Consequently the user may see an \LB event that is easily interpreted that
+it should switch the job state, however, it has no effect in fact
+because of being (correctly) sorted to an already inactive branch.
+
+\item 
+% purge -- data z~\LB\ zmizí
+\LB is not a~permanent job data storage. The data get purged from the
+server on timeout, unrelated to any user's action.
+Therefore, the \LB query may return ``no such job'' error message (or not
+include the job in a list of retrieved jobs) even if the same previous
+\LB query had no such problems.
+
+\end{itemize}
+
+\subsection{Security issues}
+The events passed between the \LB components as well as the results of
+their processing provide detailed information about the corresponding job and
+its life. Being used by the users to check status of their jobs and also by
+other Grid components to control the job, the information on jobs has to be
+reliable and reflect the real jobs' utilization of the Grid. Also, some user
+communities (\eg biomedicine researchers) often process sensitive data and
+require the information about their processing is kept private so that only the
+job owner can access not only the result of the computation but also all
+information about the job run. Last but not least, according to legislation of
+some countries the information on users' jobs can be treated as the user
+private data, which requires an increased level of protection.  \LB therefore
+must pay special attention to security aspects and access control to the data.
+
+All \LB components communicate solely over authenticated channels. The TLS
+protocol~\cite{tls} is used as the authentication mechanism and each of the
+\LB uses an X.509 public key certificate to establish a mutually
+authenticated connection. The users usually use their proxy
+certificates~\cite{proxycert} when accessing the \LB server and retrieving
+information about jobs.
+\ludek{Proxy certificates were introduced by the Grid Security
+Infrastructure\~cite{gsi} from the Globus project and extend the concepts of
+standard public key certificates and identity providers and allows a user to
+issue a certificate for herself. Such a proxy certificate is used as a means
+for Single Sign-On and rights delegation~\cite{delegation}.}
+The proxy
+certificate can also contain other information necessary to create a secure
+connection, \eg information used for authorization. The \LB security layer is
+implemented using the the Generic Security Service API~\cite{gssapi}, which
+makes it easier to port the application to an environment using mechanism other
+than PKI (\eg Kerberos).
+
+Apart from providing an authentication mechanism, the TLS protocol also allows
+the communicating parties to exchange an encryption key that is used to encrypt
+all subsequent communication. The \LB components encrypt all network
+communication to keep the messages private. Therefore, together with the access control
+rules implemented by the \LB server, the infrastructure provides very high
+level of privacy protection.
+
+By default, access to a job information is only allowed to the user who
+submitted the job (the job owner). The job owner can also assign an access
+control list to her job in the \LB specifying other users who are allowed
+to read the
+data from \LB. The ACLs are represented in the GridSite GACL
+format~\cite{gacl1,gacl2}, which is a simplified version of common Extensible
+Access Control Markup Language (XACML)~\cite{xacml}. The ACLs are stored in
+the \LB database along with the job information and are checked at each access to
+the data. The GridSite XML policy engine is used for policy evaluation. The
+ACLs are under control of the job owner, who can add and remove entries in the
+ACL arbitrarily using the \LB API or command-line tools. Each entry of an ACL
+can specify either a user subject name or a name of a VOMS group. The
+VOMS~\cite{voms2} is a VO attribute provider service, which is maintained
+by the EGEE project. It allows to assign a user with groups and roles
+membership and issues to the users attribute certificates containing
+information about their current attributes. These attribute certificate are
+embedded in the user proxy certificate and checked by the \LB server at each
+user request handling.
+
+%Only the Read semantics is implemented so far, for the
+%future we consider more complex access control, \eg implementing the access
+%control for Write operations (per event) so that particular events could be
+%only logged by allowed components.  That would allow to generate more
+%trusted results since currently each components can log arbitrary events.
+%Malicious component can make the \LB server produce inappropriate results.
+
+Besides of using the ACLs, the \LB administrator can also specify a~set of
+privileged users with access to all job records on a particular \LB
+server. These privileged users can \eg
+collect information on usage and produce a monitoring data based on the \LB
+information.
+
+%Data trustworthiness - the events aren't signed, no real non-reputability or
+%traceability of the event sources.
+
+Since the hostname of the \LB server is part of the job identification, it is
+easy for the user to check that the correct \LB server was contacted and no
+server spoofing took place and thus the data received from the server can be
+trusted. The \LB server on the other hand has no means of checking that the
+logged events originated from an authorized component. Everyone on the Grid
+possessing a valid certificate from a~trusted CA can send an event to the \LB and
+let it store and process the event and possibly change the status of the
+corresponding job. This way a malicious user or service can confuse the \LB
+server by a forged events.  This behavior is not  a critical issue in the current
+model and the way in which \LB is used, however, we are designing a solution
+addressing this weakness. We plan to use the VOMS attributes issued to a
+selected components.  These VOMS attributes must be presented when critical
+events are logged to the \LB server.
+
+\ludek{\subsection{Performance and scalability}
+The \LB service was designed with performance and
+scalability issues in mind. We have developed a series of tests of the
+individual \LB components to measure the actual behavior under
+stress conditions. These tests give us a good performance estimate of
+the \LB service and help us identify and remove possible bottlenecks.
+
+The testing itself is done by feeding the \LB components with events
+prepared beforehand, using whatever protocol appropriate for the given
+component. The feeding program uses a set of predefined events of a
+typical job which we have chosen from the production \LB server
+database. Timestamp is taken before the first event is sent, then the
+feeding program begins sending events of individual jobs (the jobs are
+all the same, the only difference is the jobid; the number of jobs used is
+configurable). The tested component is instrumented in the source code
+to break normal event processing at selected points (\eg discard
+events immediately after being read to measure the input channel
+performance, or discard events instead of sending them to the next
+component, etc.). This segmentation of event processing enables to
+identify places in the code which may slow down the event transfer. 
+Optionally the events may be discarded by the next component in the
+logical path. The last event of the last job is special termination
+event, which is recognized when being discarded; then the second
+timestamp is taken and the difference between the two gives us total
+time necessary to pass given number of jobs through. 
+
+Note that due to the asynchronous nature of the \LB service measuring for
+example the time it takes to send given number of jobs does not give
+us the required result, thus event (or job) throughput---when the
+producer receives acknowledgment about successful send operation, it
+is not guaranteed that the event passed through the component. 
+
+The results shown in table~\ref{perf:results} give the overall
+throughput components (events are discarded by the next component
+on the path), with the exception of proxy, where the throughput to the
+database is measured. It can be seen that the majority of code is fast
+enough to handle even high event rates and that most components are up
+to our goal to handle one million of jobs per day.  The first line
+indicates how fast we are able to ``generate'' events in the feeding
+program. 
+
+\begin{table}[hbt]
+\begin{tabular}{l|r}
+{\bf Component} & {\bf Job throughput (jobs/day)} \\
+\hline
+Test producer & 153,600,000 \\
+Locallogger & 101,700 \\
+Interlogger & 5,335,100 \\
+Proxy & 1,267,110 \\
+\end{tabular}
+\caption{Performance testing results}
+\label{perf:results}
+\end{table}
+
+During the performance testing we have identified two possible
+bottlenecks:
+\begin{itemize}
+\item Opening connections and establishing SSL sessions is very
+expensive operation. It hinders mainly the performance of locallogger,
+because the current implementation uses one SSL session for
+event.
+\item Database operations. Storing events into database is expensive,
+but inevitable; however we were able to optimize for example the
+code checking for duplicated events.
+\end{itemize}
+
+In the current work we are addressing the issue of SSL operations by
+introducing concept of SSL connection pools, which enables components
+to reuse existing connections transparently without need to tear-down
+and setup new SSL contexts. }
+
+\subsection{Advanced use}
+
+The usability of the \LB service is not limited to the simple tasks
+described earlier. It can be easily extended to support real-time job
+monitoring (not only the notifications) and the aggregate information
+collected in the \LB servers is a valuable source of data used for post-mortem
+statistical analysis of jobs and also the Grid infrastructure behavior.
+Moreover, \LB data can be used to improve scheduling decisions.
+
+\subsubsection{\LB and real time monitoring}
+The \LB server is extended to provide quickly and without any substantial
+load on the database engine the following data:
+\begin{enumerate}
+\item number of jobs in the system grouped by internal status
+(\emph{Submitted}, \emph{Running}, \emph{Done},~\ldots),
+\item number of jobs that reached final state in the last
+hour,
+\item associated statistics like average, maximum, and minimum time spent
+by jobs in the system,
+\item number of jobs that entered the WMS system in the last hour.
+\end{enumerate}
+\LB server can be regularly queried to provide this data to give an
+overview about both jobs running on the Grid and also the behavior of the
+Grid infrastructure as seen from the job (or end user) perspective.
+Thus \LB\ becomes a~data source for various real-tim Grid monitoring tools.
+
+\subsubsection{R-GMA feed}
+The \LB server also supports streaming the most important data---the job
+state changes---to another monitoring system. It works as the
+notification service, sending information about job state changes to
+a~specific listener that is the interface to a monitoring interface.
+As a~particular example of such a generic service, the R-GMA feed component
+has been developed. It supports sending job state changes to
+the R-GMA infrastructure that is part of the Grid monitoring
+infrastructure used in the EGEE Grid.
+
+Currently, only basic information about job state changes is provided
+this way, taking into account the security limitation of the R-GMA. 
+
+\subsubsection{\LB Job Statistics}
+Data collected within the \LB servers are regularly purged, complicating
+thus any long term post-mortem statistical analysis. Without a Job
+Provenance, the data from the \LB must be copied in a controlled way and
+made available in an environment where even non-indexed queries can be
+asked. 
+
+Using the \LB Job Statistics tools, one dump file per job is created 
+when the job reaches a~terminal state. These dump files can be
+further processed to provide and XML encoded Job History Record%
+\footnote{\url{http://egee.cesnet.cz/en/Schema/LB/JobRecord}} that
+contains all the relevant information from the job life. The Job History
+Records are fed into a statistical tools to reveal interesting information
+about the job behavior within the Grid.
+
+This functionality is being replaced by the direct download of all the
+relevant data from the Job Provenance.
+
+\subsubsection{Computing Element reputability rank}
+Production operation of the EGEE middleware showed
+that misbehaving computing elements may have significant impact on
+the overall Grid performance.
+The most serious problem is the ``black hole'' effect---a~CE that
+accepts jobs at a~high rate but they all fail there.
+Such CE usually appears to be free in Grid information services
+so the resource brokers keep to assign further jobs to it.
+
+\LB data contain sufficient information to identify similar problems.
+By processing the incoming data the information
+was made available as on-line auxiliary statistics like
+rate of incoming jobs per CE, rate of job failure, average duration of job etc.
+The implementation is lightweight, allowing very high query rate.
+On the RB the statistics are available as ClassAd
+functions, allowing the user to specify that similarly misbehaving
+CE's should be penalized or completely avoided
+when RB decides where jobs get submitted.
+
+
diff --git a/org.glite.lb.doc/src/LBUG-QuickStartGuide.tex b/org.glite.lb.doc/src/LBUG-QuickStartGuide.tex
deleted file mode 100644 (file)
index 59251b3..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-\section{Quickstart Guide}
-% The quickstart guide should explain in simple terms and with examples
-% how a user is supposed to achieve the most common usecases. E.g. how
-% to submit and cancel a job, how to receive a job's output. How to
-% create a grid file, move it around, locate it, and delete it. How to
-% monitor the progress on an application etc.
-
-\subsection{Command-Line Tools}
-This section describes usage of event-logging \LB\ command in the two
-cases which are ment for the end-user: adding a~user description (tag)
-to a~job, and changing a~job access control list.
-
-\subsubsection{Logging a UserTag event}
-\label{log_usertag}
-\input{log_usertag}
-
-\subsubsection{Changing Job Access Control List}
-\label{change_acl}
-\input{change_acl}
-
-
-%% \subsection{\LB Producer API}
-%% \todo{honik}
-%% This API is not public at the moment, it may change later.
-%% \input{producer_api}
-
-
-\subsection{\LB\ Querying API}
-%\todo{valtri}
-\input{consumer_api}
-
-
-\subsection{\LB\ Notification API}
-\input{notification_api}
-
-
-\endinput
diff --git a/org.glite.lb.doc/src/LBUG-Security.tex b/org.glite.lb.doc/src/LBUG-Security.tex
deleted file mode 100644 (file)
index 87f19bf..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-\subsection{Security and Access Control}
-
-The \LB\ infrastructure ensures high level of security for information it
-processes. All the \LB\ components communicate solely over authenticated
-connections and users who query the \LB\ server also must authenticate properly
-using their PKI certificates. All messages sent over the network are encrypted
-and their content is not accessible to unauthorized people.
-
-By default, information about a job stored in the \LB\ server is only available
-to the user who submitted the job, i.e. the job owner.  Besides this default
-functionality, the \LB\ server also allows the job owner to share job
-information with another users. Each job can be assigned an access control list
-(ACL) that specifies another users who are also allowed to access the job
-information. The management of ACL's is entirely under control of the job owner
-so she can modify the ACL arbitrarily, specifying the set of users who have
-access to the job information. The users in the ACL's can be specified using
-either the subject names from their X.509 certificates or names of VOMS groups.
-
-Current ACL for a job is returned as part of the job status information
-returned by the \verb'glite-job-status' command. The commands output ACL's in
-the original XML format as specified by GACL/GridSite. 
-
-Example of an ACL:
-\begin{verbatim}
-<?xml version="1.0"?><gacl version="0.0.1">
-   <entry>
-      <voms-cred><vo>VOCE</vo><group>/VOCE</group></voms-cred>
-      <allow><read/></allow>
-   </entry>
-   <entry>
-      <person><dn>/O=CESNET/O=Masaryk University/CN=Daniel Kouril</dn></person>
-      <deny><read/></deny>
-   </entry>
-</gacl>
-\end{verbatim}
-
-This ACL allows access to all people in the VOMS group /VOCE in virtual
-organization VOCE, but denies access to user Daniel Kouril (even if he was a
-member of the /VOCE group).
-
-The job owner herself is not specified in the ACL as she is always allowed to
-access the information regardless the content of the job ACL.
-
-An ACL for a job can be changed using the \verb'glite-lb-logevent' command-line
-program, see section~\ref{change_acl}.
-
-%provided in the example subdirectory. In order to use change\_acl, the \LB\
-%daemons locallogger and interlogger must be running. The usage of the command
-%is as follows:
-%
-%\LB\ server configuration
-%In order to support the VOMS groups in the ACL's,
-%glite_lb_bkserverd must be able to verify client's VOMS proxy certificate using
-%a trusted VOMS service certificate stored on a local disk. Default directory
-%with trusted VOMS certificates is /etc/grid-security/vomsdir, another location
-%can be specified using by either the -V option to glite_lb_bkserverd or setting
-%the VOMS_CERT_DIR environment variable.
-
-\endinput
diff --git a/org.glite.lb.doc/src/LBUG-Tools.tex b/org.glite.lb.doc/src/LBUG-Tools.tex
new file mode 100644 (file)
index 0000000..53dc8ca
--- /dev/null
@@ -0,0 +1,3 @@
+\section{Tools description}
+
+\input{logevent}
diff --git a/org.glite.lb.doc/src/LBUG-UseCases.tex b/org.glite.lb.doc/src/LBUG-UseCases.tex
new file mode 100644 (file)
index 0000000..6926c08
--- /dev/null
@@ -0,0 +1,9 @@
+\section{Use Cases}
+
+This section describes usage of event-logging \LB\ command in the two
+cases which are ment for the end-user: adding a~user description (tag)
+to a~job, and changing a~job access control list.
+
+\input{log_usertag}
+\input{change_acl}
+
index 3f80078..2468a6e 100644 (file)
@@ -1,5 +1,4 @@
 \documentclass{egee}
-%\usepackage{doxygen}
 
 \input{definitions}
 
 \Dissemination{PUBLIC}
 \DocumentLink{http://...}
 
-\Abstract{
-This user's guide explains how to use the Logging and Bookkeeping (\LB) service. 
-The service architecture is described briefly. 
-Examples on using \LB\ event logging command to log a~user tag and change job ACL are given,
-as well as \LB\ query and notification API use cases.
-% The reference section contains complete description of both the logging command and the API's.
-}
+\Abstract{This user's guide explains how to use the Logging and Bookkeeping
+(\LB) service from the user's point of view. The service architecture is
+described thoroughly. Examples on using \LB\ event logging command to log
+a~user tag and change job ACL are given, as well as \LB\ query and notification
+use cases. }
 
 \begin{document}
 
 \input{frontmatter}
-\newpage
 \tableofcontents
 
 \newpage
 \input{LBUG-Introduction}
-\input{LBUG-Architecture}
-\input{LBUG-Security}
-\input{LBUG-Interaction}
 
 \newpage
-\input{LBUG-QuickStartGuide}
+\input{LBUG-Tools}
 
 \newpage
-\input{LBUG-ReferenceGuide}
+\input{LBUG-UseCases}
 
+\appendix
 \newpage
-\input{LBUG-Caveats}
+\input{LBUG-Appendix}
 
+\newpage
 \bibliographystyle{unsrt}
 \bibliography{lbjp}
 
 \end{document}
+
index fec34e2..0543347 100644 (file)
@@ -1,6 +1,9 @@
+\subsection{Changing Job Access Control List}
+\label{change_acl}
+
 In order to change ACL for a job a special event \verb+ChangeACL+ is used. This
 event can be logged by the job owner using the glite-lb-logevent command (see also
-Sect.~\ref{cmdln_interface}). General template for changing the ACL is as follows:
+Sect.~\ref{glite-lb-logevent}). General template for changing the ACL is as follows:
 \begin{verbatim}
 glite-lb-logevent -e ChangeACL -s UserInterface -p     --permission 1          \
         -j <job_id>                                                     \
index a779acc..4a760ba 100644 (file)
@@ -1,3 +1,5 @@
+\section{\LB\ Querying API}
+
 \def\partitle#1{\par{\textbf{#1}}\par}
 
 \label{ConsOview}
@@ -14,7 +16,7 @@ capabilities.
 In the presented examples only the C \LB\ API (Sect.~\ref{query-C}) is considered.
 The C++ API (Sect.~\ref{query-CPP})  covers the same functionality.
 
-\subsubsection{Returned results}
+\subsection{Returned results}
 
 \LB\ server returns errors which are classified as hard and soft errors.
 The main difference between these categories is that in the case of soft
@@ -59,7 +61,7 @@ It may take the following values:
 Default value is EDG\_WLL\_QUERYRES\_NONE.
 
 
-\subsubsection{Job queries}
+\subsection{Job queries}
 
 \partitle{Job status}
 \label{JS}
@@ -457,7 +459,7 @@ interval.
 \end{verbatim}
 
 
-\subsubsection{Event queries and application specific queries}
+\subsection{Event queries and application specific queries}
 \label{ASQ}
 Event queries and job queries are similar. 
 Obviously, the return type is different\Dash the \LB\ raw events.
index 1be4fb7..34fcba3 100644 (file)
@@ -1,6 +1,17 @@
-\def\LB{L\&B}
-\def\eg{e.\,g.}
-\def\ie{i.\,e.}
-\def\Dash{\,---\,\penalty-1000}
-\def\todo#1{\par\textbf{TODO:} #1\par}
+\usepackage{xspace}
+%\usepackage{doxygen}
 
+\def\LB{L\&B\xspace}
+\def\JP{JP\xspace}
+%\def\eg{e.\,g.}
+\def\eg{for example\xspace}
+\def\Eg{For example\xspace}
+%\def\ie{i.\,e.}
+\def\ie{that is\xspace}
+\def\wrt{with respect to\xspace}
+\def\Dash{---\penalty-1000}
+
+\long\def\TODO#1{\par\noindent\textbf{TODO:} {\sl#1}\par}
+\long\def\ludek#1{}
+
+\hyphenation{plug-in}
diff --git a/org.glite.lb.doc/src/events.tex.T b/org.glite.lb.doc/src/events.tex.T
new file mode 100644 (file)
index 0000000..6fe5c52
--- /dev/null
@@ -0,0 +1,31 @@
+@@@{
+gen qq{
+%  !! Automatically generated file. Do not edit.
+%  !! Change the corresponding template file $ARGV
+};
+@@@}
+
+\begin{tabularx}{\textwidth}{l>{\bfseries}lX}
+@@@{
+my $flesh = 'gLite';    #XXX
+my $fleshno = 0;
+my $eventno = $fleshno;
+for my $e (sort { $event->{order}->{$a} <=> $event->{order}->{$b} }
+                $event->getTypes) {
+        my $u = uc $e;
+        my $c = getTypeComment $event $e;
+
+        if ($flesh ne $event->{flesh}->{$e}) {
+                $flesh = $event->{flesh}->{$e};
+                gen "% new flesh $flesh \n";
+                $fleshno += 100;
+                $eventno = $fleshno;
+        }
+        $eventno++;
+        gen "$eventno. \& $e: \& $c \\\\ \n";
+}
+@@@}
+\end{tabularx}
+
+\endinput
+
diff --git a/org.glite.lb.doc/src/images/LB-components-gather.pdf b/org.glite.lb.doc/src/images/LB-components-gather.pdf
new file mode 100644 (file)
index 0000000..4795488
Binary files /dev/null and b/org.glite.lb.doc/src/images/LB-components-gather.pdf differ
diff --git a/org.glite.lb.doc/src/images/LB-components-query.pdf b/org.glite.lb.doc/src/images/LB-components-query.pdf
new file mode 100644 (file)
index 0000000..ab433de
Binary files /dev/null and b/org.glite.lb.doc/src/images/LB-components-query.pdf differ
diff --git a/org.glite.lb.doc/src/images/seqtree.pdf b/org.glite.lb.doc/src/images/seqtree.pdf
new file mode 100644 (file)
index 0000000..33ea802
Binary files /dev/null and b/org.glite.lb.doc/src/images/seqtree.pdf differ
diff --git a/org.glite.lb.doc/src/images/wms2-jobstat.pdf b/org.glite.lb.doc/src/images/wms2-jobstat.pdf
new file mode 100644 (file)
index 0000000..fb34648
Binary files /dev/null and b/org.glite.lb.doc/src/images/wms2-jobstat.pdf differ
index 9f01701..d9d6abb 100644 (file)
@@ -1,4 +1,5 @@
-
+\subsection{Logging a UserTag event}
+\label{log_usertag}
 
 User tag is an arbitrary ``name=value'' pair with which the user can 
 assign additional information to a job. Further on, LB can be queried
@@ -7,7 +8,7 @@ based also on values of user tags.
 
 In order to add user tag for a job a special event \verb+UserTag+ is used. This
 event can be logged by the job owner using the glite-lb-logevent command (see also
-sec.\ref{cmdln_interface}). Here we suppose the command is used from user's running
+sec.\ref{glite-lb-logevent}). Here we suppose the command is used from user's running
  application because a correct setting of environment variables needed by 
 the command is assured.
 
similarity index 97%
rename from org.glite.lb.doc/src/cmdln_interface.tex
rename to org.glite.lb.doc/src/logevent.tex
index ddf2a55..6c427f5 100644 (file)
@@ -1,3 +1,6 @@
+\subsection{glite-lb-logevent}
+\label{glite-lb-logevent}
+
 Besides the API's \LB\ offers its users a simple command-line interface for
 logging events. The command glite-lb-logevent is used for this purpose. However, it
 is intended for internal WMS debugging tests in the first place and should not
diff --git a/org.glite.lb.doc/src/logging-arch-notif.pdf b/org.glite.lb.doc/src/logging-arch-notif.pdf
deleted file mode 100644 (file)
index 09a3920..0000000
Binary files a/org.glite.lb.doc/src/logging-arch-notif.pdf and /dev/null differ
index a236851..d95f60f 100644 (file)
@@ -1,7 +1,9 @@
+\section{\LB\ Notification API}
+
 The purpose of this section is demonstrating the usage of the \LB\ notification API. Two examples of basic API usage are given.
 
 
-\subsubsection{Registering and receiving notification}
+\subsection{Registering and receiving notification}
 
 The following example registers on \LB\ server to receive notifications triggered by events belonging to job with \verb'jobid' and waits for notification until \verb'timeout'. 
 The code assumes the user to prepare a~reasonable value in \verb'jobid'
@@ -81,7 +83,7 @@ error:
 
 \end{verbatim}
 
-First of all the context is initialised. During this procedure user's credentials are loaded (see \ref{cmdln_interface} for information on environmental variables pointing to user's X509 credentials). 
+First of all the context is initialised. During this procedure user's credentials are loaded. %(see \ref{cmdln_interface} for information on environmental variables pointing to user's X509 credentials). 
 
 Then conditions under which notifications are sent are set. In this example, user is notified every time when event with given jobId is logged to \LB\ server. For more complicated conditions, please, consider the conditions limitations mentioned in \ref{notification}.
 
@@ -94,7 +96,7 @@ delivery, the call waits until some notification arrival or timeout.
 If user does not want to receive notifications any more, \verb'edg_wll_NotifDrop' call removes the registration for notifications from \LB server.
 
 
-\subsubsection{Changing destination for notifications}
+\subsection{Changing destination for notifications}
 
 The second example illustrates how to receive notifications from different host or different application. 
 
diff --git a/org.glite.lb.doc/src/producer_api.tex b/org.glite.lb.doc/src/producer_api.tex
new file mode 100644 (file)
index 0000000..71f4fe9
--- /dev/null
@@ -0,0 +1,2 @@
+\section{\LB\ Logging API}
+
diff --git a/org.glite.lb.doc/src/status.tex.T b/org.glite.lb.doc/src/status.tex.T
new file mode 100644 (file)
index 0000000..4a19701
--- /dev/null
@@ -0,0 +1,17 @@
+@@@{
+gen qq{
+%  !! Automatically generated file. Do not edit.
+%  !! Change the corresponding template file $ARGV
+};
+@@@}
+
+\begin{tabularx}{\textwidth}{>{\bfseries}lX}
+@@@{
+for my $stat ($status->getTypesOrdered) {
+       my $c = getTypeComment $status $stat;
+
+        gen "$stat: \& $c \\\\ \n";
+        }
+@@@}
+\end{tabularx}
+\endinput
diff --git a/org.glite.lb.doc/src/web_services.tex b/org.glite.lb.doc/src/web_services.tex
new file mode 100644 (file)
index 0000000..983cc5f
--- /dev/null
@@ -0,0 +1,19 @@
+\subsection{Using \LB\ Web Service}
+
+The \LB\ web service interface currently reflects the functionality of legacy
+\LB\ query API (Sect.~\ref{query-C}).
+
+The following sections describe the operations defined in the \LB\ WSDL
+file as well as its custom types.
+
+For the sake of readability this documentation does not follow the structure
+of WSDL strictly, avoiding to duplicate information which is already present
+here.
+Conseqently, the SOAP messages are not documented, for example, as they
+are derived from operation inputs and outputs mechanically.
+The same holds for types: \eg\ we do not document defined elements
+which correspond 1:1 to types but are required due to the literal SOAP
+encoding.
+
+For exact definition of the operations and types see the WSDL file.
+