From 1719fe05731d280348ac72fc6dd3950809cb1989 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ale=C5=A1=20K=C5=99enek?= Date: Thu, 14 Sep 2006 12:44:49 +0000 Subject: [PATCH] added proxy context creation stress test --- org.glite.lb.client/Makefile | 2 +- org.glite.lb.client/examples/stress_context.c | 110 ++++++++++++++++++++++++++ 2 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 org.glite.lb.client/examples/stress_context.c diff --git a/org.glite.lb.client/Makefile b/org.glite.lb.client/Makefile index d4de6b3..b767f0e 100644 --- a/org.glite.lb.client/Makefile +++ b/org.glite.lb.client/Makefile @@ -132,7 +132,7 @@ PLUSLIB:=libglite_lb_clientpp_${nothrflavour}.la THRPLUSLIB:=libglite_lb_clientpp_${thrflavour}.la TOOLS:=dump load purge lb_dump_exporter -EXAMPLES:=log_usertag_proxy job_log job_reg feed_shark notify query_ext query_seq_code stats abort_job change_acl lbmon flood_proxy +EXAMPLES:=log_usertag_proxy job_log job_reg feed_shark notify query_ext query_seq_code stats abort_job change_acl lbmon flood_proxy stress_context EXAMPLES_CL=user_jobs job_status FAKE_EXAMPLES:=job_log_fake diff --git a/org.glite.lb.client/examples/stress_context.c b/org.glite.lb.client/examples/stress_context.c new file mode 100644 index 0000000..405f4d1 --- /dev/null +++ b/org.glite.lb.client/examples/stress_context.c @@ -0,0 +1,110 @@ +#include +#include +#include +#include +#include + +#include "glite/wmsutils/jobid/cjobid.h" +#include "glite/lb/producer.h" +#include "glite/lb/events.h" + +char *outfile = "context_errors"; +edg_wlc_JobId job; + +static int stop; + +struct { + int err; + char *text,*desc; +} *errors; + +int nerrors; + +static void killslaves(int sig) +{ + kill(0,SIGTERM); + exit(0); +} + +static void terminate(int sig) +{ + stop = sig; +} + +static void slave(int num) +{ + int good = 0,i; + char fname[PATH_MAX]; + FILE *errf; + edg_wll_Context ctx; + + signal(SIGINT,terminate); + signal(SIGTERM,terminate); + signal(SIGHUP,terminate); + + + while (!stop) { + edg_wll_InitContext(&ctx); + edg_wll_SetParam(ctx, EDG_WLL_PARAM_SOURCE, EDG_WLL_SOURCE_WORKLOAD_MANAGER); + + if (edg_wll_SetLoggingJobProxy(ctx,job,NULL,"/I/am/the/user",EDG_WLL_SEQ_NORMAL) && !stop) { + errors = realloc(errors,(nerrors+1) * sizeof(*errors)); + errors[nerrors].err = edg_wll_Error(ctx,&errors[nerrors].text,&errors[nerrors].desc); + nerrors++; + } + else good++; + + edg_wll_FreeContext(ctx); + } + + sprintf(fname,"%s_%03d",outfile,num); + errf = fopen(fname,"w"); + if (!errf) { perror(fname); exit(1); } + + for (i=0; i