#include <errno.h>
#include <time.h>
#include <pthread.h>
+#include <unistd.h>
#include "glite/lb/context-int.h"
#ifdef BUILDING_LB_CLIENT
void *thread_meat(char *jobid) {
edg_wll_Context ctx;
- int result=0;
+ int result=0, retries;
if ( edg_wll_InitContext(&ctx) ) {
fprintf(stderr,"cannot initialize edg_wll_Context\n");
}
else free(bserver);
- if (edg_wll_JobStatus(ctx, job, EDG_WLL_STAT_CLASSADS | EDG_WLL_STAT_CHILDREN | EDG_WLL_STAT_CHILDSTAT, &status)) {
- dgerr(ctx,"edg_wll_JobStatus"); result = 1;
- } else printstat_oneline(status,0);
+ for (retries = 6; retries > 0; retries--) {
+ if (edg_wll_JobStatus(ctx, job, EDG_WLL_STAT_CLASSADS | EDG_WLL_STAT_CHILDREN | EDG_WLL_STAT_CHILDSTAT, &status)) {
+ dgerr(ctx,"edg_wll_JobStatus"); result = 1;
+ } else {
+ printstat_oneline(status,0);
+ break;
+ }
+ sleep(3);
+ }
if (job) edg_wlc_JobIdFree(job);
// if (status.state) edg_wll_FreeStatus(&status);
\hline
{\tt lb-test-statistics.sh} & Implemented & Test statistic functions provided by \LB \\
\hline
+{\tt lb-test-threaded.sh} & Implemented & Rudimentary test for threaded clients \LB \\
+\hline
\end{tabularx}
\subsubsection{Event logging examples}
\result\ Meaningful values should be returned by both tests.
+\subsubsection{Multi-Threaded Operation}
+
+\req\ \LB\ server running
+
+\what\
+\begin{enumerate}
+\item Register a series of jobs.
+\item Run a client using multiple threads to query the server simultaneously.
+\item Check if all threads finished OK.
+\end{enumerate}
+
+\how\ \ctblb{lb-test-threaded.sh}
+
+\note\ The is not a thorough test. It is not capable of discovering rare or improbable problems but it will check the essentials of multi-threaded opration.
+
+\result\ The test must not hang. Meaningful results (albeit errors) must be returned by all threads.
\section{LB ``In the Wild''---Real-World WMS Test}