server_R_1_6_2'.
Sprout from wms_chpt_patch_1251 2007-08-07 10:59:47 UTC Zdeněk Salvet <salvet@ics.muni.cz> 'Increase patchlevel (startup script change).'
Delete:
org.glite.lb.client/.cvsignore
org.glite.lb.client/LICENSE
org.glite.lb.client/Makefile
org.glite.lb.client/build.xml
org.glite.lb.client/doc/README-fake
org.glite.lb.client/doc/README-notify
org.glite.lb.client/doc/glite-lb-logevent.1
org.glite.lb.client/examples/abort_job.c
org.glite.lb.client/examples/aborted.l
org.glite.lb.client/examples/cancelled.l
org.glite.lb.client/examples/change_acl.c
org.glite.lb.client/examples/chkpt.l
org.glite.lb.client/examples/cleared.l
org.glite.lb.client/examples/consumer_fake.c
org.glite.lb.client/examples/dagids.c
org.glite.lb.client/examples/done.l
org.glite.lb.client/examples/done_dag.l
org.glite.lb.client/examples/done_subjob.l
org.glite.lb.client/examples/failed_dag.l
org.glite.lb.client/examples/failed_subjob.l
org.glite.lb.client/examples/feed_shark.c
org.glite.lb.client/examples/flood_proxy.c
org.glite.lb.client/examples/gen_begin
org.glite.lb.client/examples/gen_sample_job
org.glite.lb.client/examples/job_log.c
org.glite.lb.client/examples/job_log_fake.cpp
org.glite.lb.client/examples/job_reg.c
org.glite.lb.client/examples/job_status.c
org.glite.lb.client/examples/log_usertag_proxy.c
org.glite.lb.client/examples/notify.c
org.glite.lb.client/examples/parse_eventsfile.c
org.glite.lb.client/examples/producer_fake.c
org.glite.lb.client/examples/purge_test
org.glite.lb.client/examples/query_ext.c
org.glite.lb.client/examples/query_seq_code.c
org.glite.lb.client/examples/ready.l
org.glite.lb.client/examples/ready_dag.l
org.glite.lb.client/examples/ready_subjob.l
org.glite.lb.client/examples/resubmission.l
org.glite.lb.client/examples/resubmitted.l
org.glite.lb.client/examples/running.l
org.glite.lb.client/examples/running_dag.l
org.glite.lb.client/examples/running_subjob.l
org.glite.lb.client/examples/scheduled.l
org.glite.lb.client/examples/scheduled_dag.l
org.glite.lb.client/examples/scheduled_subjob.l
org.glite.lb.client/examples/shallow_and_full_resub.l
org.glite.lb.client/examples/shallow_resub_complex.l
org.glite.lb.client/examples/shallow_resub_simple.l
org.glite.lb.client/examples/shallow_resub_simple2.l
org.glite.lb.client/examples/stats.c
org.glite.lb.client/examples/stress_context.c
org.glite.lb.client/examples/stresslog.c
org.glite.lb.client/examples/submitted.l
org.glite.lb.client/examples/submitted_dag.l
org.glite.lb.client/examples/submitted_subjob.l
org.glite.lb.client/examples/ulmfields.pl
org.glite.lb.client/examples/user_jobs.c
org.glite.lb.client/examples/user_jobs_threaded.c
org.glite.lb.client/examples/waiting.l
org.glite.lb.client/examples/waiting_dag.l
org.glite.lb.client/examples/waiting_subjob.l
org.glite.lb.client/project/.cvsignore
org.glite.lb.client/project/build.number
org.glite.lb.client/project/build.properties
org.glite.lb.client/project/configure.properties.xml
org.glite.lb.client/project/properties.xml
org.glite.lb.client/project/tar_exclude
org.glite.lb.client/project/version.properties
org.glite.lb.client/src/Event.cpp.T
org.glite.lb.client/src/Job.cpp
org.glite.lb.client/src/JobStatus.cpp.T
org.glite.lb.client/src/Notification.cpp
org.glite.lb.client/src/ServerConnection.cpp
org.glite.lb.client/src/args.c.T
org.glite.lb.client/src/args.h
org.glite.lb.client/src/connection.c
org.glite.lb.client/src/connection.h
org.glite.lb.client/src/consumer.c
org.glite.lb.client/src/dump.c
org.glite.lb.client/src/export.sh
org.glite.lb.client/src/lb_dump_exporter.c
org.glite.lb.client/src/load.c
org.glite.lb.client/src/logevent.c.T
org.glite.lb.client/src/notification.c
org.glite.lb.client/src/perftest_jobreg.c
org.glite.lb.client/src/perftest_jobreg.sh
org.glite.lb.client/src/perftest_logjobs.c
org.glite.lb.client/src/perftest_query.sh
org.glite.lb.client/src/prod_proto.c
org.glite.lb.client/src/prod_proto.h
org.glite.lb.client/src/producer.c
org.glite.lb.client/src/purge.c
org.glite.lb.client/src/statistics.c
org.glite.lb.client/src/uiwrap.c.T
org.glite.lb.client/test/PLOT
org.glite.lb.client/test/TEST
org.glite.lb.client/test/prod_proto_test.c
org.glite.lb.client/test/producer_test.cpp
org.glite.lb/.cvsignore
org.glite.lb/LICENSE
org.glite.lb/build.xml
org.glite.lb/deployment/README
org.glite.lb/deployment/deploy_all.diff
org.glite.lb/deployment/deploy_jp.diff
org.glite.lb/deployment/deploy_lb.diff
org.glite.lb/doc/README.lb4vdt
org.glite.lb/doc/copyright.tex
org.glite.lb/doc/frontmatter.tex
org.glite.lb/doc/perf_clear_proxy
org.glite.lb/doc/perf_purge
org.glite.lb/doc/perf_reg_jobs
org.glite.lb/doc/perf_results/il_sci_09062006.txt
org.glite.lb/doc/perf_results/il_sci_09062006_01.txt
org.glite.lb/doc/perf_results/il_sci_12062006.txt
org.glite.lb/doc/perf_results/ll_michal_21062006.txt
org.glite.lb/doc/perf_results/proxy2serv_umbar2sci_22062006.txt
org.glite.lb/doc/perf_results/proxy2serv_umbar2sci_23062006.txt
org.glite.lb/doc/perf_results/proxy_sci_09062006.txt
org.glite.lb/doc/perf_run_interlogd
org.glite.lb/doc/perf_run_proxy
org.glite.lb/doc/perf_run_server
org.glite.lb/doc/perf_run_test
org.glite.lb/doc/perftest.tex
org.glite.lb/doc/testplan.tex
org.glite.lb/lb4vdt/LB_install.sh
org.glite.lb/lb4vdt/Makefile.inc
org.glite.lb/lb4vdt/scripts/org.gridsite.core.build
org.glite.lb/project/MultiStruct.pm
org.glite.lb/project/StructField.pm
org.glite.lb/project/at3
org.glite.lb/project/build.number
org.glite.lb/project/build.properties
org.glite.lb/project/check_version.pl
org.glite.lb/project/dependencies.properties
org.glite.lb/project/events.T
org.glite.lb/project/glite.lb.csf.xml
org.glite.lb/project/properties.xml
org.glite.lb/project/run-workspace
org.glite.lb/project/status.T
org.glite.lb/project/taskdefs.xml
org.glite.lb/project/types.T
org.glite.lb/project/version.properties
+++ /dev/null
-.project
-.cdtproject
\ No newline at end of file
+++ /dev/null
-LICENSE file for EGEE Middleware\r
-================================\r
-\r
-Copyright (c) 2004 on behalf of the EU EGEE Project: \r
-The European Organization for Nuclear Research (CERN), \r
-Istituto Nazionale di Fisica Nucleare (INFN), Italy\r
-Datamat Spa, Italy\r
-Centre National de la Recherche Scientifique (CNRS), France\r
-CS Systeme d'Information (CSSI), France\r
-Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden\r
-Universiteit van Amsterdam (UvA), Netherlands\r
-University of Helsinki (UH.HIP), Finlan\r
-University of Bergen (UiB), Norway\r
-Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom\r
-\r
-Redistribution and use in source and binary forms, with or without\r
-modification, are permitted provided that the following conditions are\r
-met: \r
-\r
-1. Redistributions of source code must retain the above copyright\r
-notice, this list of conditions and the following disclaimer.\r
-\r
-2. Redistributions in binary form must reproduce the above copyright\r
-notice, this list of conditions and the following disclaimer in the\r
-documentation and/or other materials provided with the distribution.\r
-\r
-3. The end-user documentation included with the redistribution, if\r
-any, must include the following acknowledgment: "This product includes\r
-software developed by The EU EGEE Project (http://cern.ch/eu-egee/)."\r
-Alternatively, this acknowledgment may appear in the software itself, if\r
-and wherever such third-party acknowledgments normally appear.\r
-\r
-4. The names EGEE and the EU EGEE Project must not be\r
-used to endorse or promote products derived from this software without\r
-prior written permission. For written permission, please contact\r
-<email address>.\r
-\r
-5. You are under no obligation whatsoever to provide anyone with any\r
-bug fixes, patches, or upgrades to the features, functionality or\r
-performance of the Software ("Enhancements") that you may develop over\r
-time; however, if you choose to provide your Enhancements to The EU\r
-EGEE Project, or if you choose to otherwise publish or distribute your\r
-Enhancements, in source code form without contemporaneously requiring\r
-end users of The EU EGEE Proejct to enter into a separate written license\r
-agreement for such Enhancements, then you hereby grant The EU EGEE Project\r
-a non-exclusive, royalty-free perpetual license to install, use, copy,\r
-modify, prepare derivative works, incorporate into the EGEE Middleware\r
-or any other computer software, distribute, and sublicense your\r
-Enhancements or derivative works thereof, in binary and source code\r
-form (if any), whether developed by The EU EGEE Project or third parties.\r
-\r
-THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED\r
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\r
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\r
-DISCLAIMED. IN NO EVENT SHALL PROJECT OR ITS CONTRIBUTORS BE LIABLE\r
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\r
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\r
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\r
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN\r
-IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
-\r
-This software consists of voluntary contributions made by many\r
-individuals on behalf of the EU EGEE Prject. For more information on The\r
-EU EGEE Project, please see http://cern.ch/eu-egee/. For more information on\r
-EGEE Middleware, please see http://egee-jra1.web.cern.ch/egee-jra1/\r
-\r
-\r
+++ /dev/null
-# Default values
-top_srcdir=.
-stagedir=.
-distdir=.
-globalprefix=glite
-lbprefix=lb
-package=glite-lb-client
-version=0.0.0
-
-glite_location=/opt/glite
-globus_prefix=/opt/globus
-nothrflavour=gcc32
-thrflavour=gcc32pthr
-
-
-CC:=gcc
-CXX:=g++
-
--include Makefile.inc
--include ../project/version.properties
-
-PREFIX?=${glite_location}
-
-version=${module.version}
-
-VPATH=${top_srcdir}/src:${top_srcdir}/test:${top_srcdir}/examples:${top_srcdir}/doc
-AT3=perl -I${top_srcdir}/project ${top_srcdir}/project/at3
-GENSAM=${top_srcdir}/examples/gen_sample_job
-CHECK_VERSION:=VERSION=${version} VERSION_AHEAD=0 perl ${top_srcdir}/project/check_version.pl
-
-SUFFIXES = .T .l
-
-l_SRC = \
- chkpt.l \
- cleared.l \
- done.l \
- done_dag.l \
- done_subjob.l \
- ready.l \
- ready_dag.l \
- ready_subjob.l \
- running.l \
- running_dag.l \
- running_subjob.l \
- scheduled.l \
- scheduled_dag.l \
- scheduled_subjob.l \
- submitted.l \
- submitted_dag.l \
- submitted_subjob.l \
- waiting.l \
- waiting_dag.l \
- waiting_subjob.l \
- failed_dag.l \
- failed_subjob.l \
- aborted.l \
- cancelled.l \
- shallow_resub_complex.l shallow_resub_simple.l shallow_resub_simple2.l \
- resubmission.l resubmitted.l
-
-
-sh_PROGS = $(l_SRC:.l=.sh)
-
-GLOBUSINC:= -I${globus_prefix}/include/${nothrflavour}
-GLOBUSTHRINC:= -I${globus_prefix}/include/${thrflavour}
-
-ifdef DEBUG
- DEBUG:=-g -O0 -Wall -DEDG_WLL_LOG_STUB
-else
- DEBUG:=-g -O0 -Wall
-endif
-
-ifdef LB_STANDALONE
- LB_STANDALONE_FLAGS:=-DLB_STANDALONE
-endif
-
-ifdef LB_PERF
- LB_PERF_FLAGS:=-DLB_PERF
- LB_PERF_TOOLS:=perftest_logjobs perftest_jobreg
-endif
-COMMON_LIB:=-lglite_lb_common_${nothrflavour}
-COMMON_LIB_THR:=-lglite_lb_common_${thrflavour}
-
-CFLAGS:=${DEBUG} \
- -I${top_srcdir}/src -I${top_srcdir}/interface \
- -I${stagedir}/include \
- -I${glite_location}/include \
- ${COVERAGE_FLAGS} \
- -D_GNU_SOURCE ${LB_STANDALONE_FLAGS} ${LB_PERF_FLAGS}
-
-CXXFLAGS:=${CFLAGS}
-
-EXT_LIB:=
-
-TEST_LIBS:=-L${cppunit_prefix}/lib -lcppunit
-TEST_INC:=-I${cppunit_prefix}/include
-
-
-LDFLAGS:=-L${stagedir}/lib \
- ${COVERAGE_FLAGS}
-
-COMPILE:=libtool --mode=compile ${CC} ${CFLAGS}
-CXXCOMPILE:=libtool --mode=compile ${CXX} ${CXXFLAGS}
-LINK:=libtool --mode=link ${CC} ${LDFLAGS}
-LINKXX:=libtool --mode=link ${CXX} ${LDFLAGS}
-INSTALL:=libtool --mode=install install
-
-LIBOBJS:=connection.o consumer.o notification.o prod_proto.o \
- producer.o uiwrap.o statistics.o
-FAKELIBOBJS:=consumer_fake.o producer_fake.o
-
-PLUSOBJS:=Event.o Job.o JobStatus.o Notification.o ServerConnection.o
-PUB_HDRS:=CountRef.h Event.h JobJobStatus.h Notification.h ServerConnection.h \
- LoggingExceptions.h
-
-LIBTHROBJS:=${LIBOBJS:.o=.thr.o}
-LIBLOBJS:=${LIBOBJS:.o=.lo}
-LIBTHRLOBJS:=${LIBOBJS:.o=.thr.lo}
-
-PLUSTHROBJS:=${PLUSOBJS:.o=.thr.o}
-PLUSLOBJS:=${PLUSOBJS:.o=.lo}
-PLUSTHRLOBJS:=${PLUSOBJS:.o=.thr.lo}
-
-FAKELIBTHROBJS:=${FAKELIBOBJS:.o=.thr.o}
-FAKELIBLOBJS:=${FAKELIBOBJS:.o=.lo}
-FAKELIBTHRLOBJS:=${FAKELIBOBJS:.o=.thr.lo}
-
-LIB:=libglite_lb_client_${nothrflavour}.la
-THRLIB:=libglite_lb_client_${thrflavour}.la
-FAKELIB:=libglite_lb_client_fake_${nothrflavour}.la
-FAKETHRLIB:=libglite_lb_client_fake_${thrflavour}.la
-
-PLUSLIB:=libglite_lb_clientpp_${nothrflavour}.la
-THRPLUSLIB:=libglite_lb_clientpp_${thrflavour}.la
-
-TOOLS:=dump load purge lb_dump_exporter ${LB_PERF_TOOLS}
-EXAMPLES:=log_usertag_proxy job_log job_reg feed_shark notify query_ext query_seq_code stats abort_job change_acl stresslog flood_proxy dagids stress_context parse_eventsfile
-
-EXAMPLES_CL=user_jobs job_status
-EXAMPLES_CL_THR=user_jobs_threaded
-FAKE_EXAMPLES:=job_log_fake
-
-MAN_GZ:=glite-lb-logevent.1.gz
-MAN = $(MAN_GZ:.gz=)
-
-# version_info=-version-info `echo ${version} | cut -d. -f1,2 | tr . :`
-
-# counted minor versions:
-offset=0
-
-version_info:=-version-info ${shell \
- perl -e '$$,=":"; @F=split "\\.","${version}"; print $$F[0]+$$F[1]+${offset},$$F[2],$$F[1]' }
-
-default: all
-
-${LIB}: ${LIBOBJS}
- ${LINK} ${version_info} -o $@ ${LIBLOBJS} -rpath ${PREFIX}/lib \
- ${COMMON_LIB} \
- -lglite_security_gss_${nothrflavour}
-
-${THRLIB}: ${LIBTHROBJS}
- ${LINK} ${version_info} -o $@ ${LIBTHRLOBJS} -rpath ${PREFIX}/lib \
- ${COMMON_LIB_THR} \
- -lglite_security_gss_${thrflavour}
-
-${FAKELIB}: ${FAKELIBOBJS}
- ${LINK} ${version_info} -o $@ ${FAKELIBLOBJS} -rpath ${PREFIX}/lib \
- ${COMMON_LIB} \
- -lglite_security_gss_${nothrflavour}
-
-${FAKETHRLIB}: ${FAKELIBTHROBJS}
- ${LINK} ${version_info} -o $@ ${FAKELIBTHRLOBJS} -rpath ${PREFIX}/lib \
- ${COMMON_LIB_THR} \
- -lglite_security_gss_${thrflavour}
-
-${PLUSLIB}: ${PLUSOBJS}
- ${LINK} ${version_info} -o $@ ${PLUSLOBJS} -rpath ${PREFIX}/lib ${LIB}
-
-${THRPLUSLIB}: ${PLUSTHROBJS}
- ${LINK} ${version_info} -o $@ ${PLUSTHRLOBJS} -rpath ${PREFIX}/lib ${THRLIB}
-
-logevent: logevent.o args.o
- ${LINK} -o $@ logevent.o args.o ${LIB} ${EXT_LIB}
-
-${TOOLS} ${EXAMPLES}: %: %.o
- ${LINK} -o $@ $< ${LIB} ${EXT_LIB}
-
-${EXAMPLES_CL}: %: %.o
- ${LINK} -o $@ $< ${LIB} ${COMMON_LIB} ${EXT_LIB}
-
-${EXAMPLES_CL_THR}: %: %.o
- ${LINK} -o $@ $< ${THRLIB} ${COMMON_LIB_THR} ${EXT_LIB}
-
-${FAKE_EXAMPLES}: %: %.o ${FAKELIB}
- ${LINK} -o $@ $< ${FAKELIB} ${TEST_LIBS} ${EXT_LIB}
-
-${TOOLS}: ${LIB}
-
-${FAKE_EXAMPLES:=.o}: %.o: %.cpp
- ${COMPILE} ${GLOBUSINC} ${TEST_INC} -c $< -o $@
-
-${PLUSOBJS}: %.o: %.cpp
- ${CXXCOMPILE} ${GLOBUSINC} -c $<
-
-${PLUSTHROBJS}: %.thr.o: %.cpp
- ${CXXCOMPILE} ${GLOBUSTHRINC} -o $@ -c $<
-
-${LIBOBJS} ${FAKELIBOBJS}: %.o: %.c
- ${COMPILE} ${GLOBUSINC} -c $<
-
-${LIBTHROBJS} ${FAKELIBTHROBJS}: %.thr.o: %.c
- ${COMPILE} ${GLOBUSTHRINC} -o $@ -c $<
-
-logevent_fake.o: logevent.c
- ${COMPILE} ${GLOBUSINC} -c $< -o $@
-
-${MAN_GZ}: ${MAN}
- cp $? .
- gzip $(notdir $?)
-
-
-perftest_logjobs.o: perftest_logjobs.c
- ${CC} ${CFLAGS} -DLB_PERF_DROP ${GLOBUSINC} -c $<
-
-# catches $TOOLS and logevent compilation
-%.o: %.c
- ${CC} ${CFLAGS} ${GLOBUSINC} -c $<
-
-%.c: %.c.T
- rm -f $@
- ${AT3} $< >$@ || rm -f $@
- chmod -w $@ >/dev/null
-
-%.cpp: %.cpp.T
- rm -f $@
- ${AT3} $< >$@ || rm -f $@
- chmod -w $@ >/dev/null
-
-%.sh: %.l gen_begin gen_sample_job
- rm -f $@
- $(GENSAM) $< >$@ || rm -f $@
- chmod -w,+x $@ > /dev/null
-
-default: all
-
-
-ifdef LB_STANDALONE
-compile all: ${LIB} ${THRLIB} ${TOOLS} logevent examples ${MAN_GZ}
-else
-compile all: check_version ${LIB} ${THRLIB} ${TOOLS} logevent ${PLUSLIB} ${THRPLUSLIB} examples ${MAN_GZ}
-endif
-
-examples: ${EXAMPLES} ${EXAMPLES_CL} ${EXAMPLES_CL_THR} ${sh_PROGS}
-
-fake: ${FAKE_EXAMPLES}
-
-check: compile
-# shut up check.producer
-
-check.producer: producer_test
- ./producer_test
-
-producer_test: producer_test.o prod_proto_test.o
- ${LINKXX} -o $@ ${LIB} ${TEST_LIBS} $+ ${EXT_LIB}
-
-producer_test.o: %.o: %.cpp
- ${CXX} -c ${CXXFLAGS} ${TEST_INC} ${GLOBUSINC} $<
-
-man: ${MAN_GZ}
-
-stage: compile ${FAKELIB} ${FAKETHRLIB}
- $(MAKE) install PREFIX=${stagedir}
- ${INSTALL} -m 644 ${FAKELIB} ${FAKETHRLIB} ${stagedir}/lib
-
-dist: distsrc distbin
-
-distsrc:
- mkdir -p ${top_srcdir}/${package}-${version}
- cd ${top_srcdir} && GLOBIGNORE="${package}-${version}" && cp -Rf * ${package}-${version}
- cd ${top_srcdir} && tar -czf ${distdir}/${package}-${version}_src.tar.gz --exclude-from=project/tar_exclude ${package}-${version}
- rm -rf ${top_srcdir}/${package}-${version}
-
-distbin:
- $(MAKE) install PREFIX=`pwd`/tmpbuilddir${stagedir}
- save_dir=`pwd`; cd tmpbuilddir${stagedir} && tar -czf $$save_dir/${top_srcdir}/${distdir}/${package}-${version}_bin.tar.gz *; cd $$save_dir
- rm -rf tmpbuilddir
-
-install:
- mkdir -p ${PREFIX}/bin
- mkdir -p ${PREFIX}/sbin
- mkdir -p ${PREFIX}/lib
- mkdir -p ${PREFIX}/share/doc/${package}-${version}
- mkdir -p ${PREFIX}/share/man/man1
-ifdef LB_STANDALONE
- ${INSTALL} -m 644 ${LIB} ${THRLIB} ${PREFIX}/lib
-else
- ${INSTALL} -m 644 ${LIB} ${THRLIB} ${PLUSLIB} ${THRPLUSLIB} ${PREFIX}/lib
-endif
- ${INSTALL} -m 644 ${top_srcdir}/LICENSE ${PREFIX}/share/doc/${package}-${version}
- ${INSTALL} -m 644 ${top_srcdir}/doc/README-fake ${top_srcdir}/doc/README-notify ${PREFIX}/share/doc/${package}-${version}
- mkdir -p ${PREFIX}/examples
- for p in logevent; do \
- ${INSTALL} -m 755 "$$p" "${PREFIX}/bin/glite-lb-$$p"; \
- done
- for p in ${TOOLS} ; do \
- ${INSTALL} -m 755 "$$p" "${PREFIX}/sbin/glite-lb-$$p"; \
- done
- for p in ${EXAMPLES} ${EXAMPLES_CL} ${EXAMPLES_CL_THR} ${sh_PROGS} ; do \
- ${INSTALL} -m 755 "$$p" "${PREFIX}/examples/glite-lb-$$p"; \
- done
- ${INSTALL} -m 755 ${top_srcdir}/src/export.sh "${PREFIX}/sbin/glite-lb-export.sh"
- ${INSTALL} -m 644 ${MAN_GZ} ${PREFIX}/share/man/man1
-
-clean:
- rm -rf *.o *.lo .libs lib* *.c *.cpp producer_test
- rm -rf ${LIB} ${THRLIB} ${TOOLS} logevent ${PLUSLIB} ${THRPLUSLIB} ${MAN_GZ}
- rm -rf ${EXAMPLES} ${EXAMPLES_CL} ${EXAMPLES_CL_THR} ${sh_PROGS}
-
-
-check_version:
- ${CHECK_VERSION} ${stagedir}/include/glite/lb/interface_version.h
-
-.PHONY: default all compile examples fake check stage dist distsrc distbin install clean check_version
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- Copyright (c) 2004 on behalf of the EU EGEE Project:
- The European Organization for Nuclear Research (CERN),
- Istituto Nazionale di Fisica Nucleare (INFN), Italy
- Datamat Spa, Italy
- Centre National de la Recherche Scientifique (CNRS), France
- CS Systeme d'Information (CSSI), France
- Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden
- Universiteit van Amsterdam (UvA), Netherlands
- University of Helsinki (UH.HIP), Finland
- University of Bergen (UiB), Norway
- Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom
-
- Build file for the GLite LB Client module
-
- Authors: Ales Krenek <ljocha@ics.muni.cz>
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
- Revision 1.6.20.1 2006/09/21 13:21:40 jpospi
- use check_version.pl
-
- Revision 1.6 2005/05/26 15:13:40 zurek
- inserted module.build.file
-
- Revision 1.5 2004/10/18 19:16:09 zsalvet
- RPM descriptions
-
- Revision 1.4 2004/07/28 12:18:12 dimeglio
- Changed default target from compile to dist
-
- Revision 1.3 2004/07/06 17:45:30 flammer
- Update of classpath definitions, targets & configure file.
-
- Revision 1.2 2004/06/23 00:29:33 dimeglio
- Added standard comments and handling of support files
-
--->
-
-<project name="client" default="dist">
-
- <!-- =========================================
- Builds the GLite LB Client Module
- ========================================= -->
-
- <!-- =========================================
- Import properties (order is important)
- ========================================= -->
-
- <!-- import baseline & user properties -->
- <import file="../org.glite/project/baseline.properties.xml" />
-
- <!-- import component build properties,
- component properties &
- component common properties -->
- <import file="./project/properties.xml"/>
-
- <!-- import subsystem build properties,
- subsystem properties &
- subsystem common properties -->
- <import file="${subsystem.properties.file}"/>
-
- <!-- import global build properties &
- global properties -->
- <import file="${global.properties.file}" />
-
- <!-- =========================================
- Load dependency property files (order is important)
- ========================================= -->
- <property file="${user.dependencies.file}"/>
- <property file="${component.dependencies.file}" />
- <property file="${subsystem.dependencies.file}" />
- <property file="${global.dependencies.file}"/>
-
- <!-- =========================================
- Load configure options (order is important)
- ========================================= -->
- <import file="${global.configure.options.file}"/>
- <import file="${component.configure.options.file}"/>
-
- <!-- =========================================
- Import task definitions (order is important)
- ========================================= -->
- <import file="${subsystem.taskdefs.file}" />
- <import file="${global.taskdefs.file}" />
-
- <!-- =========================================
- Load common targets
- ========================================= -->
- <import file="${global.targets-simple_make.file}" />
-
- <!-- =========================================
- Load version file
- ========================================= -->
- <property file="${module.version.file}"/>
- <property file="${module.build.file}"/>
-
- <!-- ==============================================
- Local private targets
- ============================================== -->
-
- <target name="localinit"
- description="Module specific initialization tasks">
- <!-- Copy support files from the subsystem project to the component project-->
- <copy toDir="${module.project.dir}">
- <fileset dir="${subsystem.project.dir}">
- <include name="at3" />
- <include name="*.T" />
- <include name="*.pm" />
- <include name="check_version.pl" />
- </fileset>
- </copy>
- <antcall target="lbmakefiles" />
- </target>
-
- <target name="localcompile"
- description="Module specific compile tasks">
- </target>
-
- <target name="localclean"
- description="Module specific cleaning tasks">
- <delete>
- <fileset dir="${module.project.dir}">
- <include name="at3" />
- <include name="*.T" />
- <include name="*.pm" />
- </fileset>
- </delete>
- </target>
-
- <!-- =========================================
- RPM settings
- ========================================= -->
-
- <property name="build.package.summary" value="L&B client API and tools" />
- <property name="build.package.description" value="
-Logging & Bookkeeping (L&B) C and C++ client libraries,
command
-for logging of L&B events from shell scripts,
and utilities
-for (remote) bookkeeping server maintenance." />
-
-</project>
+++ /dev/null
-Fake library
-------------
-
-Fake library is a substitute library designed for usage in unit tests of
-programs which use L&B. The library implements a subset of L&B client API.
-Implemented functions are dummy in the sense that they do not produce any
-sideefect and they do not require any running services.
-
-Main purpose of the library is WMS unit testing, so it should contain all L&B
-function calls used in WMS.
-
-List of implemented functions:
-
- 1) consumer API
-
- edg_wll_QueryEvents
- edg_wll_QueryListener
- edg_wll_JobLog
- edg_wll_QuerySequenceCode
-
- 2) producer API
-
- edg_wll_Log* (functions for logging all event types)
- edg_wll_LogEvent
- edg_wll_LogEventSync
- edg_wll_LogEventProxy
- edg_wll_LogFlush
- edg_wll_LogFlushAll
- edg_wll_SetLoggingJob
- edg_wll_SetLoggingJobProxy
- edg_wll_RegisterJobSync
- edg_wll_RegisterJob
- edg_wll_RegisterSubjob
- edg_wll_RegisterSubjobs
- edg_wll_ChangeACL
-
-
-Function calls always try to return some meaningful data. However, for testing
-purposes a fine control on the returned value is usually required (e.g. to
-cover both success and failure of the called function). Therefore the library
-enables to set function error codes and/or adjust returned data. This is done
-via callbacks. Callbacks are activated right before function end when all
-pre-set data are available.
-
-Callbacks must be registered before using the library call. It is possible to
-have only one registered callback for each registration type at once (see
-below). Callback registration is global, it IS NOT thread safe. Otherwise
-the library is thread safe in the same way as standard L&B library --
-functions may be called by multiple threads simultaneously provided that
-more threads do not operate on a single L&B context at the same time.
-
-The following code fragments represent an example of unit test of a function
-calling e.g. edg_wll_LogMatch()
-
-#include "glite/lb/producer_fake.h"
-
-int fail_EAGAIN_callback(edg_wll_Context ctx)
-{
- return edg_wll_SetError(ctx,EAGAIN,"failure reason");
-}
-
-unit_test()
-{
- /* sucessfull logging, edg_wll_LogMatch() called from
- * tested_function() returns OK */
-
- tested_function();
- /* check results here */
-
- /* failing with EAGAIN */
- edg_wll_RegisterTestLogging(fail_EAGAIN_callback);
- tested_function();
- /* check results here */
-}
-
-The consumer API (QueryEvents, QueryListener) fake implementations
-prepare some result set which is returned to the caller. The callback
-function may also adjust this set for particular purposes of the unit test.
-
-List of the callbacks and registering functions:
-
- 1) cosumer API
-
- typedef int (edg_wll_QueryEvents_cb_f)
- (edg_wll_Context context, edg_wll_Event **events);
- typedef int (edg_wll_QueryListener_cb_f)
- (edg_wll_Context context, char **host, uint16_t *port);
-
- int edg_wll_RegisterTestQueryEvents(edg_wll_QueryEvents_cb_f *cb);
- int edg_wll_RegisterTestQueryListener(edg_wll_QueryListener_cb_f *cb);
-
- 2) producer API
-
- typedef int (edg_wll_Logging_cb_f)(edg_wll_Context context);
-
- int edg_wll_RegisterTestLogging(edg_wll_Logging_cb_f *cb);
- int edg_wll_RegisterTestLoggingProxy(edg_wll_Logging_cb_f *cb);
-
-
-It possible to unregister registered callbacks using following functions:
-
- void edg_wll_UnregisterTestQueryEvents();
- void edg_wll_UnregisterTestQueryListener();
- void edg_wll_UnregisterTestLogging();
- void edg_wll_UnregisterTestLoggingProxy();
-
-
-Library name is libglite_lb_client_fake_gcc32dbg[pthr].so. It is built
-in the org.glite.lb.client module, staged (so that it is available
-for WMS unit tests run during the build process) but currenlty
-neither installed nor included in RPM.
-
-Unit test programs should linked with this library instead of the original
-libglite_lb_client_gcc32dbg[pthr].so. You can find examples of fake library
-usage in org.glite.lb.client. The Makefile target 'fake' builds these examples.
-There is no ant equivalent, hence the following procedure is required:
-
- cd org.glite.lb.client
- ant init
- cd build
- make fake
-
-
-An example of unit test using the fake library is the file
-examples/job_log_fake.cpp. There is showed how to use callbacks and their
-registration.
+++ /dev/null
-LB notifications
-----------------
-
-LB infrastructure enables its users to be notified when something interesting happens on a LB server (typically job status change). It enables the user not to poll LB server periodically to find out whatever he/she is interesting in but confortable wait and let the server itself inform you. If user wants to receive the notifications, he/she must first register to the LB notification infarastructure.
-
-User registers via some notification client. (program that uses LB client API to handle notifications). He/she must specify a condition under which the notification is sent. For example - job XY reaches status DONE. Currently, one or more JOBID's are required in the condition and only a single occurence of a specific attribute is allowed among ANDed conditions. The condition is then delivered to LB server where it is stored. At the same time, server generates an unique notification ID for such registration and returns it to the user.
-
-The registration exists only for limited amount of time. The validity is returned by LB server together with notification ID when registering. During this period user can attach to server and receive notifications, change conditions which triger notification, prolong validity of the registration, or remove the registration from LB server. For all such operation you have to supply the notification ID.
-
-
-While the registration is valid, user is able repeatable connect to LB server from different places in the net and continue receiving notifications associated with given notification ID. Notifications generated during the time you are not receiving them are stored and waiting when you reconnect. When you reconnect from another place (another IP or PORT), you will receive all not delivered notifications and continue receiving new ones.
-
-
-How does it work?
------------------
-
-The request for notification is delivered to LB server. The notification condition specified in the request is stored in LB database and whenever a new event arrives to the LB server, all notification conditions are tested. Always when some of them is true, corresponding notification is sent.
-
-For a notification delivery, a special deamon, a notification interlogger is used. It stores notifications in files and periodically tries to deliver them to the adress of the last connection of notification client. If the user changes the place (IP or PORT) where the client listens, LB server instuct the notification deamon to change delivery destination of all pending notifications.
-
-
-
-Notification test
------------------
-
-The four steps bellow describe basic testing procedure of the notification
-system by creating a fake job record in the LB server, registering
-a notification on any state change of this job, and forcing the job state
-change.
-
-Our example program 'glite-lb-notify' is used as a notification
-client here. It uses mentioned client API calls to manipulate with
-registrations.
-
-
-1) Register a job
- export EDG_WL_LOG_DESTINATION=HOSTNAME:9002
- ./glite-lb-job_reg -m HOSTNAME:9000 -s UserInterface
-
- -> returns JOBID - used in the next steps
- This creates a new job with status submitted.
-
-
-2) Register notification
- export EDG_WL_NOTIF_SERVER=HOSTNAME:9000
- ./glite-lb-notify test JOBID
-
-
-3) Change status of your job
- export EDG_WL_LOG_DESTINATION=HOSTNAME:9002
- ./glite-lb-running.sh -j JOBID
-
-
-4) Watch incomming notifications.
- You should receive several notification, each correspondig
- with job status change.
-
-
-
-When you let notification client running several minutes without any incomming notification, it will finish and remove your registration from the server automatically.
+++ /dev/null
-.TH GLITE-LB-LOGEV 1 "May 2003" "EU EGEE Project" "Logging&Bookkeeping"
-
-.SH NAME
-glite-lb-logev - program for logging events to L&B subsystem
-
-.SH SYNOPSIS
-.B glite-lb-logev
-.B -s Application -e UserTag
-.B -j
-.I JOBID
-.B -c
-.I SEQCODE
-.B --name
-.I NAME
-.B --value
-.I VALUE
-.br
-
-.SH DESCRIPTION
-.B glite-lb-logev
-is a low-level program for logging events to the L&B service.
-It is used internally by WMS components.
-At the user level it is supposed to be used only for logging user tag events and changing job ACL's in L&B enventually.
-
-.SH USAGE
-Besides
-.I NAME
-and
-.I VALUE
-of the tag, which are user defined, the user has to specify a valid
-.I JOBID\fR,\fP
-and
-.I SEQCODE
-(L&B event sequence code).
-
-The user application is always executed from within a
-.I JobWrapper
-script. The wrapper sets the appropriate JobId in the environment variable
-EDG_WL_JOBID. The user should pass this value to the -j option of
-.B edg-wl-logev.
-
-Similarly, the wrapper sets an initial value of the event sequence code
-in the environment variable EDG_WL_SEQUENCE_CODE.
-If the user application calls
-.B edg-wl-logev
-just once, it is sufficient to pass this value to the -c option.
-However, if there are more subsequent calls, the user is responsible for
-capturing an updated sequence code from the
-.B stdout
-of
-.B edg-wl-logev
-and using it in subsequent calls.
-The L&B design requires the sequence codes in order to be able to sort
-events correctly while not relying on strictly synchronized clocks.
-
-.SH EXAMPLE
-The example bellow is a job consisting of 100 phases.
-A user tag
-.I phase
-is used to log the phase currently being executed.
-Subsequently, the user may monitor execution of the job phases
-as a part of the job status returned by L&B.
-
-.nf
-#!/bin/sh
-
-for p in `seq 1 100`; do
-
- # log the UserTag event
- EDG_WL_SEQUENCE_CODE=`edg-wl-logev -s Application
- -e UserTag
- -j $EDG_WL_JOBID -c $EDG_WL_SEQUENCE_CODE
- --name=phase --value=$p`
-
- # do the actual computation here
-done
-
-.fi
-
-
-
-.SH OTHER OPTIONS
-See command line help (edg-wl-logev -h) for extensive help on all options.
-However, GLITE users should follow the usage shown in SYNOPSIS strictly.
-Logging other events may confuse the L&B service and cause wrong job status
-information to be reported.
-
-.SH FILES
-No configuration files needed.
-
-.SH REPORTING BUGS
-Please, report all bugs to EU EGEE Bug Tracking System located at https://savannah.cern.ch/bugs/?func=additem&group=jra1mdw
-
-.SH SEE ALSO
-.B edg-wl-bkserver\fR(8),\fP edg-wl-interlogd\fR(8),\fP edg-wl-logd\fR(8)
-
-L&B API Reference, DataGrid-01-TED-0139
-
-.SH AUTHOR
-EU DataGrid Work Package 1, CESNET group.
+++ /dev/null
-#ident "$Header$"
-
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include "glite/lb/events_parse.h"
-#include "glite/lb/consumer.h"
-#include "glite/wmsutils/jobid/cjobid.h"
-
-static void free_events(edg_wll_Event *);
-
-static void help(const char* n)
-{
- fprintf(stderr,"usage: %s <jobid> <source>\n", n);
- exit(1);
-}
-
-int main(int argc,char **argv)
-{
- edg_wll_Context ctx;
- char *errt,*errd,*e,a;
- edg_wll_Event *events;
- int i;
- edg_wll_QueryRec jq[2],eq[2];
- edg_wlc_JobId job;
- edg_wll_Source src;
-
- if (argc != 3) help(argv[0]);
-
- puts(
-"*\n"
-"* USE WITH CARE, AT YOUR OWN RISK, UNDER ABNORMAL CONDITIONS ONLY,\n"
-"* AND BE ALWAYS SURE WHAT YOU ARE DOING.\n"
-"* \n"
-"* THIS PROGRAM IS A PERFECT EXAMPLE HOW L&B SEQENCE CODES SHOULD NOT BE USED\n"
-"* IN NORMAL OPERATION.\n"
-"\n"
-"Do you want to proceed?"
- );
-
- scanf("%c",&a);
- if (a != 'y' && a != 'Y') return 1;
-
- edg_wll_InitContext(&ctx);
-
- if (edg_wlc_JobIdParse(argv[1],&job)) {
- fprintf(stderr,"%s: can't parse job ID\n",argv[1]);
- return 1;
- }
-
- if (( src = edg_wll_StringToSource(argv[2])) == EDG_WLL_SOURCE_NONE) {
- fprintf(stderr,"%s: unknown event source\n",argv[2]);
- return 1;
- }
-
- jq[0].attr = EDG_WLL_QUERY_ATTR_JOBID;
- jq[0].op = EDG_WLL_QUERY_OP_EQUAL;
- jq[0].value.j = job;
- jq[1].attr = EDG_WLL_QUERY_ATTR_UNDEF;
-
- eq[0].attr = EDG_WLL_QUERY_ATTR_SOURCE;
- eq[0].op = EDG_WLL_QUERY_OP_EQUAL;
- eq[0].value.i = src;
- eq[1].attr = EDG_WLL_QUERY_ATTR_UNDEF;
-
- if ( edg_wll_QueryEvents(ctx,jq,eq,&events) )
- {
- if ( edg_wll_Error(ctx, &errt, &errd) != E2BIG )
- goto err;
-
- fprintf(stderr,"%s: %s (%s)\n",argv[0],errt,errd);
- }
-
- for ( i = 0; events[i].type != EDG_WLL_EVENT_UNDEF; i++ );
-
- e = edg_wll_UnparseEvent(ctx,events+i-1);
-
- fputs(e,stdout);
- fputs("\n",stdout);
-
- if (edg_wll_SetParam(ctx,EDG_WLL_PARAM_SOURCE,src) ||
- edg_wll_SetLoggingJob(ctx,job,events[i-1].any.seqcode,EDG_WLL_SEQ_NORMAL) ||
- edg_wll_IncSequenceCode(ctx) || /* necessary to simulate this
- * call in last event logging
- * _after_ current seq. was used */
- edg_wll_LogAbort(ctx,"manual abort")) goto err;
-
-
- free(e);
- free_events(events);
-
- edg_wll_FreeContext(ctx);
-
- return 0;
-
-err:
- switch (edg_wll_Error(ctx,&errt,&errd)) {
- case 0: break;
- case ENOENT:
- puts("No events found");
- break;
- default:
- fprintf(stderr,"%s: %s (%s)\n",argv[0],errt,errd);
- return 1;
- }
-
- edg_wll_FreeContext(ctx);
-
- return 0;
-}
-
-static void free_events(edg_wll_Event *events)
-{
- int i;
-
- if (events) {
- for (i=0; events[i].type != EDG_WLL_EVENT_UNDEF; i++) edg_wll_FreeEvent(&(events[i]));
- edg_wll_FreeEvent(&(events[i])); /* free last line */
- free(events);
- events = NULL;
- }
-}
+++ /dev/null
-:ready:
--s JobController,-e Abort,--reason "just to test"
+++ /dev/null
-:running:
--s LogMonitor, -e Done, --status_code=CANCELLED, --reason="reason for the change", --exit_code=0
+++ /dev/null
-#ident "$Header$"
-
-#include <stdio.h>
-#include <unistd.h>
-
-#include "glite/wmsutils/jobid/cjobid.h"
-#include "glite/lb/producer.h"
-#include "glite/lb/authz.h"
-
-void
-usage(const char *me)
-{
- fprintf(stderr,"usage: %s [-r] [-d] [-g] jobid user_id\n"
- "\t-r \tRemove\n"
- "\t-d \tOperation is considered as `allow' by default, if -d is given 'deny' will be used\n"
- "\t-g \tuser_id is treated as DN by default, if -g is given user_id is expectedto be of form VO:group\n",
-
- me);
-}
-
-int
-main(int argc, char *argv[])
-{
- edg_wll_Context ctx;
- int operation = EDG_WLL_ACL_ADD;
- int permission = EDG_WLL_PERM_READ;
- int permission_type = EDG_WLL_PERM_ALLOW;
- int user_id_type = EDG_WLL_USER_SUBJECT;
- edg_wlc_JobId jobid;
- int opt;
- int ret;
-
- if (argc < 3) {
- usage(argv[0]);
- return 1;
- }
-
- while ((opt=getopt(argc, argv, "rdg")) != -1)
- switch(opt) {
- case 'r': operation = EDG_WLL_ACL_REMOVE; break;
- case 'd': permission_type = EDG_WLL_PERM_DENY; break;
- case 'g': user_id_type = EDG_WLL_USER_VOMS_GROUP; break;
- default:
- usage(argv[0]);
- return 1;
- break;
- }
-
- edg_wll_InitContext(&ctx);
-
- if (edg_wlc_JobIdParse(argv[optind], &jobid)) {
- fprintf(stderr,"can't parse job ID\n");
- goto err;
- }
-
- edg_wll_SetParam(ctx, EDG_WLL_PARAM_SOURCE, EDG_WLL_SOURCE_USER_INTERFACE);
-
- ret = edg_wll_ChangeACL(ctx,
- jobid,
- argv[optind+1], user_id_type,
- permission, permission_type,
- operation);
-
- if (ret) {
- char *et, *ed;
- edg_wll_Error(ctx, &et, &ed);
- fprintf(stderr, "%s: edg_wll_LogChangeACL() failed: %s (%s)\n",
- argv[0], et, ed);
- goto err;
- }
-
- edg_wll_FreeContext(ctx);
- return 0;
-
-err:
- edg_wll_FreeContext(ctx);
- return 1;
-}
+++ /dev/null
-# macro definition for DONE state
-
-:running:
--s LRMS, -e Chkpt, --tag=chkpt1, --classad=""
--s LRMS, -e Chkpt, --tag=chkpt2, --classad=""
--s LogMonitor, -e Done, --status_code=OK, --reason="reason for the change", --exit_code=0
+++ /dev/null
-# macro definition for DONE state
-
-:done:
--s LogMonitor, -e Clear, --reason=USER
+++ /dev/null
-/*
- * fake implementation of the consumer API
- */
-
-#include <stddef.h>
-#include <string.h>
-
-#include "glite/lb/consumer.h"
-#include "glite/lb/context-int.h"
-#include "glite/lb/consumer_fake.h"
-
-
-#define NUM_EVENTS 3
-
-
-static edg_wll_QueryEvents_cb_f *QueryEvents_cb = NULL;
-static edg_wll_QueryListener_cb_f *QueryListener_cb = NULL;
-
-
-/* register the query callback */
-int edg_wll_RegisterTestQueryEvents(edg_wll_QueryEvents_cb_f *cb) {
- if (QueryEvents_cb) return 0;
-
- QueryEvents_cb = cb;
- return 1;
-}
-
-
-/* register the listener callback */
-int edg_wll_RegisterTestQueryListener(edg_wll_QueryListener_cb_f *cb) {
- if (QueryListener_cb) return 0;
-
- QueryListener_cb = cb;
- return 1;
-}
-
-
-/* unregister the query callback */
-void edg_wll_UnregisterTestQueryEvents() {
- QueryEvents_cb = NULL;
-}
-
-
-/* unregister the listener callback */
-void edg_wll_UnregisterTestQueryListener() {
- QueryEvents_cb = NULL;
-}
-
-
-/* (belongs to common/src/events.c.T) */
-static void edg_wll_PrepareEvent(edg_wll_EventCode eventcode, edg_wll_Event *event) {
- edg_wll_Event *tmpevent;
-
- // hide not clean code here :-)
- tmpevent = edg_wll_InitEvent(eventcode);
- memcpy(event, tmpevent, sizeof(edg_wll_Event));
- free(tmpevent);
-}
-
-
-/* fake implementation of QueryEvents() */
-int edg_wll_QueryEvents(
- edg_wll_Context context,
- const edg_wll_QueryRec *job_conditions,
- const edg_wll_QueryRec *event_conditions,
- edg_wll_Event **events
-) {
- edg_wll_EventCode event_code;
- int i, j, err;
- edg_wlc_JobId jobid;
-
- edg_wll_ResetError(context);
-
- // determine type of the returned events, ignore _QUERY_OP_*:
- // - asked event type for _QUERY_ATTR_EVENT_TYPE
- // - _EVENT_CHKPT for other
- i = 0;
- while (event_conditions[i].attr != EDG_WLL_QUERY_ATTR_UNDEF && (event_conditions[i].attr != EDG_WLL_QUERY_ATTR_EVENT_TYPE)) i++;
- if (event_conditions[i].attr == EDG_WLL_QUERY_ATTR_UNDEF)
- event_code = EDG_WLL_EVENT_CHKPT;
- else
- event_code = event_conditions[i].value.i;
-
- // create events
- *events = calloc(NUM_EVENTS + 1, sizeof(edg_wll_Event));
- for (i = 0; i < NUM_EVENTS; i++) {
- edg_wll_PrepareEvent(event_code, &(*events)[i]);
- }
- (*events)[NUM_EVENTS].type = EDG_WLL_EVENT_UNDEF;
-
- // adjust events according to the query parameters
- i = 0;
- while (job_conditions[i].attr != EDG_WLL_QUERY_ATTR_UNDEF) {
- if (job_conditions[i].attr == EDG_WLL_QUERY_ATTR_JOBID && job_conditions[i].op == EDG_WLL_QUERY_OP_EQUAL) {
- jobid = job_conditions[i].value.j;
- for (j = 0; j < NUM_EVENTS; j++) {
- if ((err = edg_wlc_JobIdDup(jobid, &(*events)[i].any.jobId)) != 0) goto error;
- }
- break;
- }
- i++;
- }
-
- // adjusting callback
- if (QueryEvents_cb)
- QueryEvents_cb(context, events);
-
- if ((err = edg_wll_Error(context, NULL, NULL)) == 0) return 0;
-
-error:
- i = 0;
- while ((*events)[i].type != EDG_WLL_EVENT_UNDEF) {
- edg_wll_FreeEvent(&(*events)[i]);
- i++;
- }
- free(*events);
-
- return edg_wll_SetError(context, err, NULL);
-}
-
-
-/* fake implementation of QueryListener() */
-int edg_wll_QueryListener(
- edg_wll_Context context,
- edg_wlc_JobId jobId,
- const char *name,
- char **host,
- uint16_t *port
-) {
- edg_wll_ResetError(context);
-
- if (QueryListener_cb) return QueryListener_cb(context, host, port);
- else {
- *host = strdup("localhost");
- *port = 12345;
-
- return edg_wll_Error(context, NULL, NULL);
- }
-}
-
-
-/* cut'nd pasted from consumer.c */
-int edg_wll_JobLog(
- edg_wll_Context ctx,
- edg_wlc_JobId job,
- edg_wll_Event **eventsOut)
-{
- edg_wll_QueryRec j[2], e[2];
-
- memset(j,0,sizeof j);
- memset(e,0,sizeof e);
-
- j[0].attr = EDG_WLL_QUERY_ATTR_JOBID;
- j[0].op = EDG_WLL_QUERY_OP_EQUAL;
- j[0].value.j = job;
-
- e[0].attr = EDG_WLL_QUERY_ATTR_LEVEL;
- e[0].op = EDG_WLL_QUERY_OP_LESS;
- e[0].value.i = ctx->p_level + 1;
-
- return edg_wll_QueryEvents(ctx,j,e,eventsOut);
-}
+++ /dev/null
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-#include <fcntl.h>
-
-#include "glite/wmsutils/jobid/cjobid.h"
-#include "glite/lb/producer.h"
-#include "glite/lb/events.h"
-
-extern char *optarg;
-extern int opterr,optind;
-
-static void usage(char *me)
-{
- fprintf(stderr,"usage: %s -m bkserver -n num_subjobs [-s seed]\n", me);
-}
-
-int main(int argc, char *argv[])
-{
- char *seed = "seed", *server = NULL,*p;
- int done = 0,num_subjobs = 0,i;
- edg_wll_Context ctx;
- edg_wlc_JobId jobid,*subjobs;
-
-
- edg_wll_InitContext(&ctx);
- opterr = 0;
-
- do {
- switch (getopt(argc,argv,"m:n:s:")) {
- case 's': seed = strdup(optarg); break;
- case 'm': server = strdup(optarg); break;
- case 'n': num_subjobs = atoi(optarg); break;
- case '?': usage(argv[0]); exit(EINVAL);
- case -1: done = 1; break;
- }
- } while (!done);
-
- if (!server) {
- fprintf(stderr,"%s: -m server required\n",argv[0]);
- exit(1);
- }
-
- if (!num_subjobs) {
- fprintf(stderr,"%s: -n num_subjobs required\n",argv[0]);
- exit(1);
- }
-
- p = strchr(server,':');
- if (p) *p=0;
- edg_wlc_JobIdCreate(server,p?atoi(p+1):0,&jobid);
- printf("seed=\"%s\"\nnodes=%d\ndag=\"%s\"\n",seed,num_subjobs,edg_wlc_JobIdUnparse(jobid));
-
- edg_wll_GenerateSubjobIds(ctx,jobid,num_subjobs,seed,&subjobs);
-
- for (i=0; i<num_subjobs; i++) printf("node[%d]=\"%s\"\n",i,edg_wlc_JobIdUnparse(subjobs[i]));
-
- return 0;
-}
+++ /dev/null
-# macro definition for DONE state
-
-:running:
--s LogMonitor, -e Done, --status_code=OK, --reason="reason for the change", --exit_code=0
+++ /dev/null
-# macro definition for DONE state
-
-:running_dag:
--s LogMonitor, -e Done, --status_code=OK, --reason="reason for the change", --exit_code=0
+++ /dev/null
-# macro definition for DONE state
-
-:running_subjob:
--s LogMonitor, -e Done, --status_code=OK, --reason="reason for the change", --exit_code=0
+++ /dev/null
-:running_dag:
-
--s LogMonitor, -e Done, --status_code=Failed, --exit_code=1, --reason=shit
+++ /dev/null
-:running_subjob:
-
--s LogMonitor, -e Done, --status_code=Failed, --exit_code=1, --reason=shit
+++ /dev/null
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <time.h>
-#include <assert.h>
-#include <errno.h>
-#include <sysexits.h>
-
-#include "glite/lb/notification.h"
-
-static void usage(const char *);
-static void printstat(edg_wll_JobStat, int);
-
-int main(int argc,char *argv[])
-{
- int o;
- edg_wll_Context ctx;
- edg_wll_NotifId notif;
- time_t valid = 0;
- struct timeval timeout;
-
- edg_wll_InitContext(&ctx);
-
-/* parse options, reflect them in the LB context */
- while ((o = getopt(argc,argv,"s:")) >= 0) switch (o) {
- case 's': {
- char *server = strdup(optarg),
- *port_s = strchr(server,':');
-
- int port;
-
- if (port_s) {
- *port_s = 0;
- port = atoi(port_s+1);
- }
-
- edg_wll_SetParam(ctx,EDG_WLL_PARAM_NOTIF_SERVER,server);
- if (port_s) edg_wll_SetParam(ctx,EDG_WLL_PARAM_NOTIF_SERVER_PORT,port);
- free(server);
- } break;
-
- case '?': usage(argv[0]); exit(EX_USAGE);
- }
-
-/* no notification Id supplied -- create a new one */
- if (argc == optind) {
- edg_wll_QueryRec const *empty[] = { NULL };
- char *notif_s;
-
- if (edg_wll_NotifNew(ctx,empty,-1,NULL,¬if,&valid)) {
- char *et,*ed;
-
- edg_wll_Error(ctx,&et,&ed);
- fprintf(stderr,"edg_wll_NotifNew(): %s (%s)\n",et,ed);
- exit(EX_UNAVAILABLE);
- }
-
- notif_s = edg_wll_NotifIdUnparse(notif);
- printf("notification registered:\n\tId: %s\n\tExpires: %s",
- notif_s,ctime(&valid));
- free(notif_s);
- }
-/* notification Id supplied -- bind to it */
- else if (argc == optind + 1) {
- if (edg_wll_NotifIdParse(argv[optind],¬if)) {
- fprintf(stderr,"%s: invalid notification Id\n",
- argv[optind]);
- exit(EX_DATAERR);
- }
-
- if (edg_wll_NotifBind(ctx,notif,-1,NULL,&valid)) {
- char *et,*ed;
-
- edg_wll_Error(ctx,&et,&ed);
- fprintf(stderr,"edg_wll_NotifBind(): %s (%s)\n",et,ed);
- exit(EX_UNAVAILABLE);
- }
- printf("bound to %s\n\t Expires: %s",argv[optind],ctime(&valid));
- }
- else { usage(argv[0]); exit(EX_USAGE); }
-
-/* main loop */
- while (1) {
- edg_wll_JobStat stat;
- char *et,*ed;
-
-/* calculate time left for this notification */
- gettimeofday(&timeout,NULL);
- timeout.tv_sec = valid - timeout.tv_sec;
- assert(timeout.tv_sec >= 0); /* XXX: hope we are no late */
-
-/* half time before notification renewal */
- timeout.tv_sec /= 2;
-
- switch (edg_wll_NotifReceive(ctx,-1,&timeout,&stat,NULL)) {
- case 0: /* OK, got it */
- printstat(stat,0);
- edg_wll_FreeStatus(&stat);
- break;
- case EAGAIN: /* timeout */
- if (edg_wll_NotifRefresh(ctx,notif,&valid)) {
- edg_wll_Error(ctx,&et,&ed);
- fprintf(stderr,"edg_wll_NotifRefresh(): %s (%s)\n",et,ed);
- exit(EX_UNAVAILABLE);
- }
- printf("Notification refreshed, expires %s",ctime(&valid));
- break;
- default:
- edg_wll_Error(ctx,&et,&ed);
- fprintf(stderr,"edg_wll_NotifReceive(): %s (%s)\n",et,ed);
- exit(EX_UNAVAILABLE);
- }
- }
-}
-
-
-static void usage(const char *me)
-{
- fprintf(stderr,"usage: %s [ -s server[:port] ] [notif_id]\n",me);
-}
-
-
-
-static void printstat(edg_wll_JobStat stat, int level)
-{
- char *s, *j, ind[10];
- int i;
-
-
- for (i=0; i < level; i++)
- ind[i]='\t';
- ind[i]='\0';
-
- s = edg_wll_StatToString(stat.state);
-/* print whole flat structure */
- printf("%sstate : %s\n", ind, s);
- printf("%sjobId : %s\n", ind, j = edg_wlc_JobIdUnparse(stat.jobId));
- printf("%sowner : %s\n", ind, stat.owner);
- printf("%sjobtype : %s\n", ind, (stat.jobtype ? "DAG" : "SIMPLE") );
- printf("%sparent_job : %s\n", ind,
- j = edg_wlc_JobIdUnparse(stat.parent_job));
- if (stat.jobtype) {;
- printf("%sseed : %s\n", ind, stat.seed);
- printf("%schildren_num : %d\n", ind, stat.children_num);
- printf("%schildren :\n", ind);
- if (stat.children)
- for (i=0; stat.children[i]; i++)
- printf("%s\tchildren : %s\n", ind, stat.children[i]);
- printf("%schildren_states :\n", ind);
- if (stat.children_states)
- for (i=0; stat.children_states[i].state; i++)
- printstat(stat.children_states[i], level+1);
- printf("%schildren_hist :\n",ind);
- if (stat.children_hist)
- for (i=1; i<=stat.children_hist[0]; i++)
- printf("%s%14s %d\n", ind, edg_wll_StatToString(i-1),stat.children_hist[i]);
- }
- printf("%scondorId : %s\n", ind, stat.condorId);
- printf("%sglobusId : %s\n", ind, stat.globusId);
- printf("%slocalId : %s\n", ind, stat.localId);
- printf("%sjdl : %s\n", ind, stat.jdl);
- printf("%smatched_jdl : %s\n", ind, stat.matched_jdl);
- printf("%sdestination : %s\n", ind, stat.destination);
- printf("%snetwork server : %s\n", ind, stat.network_server);
- printf("%scondor_jdl : %s\n", ind, stat.condor_jdl);
- printf("%srsl : %s\n", ind, stat.rsl);
- printf("%sreason : %s\n", ind, stat.reason);
- printf("%slocation : %s\n", ind, stat.location);
- printf("%ssubjob_failed : %d\n", ind, stat.subjob_failed);
- printf("%sdone_code : %d\n", ind, stat.done_code);
- printf("%sexit_code : %d\n", ind, stat.exit_code);
- printf("%sresubmitted : %d\n", ind, stat.resubmitted);
- printf("%scancelling : %d\n", ind, stat.cancelling);
- printf("%scancelReason : %s\n", ind, stat.cancelReason);
- printf("%scpuTime : %d\n", ind, stat.cpuTime);
- printf("%suser_tags :\n",ind);
- if (stat.user_tags)
- for (i=0; stat.user_tags[i].tag; i++) printf("%s%14s = \"%s\"\n", ind,
- stat.user_tags[i].tag,stat.user_tags[i].value);
- printf("%sstateEnterTime : %ld.%06ld\n", ind, stat.stateEnterTime.tv_sec,stat.stateEnterTime.tv_usec);
- printf("%sstateEnterTimes : \n",ind);
- if (stat.stateEnterTimes)
- for (i=1; i<=stat.stateEnterTimes[0]; i++)
- printf("%s%14s %s", ind, edg_wll_StatToString(i-1), (stat.stateEnterTimes[i] == 0) ?
- " - not available -\n" : ctime((time_t *) &stat.stateEnterTimes[i]));
- printf("%slastUpdateTime : %ld.%06ld\n", ind, stat.lastUpdateTime.tv_sec,stat.lastUpdateTime.tv_usec);
- printf("%sexpectUpdate : %d\n", ind, stat.expectUpdate);
- printf("%sexpectFrom : %s\n", ind, stat.expectFrom);
- printf("%sacl : %s\n", ind, stat.acl);
- printf("\n");
-
- free(j);
- free(s);
-}
+++ /dev/null
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-
-#include "glite/lb/producer.h"
-#include "glite/wmsutils/jobid/cjobid.h"
-
-static void slave();
-
-int main(int argc,char **argv)
-{
- int i,nproc;
-
- if (argc != 2) {
- fprintf(stderr,"usage: %s nproc\n",argv[0]);
- return 1;
- }
-
- nproc = atoi(argv[1]);
- if (nproc < 1) {
- fprintf(stderr,"%s: nproc must be >= 1\n",argv[0]);
- return 1;
- }
-
- for (i=0; i<nproc; i++) {
- switch (fork()) {
- case -1: perror("fork()"); return 1;
- case 0: slave();
- default: break;
- }
- }
-
- while (nproc) {
- int stat;
- wait(&stat);
- if (WIFEXITED(stat)) nproc--;
- }
-
- puts("done");
- return 0;
-}
-
-
-static void slave()
-{
- edg_wll_Context ctx;
- edg_wlc_JobId job;
- int i,pid = getpid(),noent = 0;
-
- for (i=0; i<100; i++) {
- int err;
- char *et,*ed;
-
- edg_wll_InitContext(&ctx);
- edg_wlc_JobIdParse("https://fake.server/fakejob",&job);
-
- if ((err = edg_wll_SetLoggingJobProxy(ctx,job,NULL,"some user",0))) edg_wll_Error(ctx,&et,&ed);
- else et = ed = "none";
-
- printf("[%d] %d: %s (%s)\n",pid,i,
- err == 0 || err == ENOENT ? "OK" : et,
- ed);
-
- if (err == ENOENT) noent++;
-
- edg_wll_LogUserTagProxy(ctx,"test","x");
-
- edg_wll_FreeContext(ctx);
- }
- printf("[%d] done, ENOENTs %d\n",pid,noent);
- exit(0);
-}
+++ /dev/null
-#!/bin/sh
-# script for generating sample jobs
-
-if test ! -z "$FAKE"; then
- SUFFIX="_fake"
-fi
-if [ `echo $(basename $0) | grep 'glite-lb-' | wc -l` = "1" ]; then
- PREFIX=glite-lb-
-fi
-LOGFD=${LOGFD:-2}
-if [ -d `dirname $0`/../bin ]; then
- BINDIR=`dirname $0`/../bin
-else
- BINDIR=`dirname $0`
-fi
-LOGEV=${LOGEV:-${BINDIR}/${PREFIX}logevent}${SUFFIX}
-JOB_REG=${JOB_REG:-`dirname $0`/${PREFIX}job_reg}${SUFFIX}
-EDG_JOBID=
-LBPROXY=
-LBPROXY_STORE_SOCK=
-LARGE_STRESS=
-
-usage()
-{
- echo "Usage : $0 [-x | -X store_socket_path] [-m bkserver_machine_name][-j job_id][-l size_of_random_data]"
- exit 4
-}
-
-# read parameters
-while test -n "$1"
-do
- case "$1" in
- "-m") shift; BKSERVER_HOST="$1" ;;
- "-x") LBPROXY="-x" ;;
- "-X") shift; LBPROXY="-x"; LBPROXY_STORE_SOCK="-S $1" ;;
- "-j") shift; EDG_JOBID="$1" ;;
- "-l") shift; LARGE_STRESS="-l $1" ;;
- "*") usage ;;
- esac
- shift
-done
-
-test \( -z "$BKSERVER_HOST" \) -a \( -z "$EDG_JOBID" \) && usage
-
-if [ -z "$EDG_JOBID" ]
-then
- # initial sequence code & jobid (normaly returned by job_reg)
- EDG_JOBID=
- SCRIPT=`$JOB_REG $LBPROXY -m $BKSERVER_HOST -s UserInterface | tail -n 2`
- eval $SCRIPT
- test -z "$EDG_JOBID" && exit 4
- echo EDG_JOBID=$EDG_JOBID
-else
- test -z "$EDG_WL_SEQUENCE" && EDG_WL_SEQUENCE="UI=000003:NS=0000000000:WM=000000:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000:LBS=000000"
-fi
-
-send_log_ev()
-{
- echo $LOGEV $LBPROXY $LBPROXY_STORE_SOCK -j "$EDG_JOBID" -c "$EDG_WL_SEQUENCE" "$@" 1>&$LOGFD
- EDG_WL_SEQUENCE=`$LOGEV $LARGE_STRESS $LBPROXY $LBPROXY_STORE_SOCK -j $EDG_JOBID -c $EDG_WL_SEQUENCE "$@" 2>/dev/null`
- test $? -ne 0 -o -z "$EDG_WL_SEQUENCE" && exit 4
- true
-}
-
+++ /dev/null
-#!/bin/sh
-
-me=$0
-mydir=`dirname $0`;
-export me mydir
-
-
-set -- `getopt n $*`
-# test whether it is recursive call
-
-NESTED="-v nested=0"
-while [ $1 != '--' ]; do case $1 in
- -n) NESTED="-v nested=1"; shift ;;
-esac; done
-shift
-
-awk -F, $NESTED \
-'BEGIN {
- if (nested==0) system("cat $mydir/gen_begin");
- OFS = ",";
- nlines = 0;
-}
-/^#/ || /^[ ]*$/ { next; }
-{
- source = $2;
-
- event = $1;
-
- nline++;
-}
-# events processing
-
-/-e Transfer/ { logit();
- next;}
-
-/-e Accepted/ { if (checkNOP(7) == 0) logit();
- next;}
-
-/-e Refused/ { if (checkNOP(6) == 0) logit();
- next;}
-
-/-e EnQueued/ { if (checkNOP(6) == 0) logit();
- next;}
-
-/-e DeQueued/ { if (checkNOP(4) == 0) logit();
- next;}
-
-/-e HelperCall/ { if (checkNOP(5) == 0) logit();
- next;}
-
-/-e HelperReturn/ { if (checkNOP(5) == 0) logit();
- next;}
-
-/-e Running/ { if (checkNOP(3) == 0) logit();
- next;}
-
-/-e Resubmission/ { if (checkNOP(5) == 0) logit();
- next;}
-
-/-e Done/ { if (checkNOP(5) == 0) logit();
- next;}
-
-/-e Cancel/ { if (checkNOP(4) == 0) logit();
- next;}
-
-/-e Abort/ { if (checkNOP(3) == 0) logit();
- next;}
-
-/-e Clear/ { if (checkNOP(3) == 0) logit();
- next;}
-
-/-e Purge/ { if (checkNOP(2) == 0) logit();
- next;}
-
-/-e Match/ { if (checkNOP(3) == 0) logit();
- next;}
-
-/-e Pending/ { if (checkNOP(3) == 0) logit();
- next;}
-
-/-e RegJob/ { if (checkNOP(7) == 0) logit();
- next;}
-
-/-e Chkpt/ { if (checkNOP(4) == 0) logit();
- next;}
-
-/-e Listener/ { if (checkNOP(5) == 0) logit();
- next;}
-
-/-e CurDescr/ { if (checkNOP(3) == 0) logit();
- next;}
-
-/-e UserTag/ { if (checkNOP(4) == 0) logit();
- next;}
-
-/-e ReallyRunning/ { if (checkNOP(3) == 0) logit();
- next;}
-
-# shell escape (for sequence number branching)
-
-/^!/ { print substr($0,2,(length($0) - 1)); }
-
-# macro processing - macro name starts and ends with ':'
-# in a file gen_MACRONAME.txt is the macro describtion
-
-/^:.*:$/ {system("$me -n $mydir/"substr($1,2,(length($1) - 2))".l" )}
-
-
-function checkNOP(NOP)
-{
- if (NF != NOP) { print nline" : "$2": "NOP" args required ("NF" supplied)" > "/dev/stderr"; return 1 }
- else return 0;
-}
-
-function logit()
-{
- split($0,f);
-
- ff = "";
- for (i=1; i<=NF; i++) ff = ff " " f[i];
-
- print "send_log_ev" ff;
-}
-' $1
-
+++ /dev/null
-#ident "$Header$"
-
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include "glite/lb/events_parse.h"
-#include "glite/lb/consumer.h"
-#include "glite/wmsutils/jobid/cjobid.h"
-#ifdef USE_CALLBACKS
- #include "glite/lb/consumer_fake.h"
-#endif
-
-static void free_events(edg_wll_Event *);
-
-static void help(const char* n)
-{
- fprintf(stderr,"usage: %s [-r repeat] [-d delay] [ -x ] <jobid>\n", n);
- exit(1);
-}
-
-#ifdef USE_CALLBACKS
-static int query_events_cb(edg_wll_Context context, edg_wll_Event **events) {
- int i;
- edg_wll_Event *event;
-
- i = 0;
- while ((event = (*events) + i)->type != EDG_WLL_EVENT_UNDEF) {
- event->any.timestamp.tv_sec = (double)rand() / RAND_MAX * 1000000000;
- event->any.timestamp.tv_usec = (double)rand() / RAND_MAX * 1000000;
- i++;
- }
-
- return 0;
-}
-#endif
-
-int main(int argc,char **argv)
-{
- edg_wll_Context ctx;
- char *errt,*errd;
- edg_wll_Event *events = NULL;
- edg_wlc_JobId job;
- int i,opt,delay = 1,count = 0, proxy = 0;
-
- if (argc < 2)
- help(argv[0]);
-
- while ((opt=getopt(argc,argv,"r:d:x")) != -1)
- switch (opt) {
- case 'd': delay = atoi(optarg); break;
- case 'r': count = atoi(optarg); break;
- case 'x': proxy = 1; break;
- default:
- help(argv[0]);
- }
-
- edg_wll_InitContext(&ctx);
- if (edg_wlc_JobIdParse(argv[optind],&job)) {
- fprintf(stderr,"%s: can't parse job ID\n",argv[1]);
- return 1;
- }
-
-#ifdef USE_CALLBACKS
- edg_wll_RegisterTestQueryEvents(query_events_cb);
-#endif
-
- if ( proxy ? edg_wll_JobLogProxy(ctx,job,&events) : edg_wll_JobLog(ctx,job,&events) )
- {
- edg_wll_Error(ctx,&errt,&errd);
- fprintf(stderr,"%s: %s (%s)\n",argv[0],errt,errd);
- }
-
- for ( i = 0; events && events[i].type != EDG_WLL_EVENT_UNDEF; i++ )
- {
- char *e = edg_wll_UnparseEvent(ctx,events+i);
- fputs(e,stdout);
- fputs("\n",stdout);
- free(e);
- }
-
- free_events(events);
- printf("\nFound %d events\n",i);
-
- while (count--) {
- puts("Sleeping ...");
- sleep(delay);
- if (proxy ? edg_wll_JobLogProxy(ctx,job,&events) : edg_wll_JobLog(ctx,job,&events)) {
- edg_wll_Error(ctx,&errt,&errd);
- fprintf(stderr,"%s: %s (%s)\n",argv[0],errt,errd);
- free(errt); free(errd); errt = errd = NULL;
- free_events(events);
- }
- else puts("OK");
- }
-
- edg_wlc_JobIdFree(job);
- edg_wll_FreeContext(ctx);
-
-#ifdef USE_CALLBACKS
- edg_wll_UnregisterTestQueryEvents();
-#endif
-
- return 0;
-
-err:
-#ifdef USE_CALLBACKS
- edg_wll_UnregisterTestQueryEvents();
-#endif
- switch (edg_wll_Error(ctx,&errt,&errd)) {
- case 0: break;
- case ENOENT:
- puts("No events found");
- break;
- default:
- fprintf(stderr,"%s: %s (%s)\n",argv[0],errt,errd);
- return 1;
- }
-
- edg_wlc_JobIdFree(job);
- edg_wll_FreeContext(ctx);
-
- return 0;
-}
-
-static void free_events(edg_wll_Event *events)
-{
- int i;
-
- if (events) {
- for (i=0; events[i].type != EDG_WLL_EVENT_UNDEF; i++) edg_wll_FreeEvent(&(events[i]));
- edg_wll_FreeEvent(&(events[i])); /* free last line */
- free(events);
- events = NULL;
- }
-}
+++ /dev/null
-/* sample how to use fake testing library instead glite_lb_client */
-
-#include <iostream>
-
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/CompilerOutputter.h>
-#include <cppunit/extensions/TestFactoryRegistry.h>
-#include <cppunit/ui/text/TestRunner.h>
-
-#include "glite/lb/consumer_fake.h"
-
-class JobLogFakeExample: public CppUnit::TestFixture {
- CPPUNIT_TEST_SUITE(JobLogFakeExample);
- CPPUNIT_TEST(testWithFake);
- CPPUNIT_TEST_SUITE_END();
-
-private:
- static int query_events_cb(edg_wll_Context context, edg_wll_Event **events) {
- return edg_wll_SetError(context, ENOENT, "Some error");
- }
-
-public:
-
- void testWithFake(void) {
- edg_wll_Context ctx;
- edg_wlc_JobId job;
- edg_wll_Event *events;
-
- edg_wll_InitContext(&ctx);
- CPPUNIT_ASSERT(edg_wlc_JobIdParse("https://localhost:9000/someid", &job) == 0);
-
- CPPUNIT_ASSERT(edg_wll_JobLog(ctx, job, &events) == 0);
- freeEvents(events);
-
- edg_wll_RegisterTestQueryEvents(&query_events_cb);
- CPPUNIT_ASSERT(edg_wll_JobLog(ctx, job, &events) != 0);
- // no events disposed here (they are deallocated on error)
-
- edg_wll_UnregisterTestQueryEvents();
- edg_wlc_JobIdFree(job);
- edg_wll_FreeContext(ctx);
- }
-
-private:
-
- /* free returned events
- */
- void freeEvents(edg_wll_Event *events) {
- int i;
-
- i = 0;
- while (events[i].type != EDG_WLL_EVENT_UNDEF) {
- edg_wll_FreeEvent(&events[i]);
- i++;
- }
- free(events);
- }
-
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(JobLogFakeExample);
-
-int main(void) {
- CppUnit::Test *suite;
- CppUnit::TextUi::TestRunner runner;
-
- suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
- runner.addTest(suite);
-
- return runner.run() ? 0 : 1;
-}
+++ /dev/null
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-#include <fcntl.h>
-
-#include "glite/wmsutils/jobid/cjobid.h"
-#include "glite/lb/producer.h"
-#include "glite/lb/events.h"
-
-extern char *optarg;
-extern int opterr,optind;
-
-static void usage(char *me)
-{
- fprintf(stderr,"usage: %s [-m bkserver] [-x] [-j dg_jobid] [-s source_id] [-n num_subjobs [-S][-C]] [-l jdl_file] [-e seed]\n", me);
-}
-
-int main(int argc, char *argv[])
-{
- char *src = NULL,*job = NULL,*server = NULL,*seq,*jdl = NULL, *seed = NULL;
- int lbproxy = 0;
- int done = 0,num_subjobs = 0,reg_subjobs = 0,i, collection = 0, pbs=0;
- edg_wll_Context ctx;
- edg_wlc_JobId jobid,*subjobs;
-
-
- edg_wll_InitContext(&ctx);
- opterr = 0;
-
- do {
- switch (getopt(argc,argv,"xs:j:m:n:SCl:e:P")) {
- case 'x': lbproxy = 1; break;
- case 's': src = (char *) strdup(optarg); break;
- case 'j': job = (char *) strdup(optarg); break;
- case 'm': server = strdup(optarg); break;
- case 'n': num_subjobs = atoi(optarg); break;
- case 'S': if (num_subjobs>0) { reg_subjobs = 1; break; }
- case 'C': if (num_subjobs>0) { collection = 1; break; }
- case 'P': pbs = 1; break;
- case 'l': jdl = (char *) strdup(optarg); break;
- case 'e': seed = strdup(optarg); break;
- case '?': usage(argv[0]); exit(EINVAL);
- case -1: done = 1; break;
- }
- } while (!done);
-
- if (!job && !server) {
- fprintf(stderr,"%s: either -m server or -j jobid has to be specified\n",argv[0]);
- exit(1);
- }
-
- if (!src) {
- fprintf(stderr,"%s: -s required\n",argv[0]);
- exit(1);
- }
-
- if (!job) {
- char *p = strchr(server,':');
- if (p) *p=0;
- edg_wlc_JobIdCreate(server,p?atoi(p+1):0,&jobid);
- job = edg_wlc_JobIdUnparse(jobid);
- printf("new jobid: %s\n",job);
- }
- else if ((errno = edg_wlc_JobIdParse(job,&jobid))) {
- perror(job);
- exit(1);
- }
-
- if (jdl) {
- int f = open(jdl,O_RDONLY,0);
- off_t l,p,c;
-
- if (f<0) { perror(jdl); exit(1); }
- l = lseek(f,0,SEEK_END);
- lseek(f,0,SEEK_SET);
-
- jdl = malloc(l+1);
-
- for (p=0; p < l && (c = read(f,jdl+p,l-p)) > 0; p += c);
- if (c<0) {
- perror("read()");
- exit (1);
- }
- jdl[p] = 0;
- }
-
- edg_wll_SetParam(ctx,EDG_WLL_PARAM_SOURCE,edg_wll_StringToSource(src));
- if (lbproxy) {
- if (edg_wll_RegisterJobProxy(ctx,jobid,
- pbs ? EDG_WLL_REGJOB_PBS
- : (num_subjobs ?
- (collection?EDG_WLL_REGJOB_COLLECTION:EDG_WLL_REGJOB_DAG)
- :EDG_WLL_REGJOB_SIMPLE
- ),
- jdl ? jdl : "blabla", "NNNSSSS",
- num_subjobs,seed,&subjobs))
- {
- char *et,*ed;
- edg_wll_Error(ctx,&et,&ed);
- fprintf(stderr,"edg_wll_RegisterJobProxy(%s): %s (%s)\n",job,et,ed);
- exit(1);
- }
- } else {
- if (edg_wll_RegisterJobSync(ctx,jobid,
- pbs ? EDG_WLL_REGJOB_PBS
- : (num_subjobs ?
- (collection?EDG_WLL_REGJOB_COLLECTION:EDG_WLL_REGJOB_DAG)
- :EDG_WLL_REGJOB_SIMPLE
- ),
- jdl ? jdl : "blabla", "NNNSSSS",
- num_subjobs,seed,&subjobs))
- {
- char *et,*ed;
- edg_wll_Error(ctx,&et,&ed);
- fprintf(stderr,"edg_wll_RegisterJobSync(%s): %s (%s)\n",job,et,ed);
- exit(1);
- }
- }
-
- seq = edg_wll_GetSequenceCode(ctx);
- printf("\n%s=\"%s\"\n",num_subjobs?(collection?"EDG_WL_COLLECTION_JOBID":"EDG_WL_DAG_JOBID"):"EDG_JOBID",job);
- printf("EDG_WL_SEQUENCE=\"%s\"\n",seq);
- free(seq);
- free(job);
-
- if (num_subjobs) for (i=0; subjobs[i]; i++) {
- char *job_s = edg_wlc_JobIdUnparse(subjobs[i]);
- printf("EDG_WL_SUB_JOBID[%d]=\"%s\"\n",i,job_s);
- free(job_s);
- }
-
- if (reg_subjobs) {
- char ** jdls = (char**) calloc(num_subjobs+1, sizeof(char*));
-
- for (i=0; subjobs[i]; i++) {
- asprintf(jdls+i, "JDL of subjob #%d\n", i+1);
- }
-
- if (lbproxy) {
- if (edg_wll_RegisterSubjobsProxy(ctx, jobid, (const char **) jdls, NULL, subjobs)) {
- char *et,*ed;
- edg_wll_Error(ctx,&et,&ed);
- fprintf(stderr,"edg_wll_RegisterSubjobsProxy: %s (%s)\n", et, ed);
- exit(1);
- }
- } else {
- if (edg_wll_RegisterSubjobs(ctx, jobid, (const char **) jdls, NULL, subjobs)) {
- char *et,*ed;
- edg_wll_Error(ctx,&et,&ed);
- fprintf(stderr,"edg_wll_RegisterSubjobs: %s (%s)\n", et, ed);
- exit(1);
- }
- }
-
- for (i=0; subjobs[i]; i++) free(jdls[i]);
- }
-
- edg_wll_FreeContext(ctx);
-
- return 0;
-}
+++ /dev/null
-#ident "$Header$"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <time.h>
-
-#include <expat.h>
-
-#include "glite/lb/context-int.h"
-#include "glite/lb/consumer.h"
-#include "glite/lb/xml_conversions.h"
-
-static void dgerr(edg_wll_Context,char *);
-static void printstat(edg_wll_JobStat,int);
-
-#define MAX_SERVERS 20
-
-static char *myname;
-
-static void usage(char *);
-static int query_all(edg_wll_Context, edg_wll_JobStat **, edg_wlc_JobId **);
-
-int main(int argc,char *argv[])
-{
- edg_wll_Context sctx[MAX_SERVERS];
- char *servers[MAX_SERVERS];
- int i, result=0, nsrv=0, histflags = 0;
-
-
- myname = argv[0];
- printf("\n");
-
- if ( argc < 2 || strcmp(argv[1],"--help") == 0 ) { usage(argv[0]); return 0; }
-
- if ( edg_wll_InitContext(&sctx[0]) ) {
- fprintf(stderr,"cannot initialize edg_wll_Context\n");
- exit(1);
- }
-
- if ( !strcmp(argv[1], "-all" ) ) {
- edg_wll_JobStat *statesOut;
- edg_wlc_JobId *jobsOut;
-
- jobsOut = NULL;
- statesOut = NULL;
- if ( (result = query_all(sctx[0], &statesOut, &jobsOut)) ) dgerr(sctx[0], "edg_wll_QueryJobs");
- else for ( i = 0; statesOut[i].state; i++ ) printstat(statesOut[i],0);
-
- if ( jobsOut ) {
- for (i=0; jobsOut[i]; i++) edg_wlc_JobIdFree(jobsOut[i]);
- free(jobsOut);
- }
- if ( statesOut ) {
- for (i=0; statesOut[i].state; i++) edg_wll_FreeStatus(&statesOut[i]);
- free(statesOut);
- }
- edg_wll_FreeContext(sctx[0]);
-
- return result;
- }
-
- if ( !strcmp(argv[1], "-x") ) {
- edg_wlc_JobId job;
- edg_wll_JobStat status;
-
- if ( argc < 3 ) { usage(argv[0]); return 1; }
- if ( edg_wll_InitContext(&sctx[0]) ) {
- fprintf(stderr,"%s: cannot initialize edg_wll_Context\n",myname);
- exit(1);
- }
- edg_wll_SetParam(sctx[0], EDG_WLL_PARAM_LBPROXY_SERVE_SOCK, argv[2]);
- for ( i = 3; i < argc; i++ ) {
- memset(&status, 0, sizeof status);
- if (edg_wlc_JobIdParse(argv[i],&job)) {
- fprintf(stderr,"%s: %s: cannot parse jobId\n", myname, argv[i]);
- continue;
- }
- if ( edg_wll_JobStatusProxy(sctx[0], job, EDG_WLL_STAT_CLASSADS | EDG_WLL_STAT_CHILDREN | EDG_WLL_STAT_CHILDSTAT, &status)) {
- dgerr(sctx[0], "edg_wll_JobStatusProxy"); result = 1;
- } else printstat(status, 0);
-
- if ( job ) edg_wlc_JobIdFree(job);
- if ( status.state ) edg_wll_FreeStatus(&status);
- }
- edg_wll_FreeContext(sctx[0]);
-
- return result;
- }
-
- for ( i = 1; i < argc; i++ ) {
- if ( !strcmp(argv[i], "-fullhist") ) {
- histflags = EDG_WLL_STAT_CHILDHIST_THOROUGH;
- printf("\nFound a FULLHIST flag\n\n");
- }
-
- if ( !strcmp(argv[i], "-fasthist") ) {
- histflags = EDG_WLL_STAT_CHILDHIST_FAST;
- printf("\nFound a FASTHIST flag\n\n");
- }
- }
-
- for ( i = 1; i < argc; i++ ) {
- int j;
- char *bserver;
- edg_wlc_JobId job;
- edg_wll_JobStat status;
-
- memset(&status,0,sizeof status);
-
- if ((strcmp(argv[i], "-fullhist"))&&(strcmp(argv[i], "-fasthist"))) {
- if (edg_wlc_JobIdParse(argv[i],&job)) {
- fprintf(stderr,"%s: %s: cannot parse jobId\n", myname,argv[i]);
- continue;
- }
- bserver = edg_wlc_JobIdGetServer(job);
- if (!bserver) {
- fprintf(stderr,"%s: %s: cannot extract bookkeeping server address\n", myname,argv[i]);
- edg_wlc_JobIdFree(job);
- continue;
- }
- for ( j = 0; j < nsrv && strcmp(bserver, servers[j]); j++ );
- if ( j == nsrv ) {
- if ( i > 0 ) edg_wll_InitContext(&sctx[j]);
- nsrv++;
- servers[j] = bserver;
- }
-
- if (edg_wll_JobStatus(sctx[j], job, EDG_WLL_STAT_CLASSADS | EDG_WLL_STAT_CHILDREN | EDG_WLL_STAT_CHILDSTAT | histflags, &status)) {
- dgerr(sctx[j],"edg_wll_JobStatus"); result = 1;
- } else printstat(status,0);
-
- if (job) edg_wlc_JobIdFree(job);
- if (status.state) edg_wll_FreeStatus(&status);
- }
- }
- for ( i = 0; i < nsrv; i++ ) edg_wll_FreeContext(sctx[i]);
-
- return result;
-}
-
-static void
-usage(char *name)
-{
- fprintf(stderr,"Usage: %s [-x lb_proxy_serve_sock] [-fasthist|-fullhist] [job_id [...]]\n", name);
- fprintf(stderr," %s -all\n", name);
-}
-
-static int
-query_all(edg_wll_Context ctx, edg_wll_JobStat **statesOut, edg_wlc_JobId **jobsOut)
-{
- edg_wll_QueryRec jc[2];
- int ret;
-
- memset(jc, 0, sizeof jc);
- jc[0].attr = EDG_WLL_QUERY_ATTR_OWNER;
- jc[0].op = EDG_WLL_QUERY_OP_EQUAL;
- jc[0].value.c = NULL; /* is NULL, peerName filled in on server side */
- jc[1].attr = EDG_WLL_QUERY_ATTR_UNDEF;
-
- if ( (ret = edg_wll_QueryJobs(ctx, jc, 0, jobsOut, statesOut)) ) {
- if ( ret == E2BIG ) {
- int r;
- if ( edg_wll_GetParam(ctx, EDG_WLL_PARAM_QUERY_RESULTS, &r) ) return ret;
- if ( r != EDG_WLL_QUERYRES_LIMITED ) return ret;
-
- printf("Warning: only limited result returned!\n");
- return 0;
- } else return ret;
- }
-
- return ret;
-}
-
-static void
-dgerr(edg_wll_Context ctx,char *where)
-{
- char *etxt,*edsc;
-
- edg_wll_Error(ctx,&etxt,&edsc);
- fprintf(stderr,"%s: %s: %s",myname,where,etxt);
- if (edsc) fprintf(stderr," (%s)",edsc);
- putc('\n',stderr);
- free(etxt); free(edsc);
-}
-
-static void printstat(edg_wll_JobStat stat, int level)
-{
- char *s, *j1,*j2, ind[10];
- int i;
-
-
- for (i=0; i < level; i++)
- ind[i]='\t';
- ind[i]='\0';
-
- s = edg_wll_StatToString(stat.state);
-/* print whole flat structure */
- printf("%sstate : %s\n", ind, s);
- printf("%sjobId : %s\n", ind, j1 = edg_wlc_JobIdUnparse(stat.jobId));
- printf("%sowner : %s\n", ind, stat.owner);
- switch (stat.jobtype) {
- case EDG_WLL_STAT_SIMPLE:
- printf("%sjobtype : SIMPLE\n", ind);
- break;
- case EDG_WLL_STAT_DAG:
- printf("%sjobtype : DAG\n", ind);
- break;
- case EDG_WLL_STAT_COLLECTION:
- printf("%sjobtype : COLLECTION\n", ind);
- break;
- case EDG_WLL_STAT_PBS:
- printf("%sjobtype : PBS\n", ind);
- break;
- default:
- break;
- }
- printf("%sparent_job : %s\n", ind,
- j2 = edg_wlc_JobIdUnparse(stat.parent_job));
- if (stat.jobtype) {;
- printf("%sseed : %s\n", ind, stat.seed);
- printf("%schildren_num : %d\n", ind, stat.children_num);
- printf("%schildren :\n", ind);
- if (stat.children)
- for (i=0; stat.children[i]; i++)
- printf("%s\tchildren : %s\n", ind, stat.children[i]);
- printf("%schildren_states :\n", ind);
- if (stat.children_states)
- for (i=0; stat.children_states[i].state; i++)
- printstat(stat.children_states[i], level+1);
- printf("%schildren_hist :\n",ind);
- if (stat.children_hist)
- for (i=1; i<=stat.children_hist[0]; i++)
- printf("%s%14s %d\n", ind, edg_wll_StatToString(i-1),stat.children_hist[i]);
- }
- printf("%scondorId : %s\n", ind, stat.condorId);
- printf("%sglobusId : %s\n", ind, stat.globusId);
- printf("%slocalId : %s\n", ind, stat.localId);
- printf("%sjdl : %s\n", ind, stat.jdl);
- printf("%smatched_jdl : %s\n", ind, stat.matched_jdl);
- printf("%sdestination : %s\n", ind, stat.destination);
- printf("%snetwork server : %s\n", ind, stat.network_server);
- printf("%scondor_jdl : %s\n", ind, stat.condor_jdl);
- printf("%srsl : %s\n", ind, stat.rsl);
- printf("%sreason : %s\n", ind, stat.reason);
- printf("%slocation : %s\n", ind, stat.location);
- printf("%sce_node : %s\n", ind, stat.ce_node);
- printf("%ssubjob_failed : %d\n", ind, stat.subjob_failed);
- printf("%sdone_code : %s\n", ind, edg_wll_done_codeToString(stat.done_code));
- printf("%sexit_code : %d\n", ind, stat.exit_code);
- printf("%sresubmitted : %d\n", ind, stat.resubmitted);
- printf("%scancelling : %d\n", ind, stat.cancelling);
- printf("%scancelReason : %s\n", ind, stat.cancelReason);
- printf("%scpuTime : %d\n", ind, stat.cpuTime);
- printf("%suser_tags :\n",ind);
- if (stat.user_tags)
- for (i=0; stat.user_tags[i].tag; i++) printf("%s%14s = \"%s\"\n", ind,
- stat.user_tags[i].tag,stat.user_tags[i].value);
- printf("%sstateEnterTime : %ld.%06ld\n", ind, stat.stateEnterTime.tv_sec,stat.stateEnterTime.tv_usec);
- printf("%sstateEnterTimes : \n",ind);
- if (stat.stateEnterTimes)
- for (i=1; i<=stat.stateEnterTimes[0]; i++) {
- time_t st = stat.stateEnterTimes[i];
-
- printf("%s%14s %s", ind, edg_wll_StatToString(i-1), st == 0 ?
- " - not available -\n" : ctime(&st));
- }
- printf("%slastUpdateTime : %ld.%06ld\n", ind, stat.lastUpdateTime.tv_sec,stat.lastUpdateTime.tv_usec);
- printf("%sexpectUpdate : %d\n", ind, stat.expectUpdate);
- printf("%sexpectFrom : %s\n", ind, stat.expectFrom);
- printf("%sacl : %s\n", ind, stat.acl);
- printf("%spayload_running: %d\n", ind, stat.payload_running);
- if (stat.possible_destinations) {
- printf("%spossible_destinations : \n", ind);
- for (i=0; stat.possible_destinations[i]; i++)
- printf("%s\t%s \n", ind, stat.possible_destinations[i]);
- }
- if (stat.possible_ce_nodes) {
- printf("%spossible_ce_nodes : \n", ind);
- for (i=0; stat.possible_ce_nodes[i]; i++)
- printf("%s\t%s \n", ind, stat.possible_ce_nodes[i]);
- }
- /* PBS state section */
- if (stat.jobtype == EDG_WLL_STAT_PBS) {
- printf("%spbs_state : %s\n", ind, stat.pbs_state);
- printf("%spbs_queue : %s\n", ind, stat.pbs_queue);
- printf("%spbs_owner : %s\n", ind, stat.pbs_owner);
- printf("%spbs_name : %s\n", ind, stat.pbs_name);
- printf("%spbs_reason : %s\n", ind, stat.pbs_reason);
- printf("%spbs_scheduler : %s\n", ind, stat.pbs_scheduler);
- printf("%spbs_dest_host : %s\n", ind, stat.pbs_dest_host);
- printf("%spbs_pid : %d\n", ind, stat.pbs_pid);
- printf("%spbs_resource_usage : %s%s\n", ind,
- (stat.pbs_resource_usage) ? "\n" : "", stat.pbs_resource_usage);
- printf("%spbs_exit_status : %d\n", ind, stat.pbs_exit_status);
- printf("%spbs_error_desc : %s%s\n", ind,
- (stat.pbs_error_desc) ? "\n" : "", stat.pbs_error_desc);
- }
-
- printf("\n");
-
- free(j1);
- free(j2);
- free(s);
-}
-
+++ /dev/null
-#include <getopt.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-
-#include <globus_common.h>
-
-#include "glite/wmsutils/jobid/cjobid.h"
-#include "glite/lb/notifid.h"
-#include "glite/lb/producer.h"
-#include "glite/lb/events.h"
-
-
-static struct option opts[] = {
- {"help", 0, NULL, 'h'},
- {"sock", 1, NULL, 's'},
- {"jobid", 1, NULL, 'j'},
- {"user", 1, NULL, 'u'},
- {"seq", 1, NULL, 'c'},
- {"name", 1, NULL, 'n'},
- {"value", 1, NULL, 'v'}
-};
-
-static void usage(char *me)
-{
- fprintf(stderr, "usage: %s [option]\n"
- "\t-h, --help Shows this screen.\n"
- "\t-s, --server LB Proxy socket.\n"
- "\t-j, --jobid ID of requested job.\n"
- "\t-u, --user User DN.\n"
- "\t-c, --seq Sequence code.\n"
- "\t-n, --name Name of the tag.\n"
- "\t-v, --value Value of the tag.\n"
- , me);
-}
-
-
-int main(int argc, char *argv[])
-{
- edg_wll_Context ctx;
- edg_wlc_JobId jobid = NULL;
- char *server, *code, *jobid_s, *user, *name, *value;
- int opt, err = 0;
-
-
- server = code = jobid_s = name = value = NULL;
- while ( (opt = getopt_long(argc, argv, "hs:j:u:c:n:v:", opts, NULL)) != EOF)
- switch (opt) {
- case 'h': usage(name); return 0;
- case 's': server = strdup(optarg); break;
- case 'j': jobid_s = strdup(optarg); break;
- case 'u': user = strdup(optarg); break;
- case 'c': code = strdup(optarg); break;
- case 'n': name = strdup(optarg); break;
- case 'v': value = strdup(optarg); break;
- case '?': usage(name); return 1;
- }
-
- if ( !jobid_s ) { fprintf(stderr, "JobId not given\n"); return 1; }
- if ( !server ) { fprintf(stderr, "LB proxy socket not given\n"); return 1; }
- if ( !name ) { fprintf(stderr, "Tag name not given\n"); return 1; }
- if ( !value ) { fprintf(stderr, "Tag value not given\n"); return 1; }
-
- if ( (errno = edg_wlc_JobIdParse(jobid_s, &jobid)) ) { perror(jobid_s); return 1; }
-
- if (globus_module_activate(GLOBUS_COMMON_MODULE) != GLOBUS_SUCCESS) {
- fprintf(stderr, "Cannot initialize Globus common module\n");
- exit(1);
- }
-
- edg_wll_InitContext(&ctx);
-
- if ( !user ) {
- /*
- edg_wll_GssStatus gss_stat;
-
- if ( edg_wll_gss_acquire_cred_gsi(
- ctx->p_proxy_filename ? : ctx->p_cert_filename,
- ctx->p_proxy_filename ? : ctx->p_key_filename,
- NULL, &user_dn, &gss_stat) ) {
- fprintf(stderr, "failed to load GSI credentials\n");
- retrun 1;
- }
- */
- }
-
- edg_wll_SetParam(ctx, EDG_WLL_PARAM_SOURCE, EDG_WLL_SOURCE_USER_INTERFACE);
- edg_wll_SetParam(ctx, EDG_WLL_PARAM_LBPROXY_STORE_SOCK, server);
-
- if (edg_wll_SetLoggingJobProxy(ctx, jobid, code, user, EDG_WLL_SEQ_NORMAL)) {
- char *et,*ed;
- edg_wll_Error(ctx,&et,&ed);
- fprintf(stderr,"SetLoggingJob(%s,%s): %s (%s)\n",jobid_s,code,et,ed);
- exit(1);
- }
-
- err = edg_wll_LogEventProxy(ctx,
- EDG_WLL_EVENT_USERTAG, EDG_WLL_FORMAT_USERTAG,
- name, value);
-
- if (err) {
- char *et,*ed;
-
- edg_wll_Error(ctx,&et,&ed);
- fprintf(stderr,"%s: edg_wll_LogEvent*(): %s (%s)\n",
- argv[0],et,ed);
- free(et); free(ed);
- }
-
- code = edg_wll_GetSequenceCode(ctx);
- puts(code);
- free(code);
-
- edg_wll_FreeContext(ctx);
-
- return err;
-}
+++ /dev/null
-#include <time.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "glite/security/glite_gss.h"
-#include "glite/lb/context.h"
-#include "glite/lb/notification.h"
-
-
-static char *me;
-
-static char tbuf[256];
-
-char *TimeToStr(time_t t)
-{
- struct tm *tm = gmtime(&t);
-
- sprintf(tbuf,"'%4d-%02d-%02d %02d:%02d:%02d'",
- tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday,
- tm->tm_hour,tm->tm_min,tm->tm_sec);
-
- return tbuf;
-}
-
-static void usage(char *cmd)
-{
- if ( !cmd )
- {
- printf("usage: %s command [options]\n"
- " where commands are:\n"
- " new Create new notification reg.\n"
- " bind Binds an notification reg. to a client.\n"
- " change Changes notification reg. params.\n"
- " refresh Enlarge notification reg. validity.\n"
- " receive Binds to an existing notif. registration and listen to server.\n"
- " test Creates new notif., waits for events and drops notif. after timeout.\n"
- " drop Drop the notification reg.\n"
- " help Prints this message\n",
- me);
- }
- if ( !cmd || !strcmp(cmd, "new") )
- printf("\n'new' command usage: %s new jobid\n"
- " jobid job ID to connect notif. reg. with\n", me);
- if ( !cmd || !strcmp(cmd, "bind") )
- printf("\n'bind' command usage: %s bind notifid [fake_addr]\n"
- " notifid Notification ID\n"
- " fake_addr Fake the client address\n", me);
- if ( !cmd || !strcmp(cmd, "change") )
- printf("\n'change' command usage: %s change notifid jobid\n"
- " notifid Notification ID.\n"
- " jobid Job ID to connect notif. reg. with.\n", me);
- if ( !cmd || !strcmp(cmd, "refresh") )
- printf("\n'refresh' command usage: %s refresh notifid\n"
- " notifid Notification ID.\n", me);
- if ( !cmd || !strcmp(cmd, "receive") )
- printf("\n'receive' command usage: %s receive notifid [-a fake_addr] [-t timeout]\n"
- " notifid Notification ID.\n"
- " fake_addr Fake the client address.\n"
- " timeout Timeout to receive operation in seconds.\n", me);
- if ( !cmd || !strcmp(cmd, "test") )
- printf("\n'new' command usage: %s test jobid\n"
- " jobid job ID to connect notif. reg. with\n", me);
- if ( !cmd || !strcmp(cmd, "drop") )
- printf("\n'drop' command usage: %s drop notifid\n"
- " notifid Notification to remove.\n", me);
-}
-
-int main(int argc,char **argv)
-{
- edg_wll_Context ctx;
- edg_wll_QueryRec **conditions = NULL;
- time_t valid;
- char *errt, *errd;
- struct timeval tout = {220, 0};
-
-
-
- me = argv[0];
- edg_wll_InitContext(&ctx);
-
- if ( argc < 2 ) {
- usage(NULL); goto cleanup;
- }
- if ( (argc < 2) ||
- !strcmp(argv[1], "help") || !strcmp(argv[1], "--help") ||
- !strcmp(argv[1], "-h") || !strcmp(argv[1], "-?"))
- {
- usage(NULL); goto cleanup;
- }
- else if ( !strcmp(argv[1], "test") ) {
- edg_wll_NotifId nid = NULL;
- edg_wlc_JobId jid = NULL;
- edg_wll_JobStat stat;
-
- if ( (argc < 3) || edg_wlc_JobIdParse(argv[2], &jid) ) {
- printf("Job ID parameter not set propperly!\n");
- usage("new");
- goto cleanup;
- }
-
- memset(&stat, 0, sizeof(stat));
-
- conditions = (edg_wll_QueryRec **)calloc(2,sizeof(edg_wll_QueryRec *));
- conditions[0] = (edg_wll_QueryRec *)calloc(2,sizeof(edg_wll_QueryRec));
-
- conditions[0][0].attr = EDG_WLL_QUERY_ATTR_JOBID;
- conditions[0][0].op = EDG_WLL_QUERY_OP_EQUAL;
- conditions[0][0].value.j = jid;
-
-
- if ( edg_wll_NotifNew(ctx,
- (edg_wll_QueryRec const* const*)conditions,
- -1, NULL,
- &nid, &valid)) goto err;
-
- printf("notification ID: %s\nvalid: %s (%ld)\n",
- edg_wll_NotifIdUnparse(nid),
- TimeToStr(valid),
- valid);
-
- do {
- edg_wll_NotifId recv_nid = NULL;
-
- printf("waiting...\n");
- if ( edg_wll_NotifReceive(ctx, -1, &tout, &stat, &recv_nid) ) {
- edg_wll_NotifIdFree(recv_nid);
- printf("timeout\n");
- break;
- }
-
- printf("Notification received:\n");
- printf(" - notification ID: %s\n", edg_wll_NotifIdUnparse(recv_nid));
- printf(" - job ID: %s\n", edg_wlc_JobIdUnparse(stat.jobId));
-
- if (stat.state != EDG_WLL_JOB_UNDEF) {
- printf(" - job status is: %s\n\n", edg_wll_StatToString(stat.state));
- edg_wll_FreeStatus(&stat);
- stat.state = EDG_WLL_JOB_UNDEF;
- }
- if (recv_nid) { edg_wll_NotifIdFree(recv_nid); recv_nid = NULL; }
- } while (1); // till timeout....
-err:
- if (nid) {
- edg_wll_NotifDrop(ctx, nid);
- edg_wll_NotifIdFree(nid);
- edg_wll_NotifCloseFd(ctx);
- }
- if (stat.state != EDG_WLL_JOB_UNDEF) edg_wll_FreeStatus(&stat);
- if (jid) edg_wlc_JobIdFree(jid);
- }
- else if ( !strcmp(argv[1], "new") )
- {
- edg_wlc_JobId jid;
- edg_wll_NotifId id_out;
-
- if ( (argc < 3) || edg_wlc_JobIdParse(argv[2], &jid) ) {
- printf("Job ID parameter not set propperly!\n");
- usage("new");
- goto cleanup;
- }
-
- conditions = (edg_wll_QueryRec **)calloc(2,sizeof(edg_wll_QueryRec *));
- conditions[0] = (edg_wll_QueryRec *)calloc(2,sizeof(edg_wll_QueryRec));
-
- conditions[0][0].attr = EDG_WLL_QUERY_ATTR_JOBID;
- conditions[0][0].op = EDG_WLL_QUERY_OP_EQUAL;
- conditions[0][0].value.j = jid;
-
- if ( !edg_wll_NotifNew(ctx,
- (edg_wll_QueryRec const* const*)conditions,
- -1, NULL, &id_out, &valid))
- printf("notification ID: %s\nvalid: %s (%ld)\n",
- edg_wll_NotifIdUnparse(id_out),
- TimeToStr(valid),
- valid);
- edg_wll_NotifIdFree(id_out);
- edg_wlc_JobIdFree(jid);
- }
- else if ( !strcmp(argv[1], "bind") )
- {
- edg_wll_NotifId nid;
-
- if ( (argc < 3) || edg_wll_NotifIdParse(argv[2], &nid) )
- {
- printf("Notification ID parameter not set propperly!\n");
- usage("bind");
- return 1;
- }
- if ( !edg_wll_NotifBind(ctx, nid, -1, (argc<4)? NULL: argv[3], &valid) )
- printf("valid until: %s (%ld)\n", TimeToStr(valid), valid);
- edg_wll_NotifIdFree(nid);
- }
- else if ( !strcmp(argv[1], "receive") )
- {
- edg_wll_JobStat stat;
- edg_wll_NotifId nid = NULL;
- char *addr = NULL;
- int i;
-
- if ( (argc < 3) || edg_wll_NotifIdParse(argv[2], &nid) )
- {
- printf("Notification ID parameter not set propperly!\n");
- usage("receive");
- return 1;
- }
-
- for ( i = 3; i < argc; i++ )
- {
- if ( !strcmp(argv[i], "-t") )
- {
- if ( argc < i+1 )
- {
- printf("Timeout value not set\n");
- usage("receive");
- return 1;
- }
- tout.tv_sec = atoi(argv[++i]);
- }
- else if ( !strcmp(argv[i], "-a") )
- {
- if ( argc < i+1 )
- {
- printf("Address value not set\n");
- usage("receive");
- return 1;
- }
- addr = strdup(argv[++i]);
- }
- else
- {
- printf("unrecognized option: %s\n", argv[i]);
- usage("receive");
- return 1;
- }
- }
-
- memset(&stat,0,sizeof stat);
-
- if ( edg_wll_NotifBind(ctx, nid, -1, addr, &valid) )
- goto receive_err;
-
- printf("notification is valid until: %s (%ld)\n", TimeToStr(valid), valid);
-
- do {
- edg_wll_NotifId recv_nid = NULL;
-
- if ( edg_wll_NotifReceive(ctx, -1, &tout, &stat, &recv_nid) ) {
- edg_wll_NotifIdFree(recv_nid);
- break;
- }
-
- printf("\nnotification ID: %s\n", edg_wll_NotifIdUnparse(recv_nid));
-
- if (stat.state != EDG_WLL_JOB_UNDEF) {
- printf("Job status is : %s\n",
- edg_wll_StatToString(stat.state));
- edg_wll_FreeStatus(&stat);
- stat.state = EDG_WLL_JOB_UNDEF;
- }
-
- if (recv_nid) {
- edg_wll_NotifIdFree(recv_nid);
- recv_nid = NULL;
- }
- } while (1); // till timeout....
-
-receive_err:
- if (addr) free(addr);
- if (stat.state != EDG_WLL_JOB_UNDEF) edg_wll_FreeStatus(&stat);
- if (nid) edg_wll_NotifIdFree(nid);
- edg_wll_NotifCloseFd(ctx);
- }
- else if ( !strcmp(argv[1], "change") )
- {
- edg_wlc_JobId jid;
- edg_wll_NotifId nid;
-
- if ( (argc < 3) || edg_wll_NotifIdParse(argv[2], &nid) )
- {
- printf("Notification ID parameter not set propperly!\n");
- usage("bind");
- return 1;
- }
- if ( (argc < 4) || edg_wlc_JobIdParse(argv[3], &jid) )
- {
- printf("Job ID parameter not set propperly!\n");
- usage("change");
- goto cleanup;
- }
-
- conditions = (edg_wll_QueryRec **)calloc(3,sizeof(edg_wll_QueryRec *));
- conditions[0] = (edg_wll_QueryRec *)calloc(2,sizeof(edg_wll_QueryRec));
- conditions[1] = (edg_wll_QueryRec *)calloc(3, sizeof(edg_wll_QueryRec));
-
- conditions[0][0].attr = EDG_WLL_QUERY_ATTR_JOBID;
- conditions[0][0].op = EDG_WLL_QUERY_OP_EQUAL;
- conditions[0][0].value.j = jid;
-
- conditions[1][0].attr = EDG_WLL_QUERY_ATTR_STATUS;
- conditions[1][0].op = EDG_WLL_QUERY_OP_EQUAL;
- conditions[1][0].value.i = EDG_WLL_JOB_DONE;
-
- conditions[1][1].attr = EDG_WLL_QUERY_ATTR_STATUS;
- conditions[1][1].op = EDG_WLL_QUERY_OP_EQUAL;
- conditions[1][1].value.i = EDG_WLL_JOB_RUNNING;
-
- edg_wll_NotifChange(ctx, nid,
- (edg_wll_QueryRec const * const *) conditions,
- EDG_WLL_NOTIF_REPLACE);
- edg_wlc_JobIdFree(jid);
- edg_wll_NotifIdFree(nid);
- }
- else if ( !strcmp(argv[1], "refresh") )
- {
- edg_wll_NotifId nid;
-
- if ( (argc < 3) || edg_wll_NotifIdParse(argv[2], &nid) )
- {
- printf("Notification ID parameter not set propperly!\n");
- usage("bind");
- return 1;
- }
- if ( !edg_wll_NotifRefresh(ctx, nid, &valid) )
- printf("valid until: %s (%ld)\n", TimeToStr(valid), valid);
- edg_wll_NotifIdFree(nid);
- }
- else if ( !strcmp(argv[1], "drop") )
- {
- edg_wll_NotifId nid;
-
- if ( (argc < 3) || edg_wll_NotifIdParse(argv[2], &nid) )
- {
- printf("Notification ID parameter not set propperly!\n");
- usage("bind");
- return 1;
- }
- edg_wll_NotifDrop(ctx, nid);
- edg_wll_NotifIdFree(nid);
- }
- else
- printf("bad acction\n");
-
-
-cleanup:
-
- if ( conditions )
- {
- /*
- for ( i = 0; conditions[i][0].attr; i++ )
- free(conditions[1]);
- */
- free(conditions);
- }
-
- edg_wll_NotifCloseFd(ctx);
-
- if (edg_wll_Error(ctx,&errt,&errd))
- fprintf(stderr, "%s: %s (%s)\n", me, errt, errd);
-
- edg_wll_FreeContext(ctx);
-
-
- return 0;
-}
+++ /dev/null
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-#include <fcntl.h>
-
-#include "glite/lb/producer.h"
-#include "glite/lb/events.h"
-#include "glite/lb/events_parse.h"
-
-#define MAXMSGSIZE 10240
-
-extern char *optarg;
-extern int opterr,optind;
-
-static const char *me;
-
-static void usage()
-{
- fprintf(stderr,"usage: %s [-n] -f file_name\n", me);
-}
-
-int main(int argc, char *argv[])
-{
- char *filename = NULL;
- char buf[MAXMSGSIZE];
- int done = 0,i=0,notif=0;
- edg_wll_Context ctx;
- edg_wll_Event *event = NULL;
- FILE *f;
- edg_wll_ErrorCode (*parse)(edg_wll_Context context,edg_wll_LogLine logline,edg_wll_Event **event);
- edg_wll_LogLine (*unparse)(edg_wll_Context context,edg_wll_Event *event);
- const char *parse_str,*unparse_str;
-
- edg_wll_InitContext(&ctx);
- opterr = 0;
-
- me = strdup(argv[0]);
-
- do {
- switch (getopt(argc,argv,"nf:")) {
- case 'n': notif = 1; break;
- case 'f': filename = (char *) strdup(optarg); break;
- case '?': usage(); exit(EINVAL);
- case -1: done = 1; break;
- }
- } while (!done);
-
- /* choose the right (un)parser */
- if (notif) {
- parse = edg_wll_ParseNotifEvent;
- parse_str = "edg_wll_ParseNotifEvent";
- unparse = edg_wll_UnparseNotifEvent;
- unparse_str = "edg_wll_UnparseNotifEvent";
- } else {
- parse = edg_wll_ParseEvent;
- parse_str = "edg_wll_ParseEvent";
- unparse = edg_wll_UnparseEvent;
- unparse_str = "edg_wll_UnparseEvent";
- }
-
- if (!filename) {
- fprintf(stderr,"%s: -f required\n",me);
- usage();
- exit(1);
- }
-
- if ( (f = fopen(filename,"r")) == NULL) {
- perror(filename);
- exit(1);
- } else {
- fprintf(stderr,"Parsing file '%s' for correctness:\n",filename);
- }
-
- /* parse events */
- i = 1;
- while (!feof(f)) {
- if (!fgets(buf,sizeof(buf),f)) break;
- if (strcmp(buf,"\n")) {
- // fprintf(stdout,"%d: %s\n",i,buf);
-
- if (parse(ctx,buf,&event) != 0) {
- /* Parse ERROR: */
- char *et=NULL,*ed=NULL;
-
- edg_wll_Error(ctx,&et,&ed);
- fprintf(stderr,"line %d: %s() error: %s (%s)\n",i,parse_str,et,ed);
- if (et) free(et);
- if (ed) free(ed);
- } else {
- /* Parse OK : */
- char *es=NULL;
- edg_wll_LogLine logline = NULL;
-
- es=edg_wll_EventToString(event->type);
- logline = unparse(ctx,event);
- fprintf(stderr,"line %d: %s() o.k. (event %s), ",i,parse_str,es);
- if (logline) {
- fprintf(stderr,"%s() o.k.\n",unparse_str);
- free(logline);
- } else {
- fprintf(stderr,"%s() error\n",unparse_str);
- }
- if (es) free(es);
- }
- if (event) edg_wll_FreeEvent(event);
- }
- i++;
- }
- fclose(f);
-
- edg_wll_FreeContext(ctx);
-
- return 0;
-}
+++ /dev/null
-/*
- * fake implementation of the producer API
- */
-
-#include "glite/lb/producer.h"
-#include "glite/lb/context-int.h"
-#include "glite/lb/producer_fake.h"
-
-#define FAKE_VERSION 1
-
-#include "../src/producer.c"
-
-
-static edg_wll_Logging_cb_f *Logging_cb = NULL;
-static edg_wll_Logging_cb_f *LoggingProxy_cb = NULL;
-
-
-/* register the logging callback */
-int edg_wll_RegisterTestLogging(edg_wll_Logging_cb_f *cb) {
- if (Logging_cb) return 0;
-
- Logging_cb = cb;
- return 1;
-}
-
-
-/* register the proxy logging callback */
-int edg_wll_RegisterTestLoggingProxy(edg_wll_Logging_cb_f *cb) {
- if (LoggingProxy_cb) return 0;
-
- LoggingProxy_cb = cb;
- return 1;
-}
-
-
-/* unregister the logging callback */
-void edg_wll_UnregisterTestLogging() {
- Logging_cb = NULL;
-}
-
-
-/* unregister the proxy logging callback */
-void edg_wll_UnregisterTestLoggingProxy() {
- LoggingProxy_cb = NULL;
-}
-
-
-/* "fake" implementation of function sending formated UML string */
-int edg_wll_DoLogEvent(edg_wll_Context context, edg_wll_LogLine logLine) {
- if (Logging_cb)
- return Logging_cb(context);
- else
- return edg_wll_Error(context, NULL, NULL);
-}
-
-
-/* "fake" implementation of function sending formated ULM string */
-int edg_wll_DoLogEventProxy(edg_wll_Context context, edg_wll_LogLine logline) {
- if (Logging_cb)
- return Logging_cb(context);
- else
- return edg_wll_Error(context, NULL, NULL);
-}
+++ /dev/null
-#!/usr/bin/perl
-
-
-
-BEGIN{
-$inst = $ENV{GLITE_PREFIX};
-$inst = "/opt/glite" unless $inst;
-$sbin = "$inst/sbin";
-$bin = "$inst/bin";
-$test = "$inst/examples";
-$purge = "$sbin/glite-lb-purge";
-$status = "$test/glite-lb-job_status";
-$log = "$test/glite-lb-job_log";
-$prefix = "/tmp/purge_test_$$";
-$delay = 60;
-
-$ENV{PATH} .= ":$bin";
-}
-
-$option = shift;
-$server = shift;
-
-die qq{
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
- This script will DESTROY ALL DATA in the specified bookkeeping server.
-
-Don't run it unless you are absolutely sure what you are doing.
-If you really mean it, the magic usage is:
-
- $0 --i-want-to-purge server:port
-
-Good luck!
-
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-} unless $option eq '--i-want-to-purge';
-
-die "usage: $0 --i-want-to-purge server:port\n" unless $server;
-
-sub logit {
- my $ids = shift;
- my $prefix = shift;
- my $failed = 0;
-
- for (qw/aborted cleared cancelled waiting/) {
- my $key = $_ eq waiting ? 'other' : $_;
- $id = `$test/glite-lb-$_.sh -m $server`;
- chomp $id;
- die "$test/glite-lb-$_.sh" if $?;
- $id =~ s/EDG_JOBID=//;
- $ids->{$key} = $id;
-#print "$status $id | head -1\n";
- $stat = `$status $id | head -2 | tail -1`;
- chomp $stat;
- $stat =~ s/state :\s*//;
-#print "$id: ".uc($stat)." ".uc($_)."\n";
- $failed = 1 if uc($stat) ne uc($_);
-
- system "$log $id | grep -v '^[ ]*\$' | grep -v '^Found' >${prefix}_$_";
- }
-
- !$failed;
-}
-
-print "** Hey, purging the whole database\n";
-system "$purge --server $server --return-list --aborted=0 --cleared=0 --cancelled=0 --other=0";
-die "$purge: $!\n" if $!;
-
-print "** Logging test jobs\n";
-
-die "!! failed\n" if !logit \%old,"${prefix}_old";
-print "** So far good, sleeping $delay seconds\n";
-sleep $delay;
-print "** OK, another set of jobs\n";
-die "!! failed\n" if !logit \%new,"${prefix}_new";
-
-print "** Dry run\n";
-$failed = 0;
-
-$half = $delay/2;
-for (qw/aborted cleared cancelled other/) {
- open LIST,"$purge --server $server --dry-run --return-list --$_=${half}s| grep '^https://'|" or die "!! run $purge\n";
-
- $id = <LIST>; chomp $id;
- if ($old{$_} ne $id) {
- $failed = 1;
- print "!! $old{$_} (old $_) is not there\n";
- }
- else {
- print "$_ $id OK\n";
- }
- $id = <LIST>;
- if ($id) {
- $failed = 1;
- chomp $id;
- print "!! $id should not be there\n";
- }
- close LIST;
-
- open LIST,"$purge --server $server --dry-run --return-list --$_=0s | grep '^https://'|" or die "!! run $purge\n";
-
- $cnt = 0;
- while ($id = <LIST>) {
- chomp $id;
- if ($old{$_} ne $id && $new{$_} ne $id) {
- $failed = 1;
- print "!! $id should not be there\n";
- }
- else {
- print "$_ $id OK\n";
- }
- $cnt++;
- }
-
- close LIST;
- if ($cnt != 2) {
- $failed = 1;
- print "!! bad number of $_ jobs ($cnt)\n";
- }
-}
-
-die "!! aborting\n" if $failed;
-
-print "** Server defaults\n";
-
-open LIST,"$purge --server $server --dry-run --return-list | grep '^https://'|" or die "!! run $purge\n";
-
-$failed = 0;
-while ($id = <LIST>) {
- $failed = 1;
- print "$id\n";
-}
-
-die "!! Oops, should not do anything, too short defaults?\n" if $failed;
-
-print "Nothing purged as expected\n";
-
-print "** Purge the first set of jobs\n";
-
-open DUMP,"$purge --server $server --server-dump --aborted=${half}s --cleared=${half}s --cancelled=${half}s --other=${half}s | grep '^Server dump:'|"
- or die "!! run $purge\n";
-
-$dump = <DUMP>; chomp $dump; $dump =~ s/Server dump: //;
-close DUMP;
-
-die "!! no dump file reported\n" unless $dump;
-@list = glob "${prefix}_old*";
-system "cat @list | sort >${prefix}_old_all";
-system "cat $dump | sed -e s/^.*DATE/DATE/ | sort >${prefix}_old_dump";
-sleep 60;
-system "diff ${prefix}_old_all ${prefix}_old_dump >/dev/null";
-
-die "!! aggregate log and dump differ\n" if $? & 0xff00;
-
-print "diff OK\n";
-
-print "** Purge the rest\n";
-open DUMP,"$purge --server $server --server-dump --aborted=0 --cleared=0 --cancelled=0 --other=0 | grep '^Server dump:'|"
- or die "!! run $purge\n";
-
-$dump = <DUMP>; chomp $dump; $dump =~ s/Server dump: //;
-close DUMP;
-
-die "!! no dump file reported\n" unless $dump;
-@list = glob "${prefix}_new*";
-system "cat @list | sort >${prefix}_new_all";
-system "cat $dump | sed -e s/^.*DATE/DATE/ | sort >${prefix}_new_dump";
-system "diff ${prefix}_new_all ${prefix}_new_dump >/dev/null";
-
-die "!! aggregate log and dump differ\n" if $? & 0xff00;
-
-print "diff OK\n";
-
-
-print "** Anything left?\n";
-open LIST,"$purge --server $server --return-list --dry-run --aborted=0 --cleared=0 --cancelled=0 --other=0 | grep '^https://'|" or die "!! $purge\n";
-
-$id = <LIST>;
-close LIST;
-die "!! Yes, but should not\n" if $id;
-print "No, OK\n";
-
-print "\n** All tests passed **\n";
-exit 0;
-
-END{ unlink glob "${prefix}*" if $prefix; }
+++ /dev/null
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-#include <ctype.h>
-#include <time.h>
-
-#include "glite/wmsutils/jobid/cjobid.h"
-#include "glite/lb/consumer.h"
-
-#define BUFF_LEN 1024
-#define MAX_AND_CONDS 20
-
-enum
-{
- PQRV_ERR,
- PQRV_EOF,
- PQRV_EMPTY_LINE,
-};
-
-
-static void printstat(edg_wll_JobStat);
-static int cond_parse(edg_wll_QueryRec ***, int);
-static void dgerr(edg_wll_Context, char *);
-static void free_QueryRec(edg_wll_QueryRec *qr);
-static void printconds(edg_wll_QueryRec **);
-static time_t StrToTime(char *t);
-static char *TimeToStr(time_t t);
-
-static char *myname;
-static FILE *fin;
-static char buffer[BUFF_LEN+1],
- tmps[500];
-static int query_jobs = 1;
-#define query_events (!query_jobs)
-static int query_lbproxy = 0;
-#define query_bkserver (!query_lbproxy)
-static int verbose = 0;
-
-
-static void usage(void)
-{
- fprintf(stderr, "Usage: %s [-hvs] [-i file]\n", myname);
- fprintf(stderr, " -h show this help\n");
- fprintf(stderr, " -v increase verbosity level\n");
- fprintf(stderr, " -s results described verbosely (query jobs only)\n");
- fprintf(stderr, " -m server name\n");
- fprintf(stderr, " -i file input file (default is stdin)\n\n");
- fprintf(stderr, " -e query events (default is 'query jobs')\n");
- fprintf(stderr, " -P query the L&B Proxy server\n");
- fprintf(stderr, " -p L&B Proxy socket path\n");
- fprintf(stderr, " -r type returned results: limited | all | none\n\n");
- fprintf(stderr, " -J num jobs soft limit\n\n");
- fprintf(stderr, " -E num events soft limit (query events only)\n\n");
-}
-
-int main(int argc,char *argv[])
-{
- edg_wll_Context ctx;
- edg_wll_QueryResults rslts = EDG_WLL_QUERYRES_UNDEF;
- edg_wll_QueryRec **jc = NULL,
- **ec = NULL;
- edg_wll_JobStat *statesOut = NULL;
- edg_wlc_JobId *jobsOut = NULL;
- edg_wll_Event *eventsOut = NULL;
- char *fname = NULL,
- *server = NULL,
- *proxy_sock = NULL,
- *s;
- int result = 0,
- jobsLimit = 0,
- stdisp = 0,
- eventsLimit = 0,
- i, j, ret,
- errCode;
-
- myname = argv[0];
- ret = 0;
- do {
- switch ( getopt(argc,argv,"hvsePp:i:m:r:J:E:") ) {
- case 'h': usage(); exit(0);
- case '?': usage(); exit(EINVAL);
- case 'v': verbose = 1; break;
- case 'i': fname = strdup(optarg); break;
- case 'm': server = strdup(optarg); break;
- case 's': stdisp = 1; break;
- case 'e': query_jobs = 0; break;
- case 'P': query_lbproxy = 1; break;
- case 'p': proxy_sock = strdup(optarg); break;
- case 'r':
- if ( !strcasecmp(optarg, "limited") ) rslts = EDG_WLL_QUERYRES_LIMITED;
- else if ( !strcasecmp(optarg, "none") ) rslts = EDG_WLL_QUERYRES_NONE;
- else if ( !strcasecmp(optarg, "all") ) rslts = EDG_WLL_QUERYRES_ALL;
- else { usage(); exit(EINVAL); }
- break;
- case 'J': jobsLimit = atoi(optarg); break;
- case 'E': eventsLimit = atoi(optarg); break;
- case -1: ret = 1; break;
- }
- } while ( !ret );
-
- if ( edg_wll_InitContext(&ctx) ) {
- if ( verbose ) fprintf(stderr,"%s: cannot initialize edg_wll_Context\n",myname);
- exit(1);
- }
-
- if ( jobsLimit > 0 ) {
- edg_wll_SetParam(ctx, EDG_WLL_PARAM_QUERY_JOBS_LIMIT, jobsLimit);
- if ( verbose ) printf("Soft query limit for jobs: %d\n", jobsLimit);
- }
- else if ( verbose ) printf("Soft query limit for jobs not set\n");
-
- if ( query_events ) {
- if ( eventsLimit > 0 ) {
- edg_wll_SetParam(ctx, EDG_WLL_PARAM_QUERY_EVENTS_LIMIT, eventsLimit);
- if ( verbose ) printf("Soft query limit for events: %d\n", eventsLimit);
- }
- else if ( verbose ) printf("Soft query limit for events not set\n");
- }
-
- if ( rslts != EDG_WLL_QUERYRES_UNDEF )
- edg_wll_SetParam(ctx, EDG_WLL_PARAM_QUERY_RESULTS, rslts);
- else
- edg_wll_GetParam(ctx, EDG_WLL_PARAM_QUERY_RESULTS, &rslts);
-
- if ( verbose ) printf("When any limit overflows, the returned result set is: %s\n",
- rslts==EDG_WLL_QUERYRES_LIMITED? "limited":
- (rslts==EDG_WLL_QUERYRES_ALL? "unlimited": "empty"));
-
- if ( server ) {
- char *p = strchr(server, ':');
- if ( p ) {
- edg_wll_SetParam(ctx, EDG_WLL_PARAM_QUERY_SERVER_PORT, atoi(p+1));
- *p = 0;
- }
- edg_wll_SetParam(ctx, EDG_WLL_PARAM_QUERY_SERVER, server);
- free(server);
- }
-
- if ( proxy_sock ) {
- edg_wll_SetParam(ctx, EDG_WLL_PARAM_LBPROXY_SERVE_SOCK, proxy_sock);
- free(proxy_sock);
- }
-
- if ( fname ) {
- fin = fopen(fname, "r");
- if ( !fin ) {
- if ( verbose ) fprintf(stderr, "Can't open given input file %s. Using stdin.\n", fname);
- fin = stdin;
- }
- free(fname);
- } else {
- if ( verbose ) fprintf(stderr, "No input file given. Using stdin.\n");
- fin = stdin;
- }
-
- jobsOut = NULL;
- statesOut = NULL;
- eventsOut = NULL;
-
-
- do
- {
- if ( verbose && (fin == stdin) ) printf("Enter job conditions:\n");
-
- ret = cond_parse(&jc, 1);
- if ( ret == PQRV_ERR ) { result = 1; goto cleanup; }
- if ( query_events && (ret != PQRV_EOF) ) {
- if ( verbose && (fin == stdin) ) printf("Enter event conditions:\n");
- ret = cond_parse(&ec, 0);
- if ( ret == PQRV_ERR ) { result = 1; goto cleanup; }
- }
-
- if ( (ret == PQRV_EOF) && !jc && (query_jobs || (query_events && !ec)) ) break;
-
- if ( verbose ) {
- printf("job conditions list: ");
- printconds(jc);
- if ( query_events ) { printf("event condition list: "); printconds(ec); }
- }
-
- if ( query_jobs ) {
- if ( query_bkserver )
- errCode = edg_wll_QueryJobsExt(ctx,
- (const edg_wll_QueryRec **) jc,
- 0, &jobsOut, stdisp? &statesOut: NULL);
- else
- errCode = edg_wll_QueryJobsExtProxy(ctx,
- (const edg_wll_QueryRec **) jc,
- 0, &jobsOut, stdisp? &statesOut: NULL);
- } else {
- if ( query_bkserver )
- errCode = edg_wll_QueryEventsExt(ctx,
- (const edg_wll_QueryRec **) jc,
- (const edg_wll_QueryRec **) ec,
- &eventsOut);
- else
- errCode = edg_wll_QueryEventsExtProxy(ctx,
- (const edg_wll_QueryRec **) jc,
- (const edg_wll_QueryRec **) ec,
- &eventsOut);
- }
-
- if ( errCode ) {
- dgerr(ctx, NULL);
- if ( (errCode != EPERM) && (errCode != E2BIG) ) goto cycle_cleanup;
- } else if ( verbose ) {
- if ( query_jobs ) printf("Matched jobs: ");
- else printf("Matched events: ");
- }
-
- if ( verbose ) {
- if ( (query_jobs && jobsOut && jobsOut[0]) ||
- (query_events && eventsOut && eventsOut[0].type) )
- putchar('\n');
- else printf("No one matches\n");
- }
-
- if ( query_jobs && jobsOut && !stdisp ) {
- for ( i = 0; jobsOut[i]; i++ ) {
- s = edg_wlc_JobIdUnparse(jobsOut[i]);
- printf("jobId: %s\n", edg_wlc_JobIdUnparse(jobsOut[i]));
- free(s);
- edg_wlc_JobIdFree(jobsOut[i]);
- }
- free(jobsOut);
- jobsOut = NULL;
- }
- if ( query_jobs && statesOut ) {
- if ( stdisp ) for ( i = 0; statesOut[i].state; i++ ) printstat(statesOut[i]);
- for ( i = 0; statesOut[i].state; i++ ) edg_wll_FreeStatus(&statesOut[i]);
- free(statesOut);
- statesOut = NULL;
- }
- if ( query_events && eventsOut ) {
- for ( i = 0; eventsOut[i].type; i++ ) {
- s = edg_wlc_JobIdUnparse(eventsOut[i].any.jobId);
- printf("event: %-11s (jobid %s)\n", edg_wll_EventToString(eventsOut[i].type), s);
- free(s);
- }
- free(eventsOut);
- eventsOut = NULL;
- }
-
-cycle_cleanup:
- if ( jc ) {
- for ( i = 0; jc[i]; i++ ) {
- for ( j = 0; jc[i][j].attr; j++ ) free_QueryRec(&jc[i][j]);
- free(jc[i]);
- }
- free(jc);
- }
-
- if ( ec ) {
- for ( i = 0; ec[i]; i++ ) {
- for ( j = 0; ec[i][j].attr; j++ ) free_QueryRec(&ec[i][j]);
- free(ec[i]);
- }
- free(ec);
- }
- } while ( ret != PQRV_EOF );
-
-cleanup:
- if ( fin != stdin ) fclose(fin);
- edg_wll_FreeContext(ctx);
-
- return result;
-}
-
-static void free_QueryRec(edg_wll_QueryRec *qr)
-{
- switch ( qr->attr )
- {
- case EDG_WLL_QUERY_ATTR_JOBID:
- case EDG_WLL_QUERY_ATTR_PARENT:
- edg_wlc_JobIdFree(qr->value.j);
- break;
-
- case EDG_WLL_QUERY_ATTR_STATUS:
- case EDG_WLL_QUERY_ATTR_DONECODE:
- case EDG_WLL_QUERY_ATTR_EXITCODE:
- case EDG_WLL_QUERY_ATTR_RESUBMITTED:
- break;
-
- case EDG_WLL_QUERY_ATTR_OWNER:
- case EDG_WLL_QUERY_ATTR_LOCATION:
- case EDG_WLL_QUERY_ATTR_DESTINATION:
- free(qr->value.c);
- break;
-
- case EDG_WLL_QUERY_ATTR_USERTAG:
- free(qr->attr_id.tag);
- free(qr->value.c);
- break;
-
- default:
- break;
- }
-}
-
-#define isop(c) ((c == '=') || (c == '<') || (c == '>') || (c == '@'))
-
-static char *get_attr_name(char *src, char *dest, int sz)
-{
- int i = 0,
- ct = 0;
-
-
- while ( (src[i] != '\0') && isblank(src[i]) ) i++; /* skip whitespaces */
- while ( (src[i] != '\n') && (src[i] != '\0') && !isop(src[i]) && !isblank(src[i]) )
- {
- if ( ct < sz )
- dest[ct++] = src[i];
- i++;
- }
- dest[ct] = '\0';
-
- return src+i;
-}
-
-static char *get_op(char *src, edg_wll_QueryOp *op)
-{
- int i = 0;
-
-
- while ( (src[i] != '\0') && isblank(src[i]) ) i++; /* skip whitespaces */
-
- if ( src[i] == '=' ) *op = EDG_WLL_QUERY_OP_EQUAL;
- else if ( src[i] == '@' ) *op = EDG_WLL_QUERY_OP_WITHIN;
- else if ( src[i] == '>' ) *op = EDG_WLL_QUERY_OP_GREATER;
- else if ( src[i] == '<' )
- {
- if ( (src[i+1] != '\0') && (src[++i] == '>') )
- *op = EDG_WLL_QUERY_OP_UNEQUAL;
- else
- *op = EDG_WLL_QUERY_OP_LESS;
- }
- else return NULL;
-
- return src+i+1;
-}
-
-static char *get_attr_value(char *src, char *dest, int sz)
-{
- int i = 0,
- ct = 0;
-
-
- while ( (src[i] != '\0') && isblank(src[i]) ) i++; /* skip whitespaces */
- if ( src[i] == '"' )
- {
- i++;
- while ( (src[i] != '\n') && (src[i] != '\0') && (src[i] != '"') )
- {
- if ( ct < sz )
- dest[ct++] = src[i];
- i++;
- }
- dest[ct] = '\0';
- if ( src[i] != '"' )
- return NULL;
-
- return src+i+1;
- }
-
- while ( (src[i] != '\n') && (src[i] != '\0') && (src[i] != ';') && !isblank(src[i]) )
- {
- if ( ct < sz )
- dest[ct++] = src[i];
- i++;
- }
- dest[ct] = '\0';
-
- return src+i;
-}
-
-static char *get_job_condition(char *src, edg_wll_QueryRec *cond)
-{
- char *s;
-
-
- s = get_attr_name(src, tmps, 500);
-
- if ( tmps[0] == '\0' ) return NULL;
-
- if ( !strcmp(tmps, "jobid") ) cond->attr = EDG_WLL_QUERY_ATTR_JOBID;
- else if ( !strcmp(tmps, "owner") ) cond->attr = EDG_WLL_QUERY_ATTR_OWNER;
- else if ( !strcmp(tmps, "status") ) cond->attr = EDG_WLL_QUERY_ATTR_STATUS;
- else if ( !strcmp(tmps, "location") ) cond->attr = EDG_WLL_QUERY_ATTR_LOCATION;
- else if ( !strcmp(tmps, "destination") ) cond->attr = EDG_WLL_QUERY_ATTR_DESTINATION;
- else if ( !strcmp(tmps, "done_code") ) cond->attr = EDG_WLL_QUERY_ATTR_DONECODE;
- else if ( !strcmp(tmps, "exit_code") ) cond->attr = EDG_WLL_QUERY_ATTR_EXITCODE;
- else if ( !strcmp(tmps, "parent_job") ) cond->attr = EDG_WLL_QUERY_ATTR_PARENT;
- else if ( !strcmp(tmps, "time") ) cond->attr = EDG_WLL_QUERY_ATTR_TIME;
- else
- {
- cond->attr = EDG_WLL_QUERY_ATTR_USERTAG;
- cond->attr_id.tag = strdup(tmps);
- }
-
- if ( !(s = get_op(s, &(cond->op))) ) return NULL;
-
- if ( !(s = get_attr_value(s, tmps, 500)) ) return NULL;
-
- switch ( cond->attr )
- {
- case EDG_WLL_QUERY_ATTR_JOBID:
- case EDG_WLL_QUERY_ATTR_PARENT:
- if ( edg_wlc_JobIdParse(tmps, &cond->value.j) )
- {
- fprintf(stderr,"%s: %s: cannot parse jobId\n", myname, tmps);
- return NULL;
- }
- break;
-
- case EDG_WLL_QUERY_ATTR_OWNER:
- if ( !strcmp("NULL", tmps) )
- cond->value.c = NULL;
- else if ( !(cond->value.c = strdup(tmps)) )
- return 0;
- break;
-
- case EDG_WLL_QUERY_ATTR_LOCATION:
- case EDG_WLL_QUERY_ATTR_DESTINATION:
- case EDG_WLL_QUERY_ATTR_USERTAG:
- if ( !(cond->value.c = strdup(tmps)) )
- return 0;
- break;
-
- case EDG_WLL_QUERY_ATTR_STATUS:
- if ( !strcasecmp(tmps, "Submitted") ) cond->value.i = EDG_WLL_JOB_SUBMITTED;
- else if ( !strcasecmp(tmps, "Waiting") ) cond->value.i = EDG_WLL_JOB_WAITING;
- else if ( !strcasecmp(tmps, "Ready") ) cond->value.i = EDG_WLL_JOB_READY;
- else if ( !strcasecmp(tmps, "Scheduled") ) cond->value.i = EDG_WLL_JOB_SCHEDULED;
- else if ( !strcasecmp(tmps, "Running") ) cond->value.i = EDG_WLL_JOB_RUNNING;
- else if ( !strcasecmp(tmps, "Done") ) cond->value.i = EDG_WLL_JOB_DONE;
- else if ( !strcasecmp(tmps, "Aborted") ) cond->value.i = EDG_WLL_JOB_ABORTED;
- else if ( !strcasecmp(tmps, "Cancelled") ) cond->value.i = EDG_WLL_JOB_CANCELLED;
- else if ( !strcasecmp(tmps, "Cleared") ) cond->value.i = EDG_WLL_JOB_CLEARED;
- else
- {
- fprintf(stderr,"%s: invalid status value (%s)\n", myname, tmps);
- return 0;
- }
- break;
-
- case EDG_WLL_QUERY_ATTR_DONECODE:
- case EDG_WLL_QUERY_ATTR_EXITCODE:
- case EDG_WLL_QUERY_ATTR_RESUBMITTED:
- cond->value.i = atoi(tmps);
- if ( cond->op == EDG_WLL_QUERY_OP_WITHIN )
- {
- if ( !(s = get_attr_value(s, tmps, 500)) ) return NULL;
- if ( tmps[0] == '\0' )
- {
- fprintf(stderr,"%s: second interval boundary not set\n", myname);
- return NULL;
- }
- cond->value2.i = atoi(tmps);
- }
- break;
-
- case EDG_WLL_QUERY_ATTR_TIME:
- cond->value.t.tv_sec = StrToTime(tmps);
- if ( cond->op == EDG_WLL_QUERY_OP_WITHIN )
- {
- if ( !(s = get_attr_value(s, tmps, 500)) ) return NULL;
- if ( tmps[0] == '\0' )
- {
- fprintf(stderr,"%s: second interval boundary not set\n", myname);
- return NULL;
- }
- cond->value2.t.tv_sec = StrToTime(tmps);
- }
- if ( !(s = get_attr_value(s, tmps, 500)) ) return NULL;
- if ( tmps[0] == '\0' )
- {
- fprintf(stderr,"%s: time condition must be associated with state condition\n", myname);
- return NULL;
- }
- if ( !strcasecmp(tmps, "Submitted") ) cond->attr_id.state = EDG_WLL_JOB_SUBMITTED;
- else if ( !strcasecmp(tmps, "Waiting") ) cond->attr_id.state = EDG_WLL_JOB_WAITING;
- else if ( !strcasecmp(tmps, "Ready") ) cond->attr_id.state = EDG_WLL_JOB_READY;
- else if ( !strcasecmp(tmps, "Scheduled") ) cond->attr_id.state = EDG_WLL_JOB_SCHEDULED;
- else if ( !strcasecmp(tmps, "Running") ) cond->attr_id.state = EDG_WLL_JOB_RUNNING;
- else if ( !strcasecmp(tmps, "Done") ) cond->attr_id.state = EDG_WLL_JOB_DONE;
- else if ( !strcasecmp(tmps, "Aborted") ) cond->attr_id.state = EDG_WLL_JOB_ABORTED;
- else if ( !strcasecmp(tmps, "Cancelled") ) cond->attr_id.state = EDG_WLL_JOB_CANCELLED;
- else if ( !strcasecmp(tmps, "Cleared") ) cond->attr_id.state = EDG_WLL_JOB_CLEARED;
- else
- {
- fprintf(stderr,"%s: invalid status value (%s)\n", myname, tmps);
- return 0;
- }
- break;
-
- default:
- break;
- }
-
- while ( isblank(*s) || (*s == ';') ) s++; /* skip whitespaces */
-
- return s;
-}
-
-static char *get_event_condition(char *src, edg_wll_QueryRec *cond)
-{
- char *s;
-
-
- s = get_attr_name(src, tmps, 500);
-
- if ( tmps[0] == '\0' ) return NULL;
-
- if ( !strcmp(tmps, "time") ) cond->attr = EDG_WLL_QUERY_ATTR_TIME;
- else if ( !strcmp(tmps, "level") ) cond->attr = EDG_WLL_QUERY_ATTR_LEVEL;
- else if ( !strcmp(tmps, "host") ) cond->attr = EDG_WLL_QUERY_ATTR_HOST;
- else if ( !strcmp(tmps, "source") ) cond->attr = EDG_WLL_QUERY_ATTR_SOURCE;
- else if ( !strcmp(tmps, "instance") ) cond->attr = EDG_WLL_QUERY_ATTR_INSTANCE;
- else if ( !strcmp(tmps, "event_type") ) cond->attr = EDG_WLL_QUERY_ATTR_EVENT_TYPE;
- else
- {
- cond->attr = EDG_WLL_QUERY_ATTR_USERTAG;
- cond->attr_id.tag = strdup(tmps);
- }
-
- if ( !(s = get_op(s, &(cond->op))) ) return NULL;
-
- if ( !(s = get_attr_value(s, tmps, 500)) ) return NULL;
-
- switch ( cond->attr )
- {
- case EDG_WLL_QUERY_ATTR_USERTAG:
- case EDG_WLL_QUERY_ATTR_HOST:
- case EDG_WLL_QUERY_ATTR_INSTANCE:
- if ( !(cond->value.c = strdup(tmps)) )
- return 0;
- break;
-
- case EDG_WLL_QUERY_ATTR_SOURCE:
- if ( !strcasecmp(tmps, "UserInterface") ) cond->value.i = EDG_WLL_SOURCE_USER_INTERFACE;
- else if ( !strcasecmp(tmps, "NetworkServer") ) cond->value.i = EDG_WLL_SOURCE_NETWORK_SERVER;
- else if ( !strcasecmp(tmps, "WorkloadManager") ) cond->value.i = EDG_WLL_SOURCE_WORKLOAD_MANAGER;
- else if ( !strcasecmp(tmps, "BigHelper") ) cond->value.i = EDG_WLL_SOURCE_BIG_HELPER;
- else if ( !strcasecmp(tmps, "JobController") ) cond->value.i = EDG_WLL_SOURCE_JOB_SUBMISSION;
- else if ( !strcasecmp(tmps, "LogMonitor") ) cond->value.i = EDG_WLL_SOURCE_LOG_MONITOR;
- else if ( !strcasecmp(tmps, "LRMS") ) cond->value.i = EDG_WLL_SOURCE_LRMS;
- else if ( !strcasecmp(tmps, "Application") ) cond->value.i = EDG_WLL_SOURCE_APPLICATION;
- else
- {
- fprintf(stderr,"%s: invalid source value (%s)\n", myname, tmps);
- return NULL;
- }
- break;
-
- case EDG_WLL_QUERY_ATTR_EVENT_TYPE:
- case EDG_WLL_QUERY_ATTR_LEVEL:
- cond->value.i = atoi(tmps);
- if ( cond->op == EDG_WLL_QUERY_OP_WITHIN )
- {
- if ( !(s = get_attr_value(s, tmps, 500)) ) return NULL;
- if ( tmps[0] == '\0' )
- {
- fprintf(stderr,"%s: second interval boundary not set\n", myname);
- return NULL;
- }
- cond->value2.i = atoi(tmps);
- }
- break;
-
- case EDG_WLL_QUERY_ATTR_TIME:
- cond->value.t.tv_sec = StrToTime(tmps);
- if ( cond->op == EDG_WLL_QUERY_OP_WITHIN )
- {
- if ( !(s = get_attr_value(s, tmps, 500)) ) return NULL;
- if ( tmps[0] == '\0' )
- {
- fprintf(stderr,"%s: second interval boundary not set\n", myname);
- return NULL;
- }
- cond->value2.t.tv_sec = StrToTime(tmps);
- }
- break;
-
- default:
- break;
- }
-
- while ( isblank(*s) || (*s == ';') ) s++; /* skip whitespaces */
-
- return s;
-}
-
-static int cond_parse(edg_wll_QueryRec ***pcond, int jobs)
-{
- edg_wll_QueryRec **cond = NULL;
- int n,
- icond,
- ret;
- char *s;
-
-
-
- n = 0;
- if ( !(cond = malloc(sizeof(*cond))) )
- {
- perror("cond_parse()");
- exit(ENOMEM);
- }
-
- while ( 1 )
- {
- if ( !fgets(buffer, BUFF_LEN, fin) )
- {
- if ( !feof(fin) )
- {
- fprintf(stderr, "parse_query_cond(): file reading error\n");
- exit(EINVAL);
- }
-
- ret = PQRV_EOF;
- goto cleanup;
- }
-
- if ( buffer[0] == '\n' )
- {
- ret = PQRV_EMPTY_LINE;
- goto cleanup;
- }
-
- if ( !(cond[n] = (edg_wll_QueryRec *) malloc(sizeof(edg_wll_QueryRec))) )
- {
- perror("cond_parse()");
- exit(ENOMEM);
- }
- s = buffer;
- icond = 0;
- while ( 1 )
- {
- if ( jobs )
- s = get_job_condition(s, &(cond[n][icond]));
- else
- s = get_event_condition(s, &(cond[n][icond]));
-
- if ( !s )
- {
- free(cond[n]);
- cond[n] = NULL;
- ret = PQRV_ERR;
- goto cleanup;
- }
- icond++;
- if ( !(cond[n] = realloc(cond[n], (icond+1)*sizeof(edg_wll_QueryRec))) )
- {
- perror("cond_parse()");
- exit(ENOMEM);
- }
- cond[n][icond].attr = EDG_WLL_QUERY_ATTR_UNDEF;
- if ( (*s == '\n') || (*s == '\0') )
- break;
- }
-
- n++;
- if ( !(cond = realloc(cond, (n+1)*sizeof(*cond))) )
- {
- perror("cond_parse()");
- exit(ENOMEM);
- }
- cond[n] = NULL;
- }
-
-cleanup:
- if ( !n )
- {
- free(cond);
- *pcond = NULL;
- }
- else
- *pcond = cond;
-
- return ret;
-}
-
-static void printconds(edg_wll_QueryRec **cond)
-{
- int i, j;
- int any = 0;
- char *s;
-
-
- if ( !cond )
- {
- printf("empty\n");
- return ;
- }
-
- for ( i = 0; cond[i]; i++ )
- {
- if ( cond[i][0].attr )
- {
- any = 1;
- if ( i )
- printf(" AND (");
- else
- printf("(");
- }
- for ( j = 0; cond[i][j].attr; j++ )
- {
- if ( j )
- printf(" OR ");
- switch ( cond[i][j].attr )
- {
- case EDG_WLL_QUERY_ATTR_JOBID: printf("jobid"); break;
- case EDG_WLL_QUERY_ATTR_OWNER: printf("owner"); break;
- case EDG_WLL_QUERY_ATTR_STATUS: printf("status"); break;
- case EDG_WLL_QUERY_ATTR_LOCATION: printf("location"); break;
- case EDG_WLL_QUERY_ATTR_DESTINATION: printf("destination"); break;
- case EDG_WLL_QUERY_ATTR_DONECODE: printf("done_code"); break;
- case EDG_WLL_QUERY_ATTR_EXITCODE: printf("exit_code"); break;
- case EDG_WLL_QUERY_ATTR_PARENT: printf("parent_job"); break;
- case EDG_WLL_QUERY_ATTR_RESUBMITTED: printf("resubmitted"); break;
- case EDG_WLL_QUERY_ATTR_USERTAG: printf("%s",cond[i][j].attr_id.tag); break;
- case EDG_WLL_QUERY_ATTR_TIME: printf("time"); break;
- case EDG_WLL_QUERY_ATTR_LEVEL: printf("level"); break;
- case EDG_WLL_QUERY_ATTR_HOST: printf("host"); break;
- case EDG_WLL_QUERY_ATTR_SOURCE: printf("source"); break;
- case EDG_WLL_QUERY_ATTR_INSTANCE: printf("instance"); break;
- case EDG_WLL_QUERY_ATTR_EVENT_TYPE: printf("ev_type"); break;
- default: break;
- }
- switch ( cond[i][j].op )
- {
- case EDG_WLL_QUERY_OP_EQUAL: printf("="); break;
- case EDG_WLL_QUERY_OP_UNEQUAL: printf("<>"); break;
- case EDG_WLL_QUERY_OP_LESS: printf("<"); break;
- case EDG_WLL_QUERY_OP_GREATER: printf(">"); break;
- case EDG_WLL_QUERY_OP_WITHIN: printf("@"); break;
- }
- switch ( cond[i][j].attr )
- {
- case EDG_WLL_QUERY_ATTR_JOBID:
- case EDG_WLL_QUERY_ATTR_PARENT:
- s = edg_wlc_JobIdUnparse(cond[i][j].value.j);
- printf("%s", s);
- free(s);
- break;
- case EDG_WLL_QUERY_ATTR_OWNER:
- case EDG_WLL_QUERY_ATTR_LOCATION:
- case EDG_WLL_QUERY_ATTR_DESTINATION:
- case EDG_WLL_QUERY_ATTR_HOST:
- case EDG_WLL_QUERY_ATTR_INSTANCE:
- case EDG_WLL_QUERY_ATTR_USERTAG:
- printf("%s", cond[i][j].value.c);
- break;
- case EDG_WLL_QUERY_ATTR_STATUS:
- case EDG_WLL_QUERY_ATTR_DONECODE:
- case EDG_WLL_QUERY_ATTR_EXITCODE:
- case EDG_WLL_QUERY_ATTR_RESUBMITTED:
- case EDG_WLL_QUERY_ATTR_SOURCE:
- if ( cond[i][j].op == EDG_WLL_QUERY_OP_WITHIN )
- printf("[%d,%d]", cond[i][j].value.i, cond[i][j].value2.i);
- else
- printf("%d", cond[i][j].value.i);
- break;
- case EDG_WLL_QUERY_ATTR_TIME:
- if ( cond[i][j].op == EDG_WLL_QUERY_OP_WITHIN )
- {
- printf("[%s,", TimeToStr(cond[i][j].value.t.tv_sec));
- printf("%s] & state = %d", TimeToStr(cond[i][j].value2.t.tv_sec), cond[i][j].attr_id.state);
- }
- else
- printf("%s & state = %d", TimeToStr(cond[i][j].value.t.tv_sec), cond[i][j].attr_id.state);
- break;
- default:
- break;
- }
- }
- if ( j )
- printf(")");
- }
- if ( any ) printf("\n");
-}
-
-static void printstat(edg_wll_JobStat stat)
-{
- char *s, *j;
-
-
- s = edg_wll_StatToString(stat.state);
- printf("STATUS:\t%s\n\n",s);
-/* print whole flat structure */
- printf("state : %s\n", s);
- printf("jobId : %s\n", j = edg_wlc_JobIdUnparse(stat.jobId));
- printf("owner : %s\n", stat.owner);
- printf("jobtype : %d\n", stat.jobtype);
- if (stat.jobtype) {;
- printf("seed : %s\n", stat.seed);
- printf("children_num : %d\n", stat.children_num);
-// XXX deal with subjobs (children, children_hist, children_states)
- }
- printf("condorId : %s\n", stat.condorId);
- printf("globusId : %s\n", stat.globusId);
- printf("localId : %s\n", stat.localId);
- printf("jdl : %s\n", stat.jdl);
- printf("matched_jdl : %s\n", stat.matched_jdl);
- printf("destination : %s\n", stat.destination);
- printf("network server : %s\n", stat.network_server);
- printf("condor_jdl : %s\n", stat.condor_jdl);
- printf("rsl : %s\n", stat.rsl);
- printf("reason : %s\n", stat.reason);
- printf("location : %s\n", stat.location);
- printf("ce_node : %s\n", stat.ce_node);
- printf("subjob_failed : %d\n", stat.subjob_failed);
- printf("done_code : %d\n", stat.done_code);
- printf("exit_code : %d\n", stat.exit_code);
- printf("resubmitted : %d\n", stat.resubmitted);
- printf("cancelling : %d\n", stat.cancelling);
- printf("cancelReason : %s\n", stat.cancelReason);
- printf("cpuTime : %d\n", stat.cpuTime);
-// XXX user_tags user_values
- printf("stateEnterTime : %ld.%06ld\n", stat.stateEnterTime.tv_sec,stat.stateEnterTime.tv_usec);
- printf("lastUpdateTime : %ld.%06ld\n", stat.lastUpdateTime.tv_sec,stat.lastUpdateTime.tv_usec);
- printf("expectUpdate : %d\n", stat.expectUpdate);
- printf("expectFrom : %s\n", stat.expectFrom);
-
- free(j);
- free(s);
-}
-
-time_t StrToTime(char *t)
-{
- struct tm tm;
-
- memset(&tm,0,sizeof(tm));
- setenv("TZ","UTC",1);
- tzset();
- sscanf(t,"%4d-%02d-%02d %02d:%02d:%02d",
- &tm.tm_year,&tm.tm_mon,&tm.tm_mday,
- &tm.tm_hour,&tm.tm_min,&tm.tm_sec);
- tm.tm_year -= 1900;
- tm.tm_mon--;
-
- return mktime(&tm);
-}
-
-static char tbuf[256];
-
-char *TimeToStr(time_t t)
-{
- struct tm *tm = gmtime(&t);
-
- sprintf(tbuf,"'%4d-%02d-%02d %02d:%02d:%02d'",
- tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday,
- tm->tm_hour,tm->tm_min,tm->tm_sec);
-
- return tbuf;
-}
-
-static void dgerr(edg_wll_Context ctx, char *where)
-{
- char *errText,
- *errDesc;
-
-
- edg_wll_Error(ctx, &errText, &errDesc);
- fprintf(stderr, "%s", errText);
- if ( where )
- fprintf(stderr, ": %s", where);
- if ( errDesc )
- fprintf(stderr, " (%s)\n", errDesc);
- else
- putc('\n', stderr);
- free(errText);
- free(errDesc);
-}
-
+++ /dev/null
-#include <getopt.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-
-#include <globus_common.h>
-
-#include "glite/wmsutils/jobid/cjobid.h"
-#include "glite/lb/consumer.h"
-
-
-static struct option opts[] = {
- {"help", 0, NULL, 'h'},
- {"sock", 1, NULL, 's'},
- {"jobid", 1, NULL, 'j'},
-};
-
-static void usage(char *me)
-{
- fprintf(stderr, "usage: %s [option]\n"
- "\t-h, --help Shows this screen.\n"
- "\t-s, --server LB Proxy socket.\n"
- "\t-j, --jobid ID of requested job.\n"
- , me);
-}
-
-
-int main(int argc, char *argv[])
-{
- edg_wll_Context ctx;
- edg_wlc_JobId jobid = NULL;
- char *server, *jobid_s, *code;
- int opt, err = 0;
-
-
- server = code = jobid_s = NULL;
- while ( (opt = getopt_long(argc, argv, "hs:j:c:n:v:", opts, NULL)) != EOF)
- switch (opt) {
- case 'h': usage(argv[0]); return 0;
- case 's': server = strdup(optarg); break;
- case 'j': jobid_s = strdup(optarg); break;
- case '?': usage(argv[0]); return 1;
- }
-
- if ( !jobid_s ) { fprintf(stderr, "JobId not given\n"); return 1; }
- if ( !server ) { fprintf(stderr, "LB proxy socket not given\n"); return 1; }
-
- if ( (errno = edg_wlc_JobIdParse(jobid_s, &jobid)) ) { perror(jobid_s); return 1; }
-
- if (globus_module_activate(GLOBUS_COMMON_MODULE) != GLOBUS_SUCCESS) {
- fprintf(stderr, "Cannot initialize Globus common module\n");
- exit(1);
- }
-
- edg_wll_InitContext(&ctx);
-
- edg_wll_SetParam(ctx, EDG_WLL_PARAM_SOURCE, EDG_WLL_SOURCE_USER_INTERFACE);
- edg_wll_SetParam(ctx, EDG_WLL_PARAM_LBPROXY_SERVE_SOCK, server);
-
-/*
- if (edg_wll_SetLoggingJob(ctx, jobid, code, EDG_WLL_SEQ_NORMAL)) {
- char *et,*ed;
- edg_wll_Error(ctx,&et,&ed);
- fprintf(stderr,"SetLoggingJob(%s,%s): %s (%s)\n",jobid_s,code,et,ed);
- exit(1);
- }
-*/
- if ( (err = edg_wll_QuerySequenceCodeProxy(ctx, jobid, &code)) ) {
- char *et,*ed;
-
- edg_wll_Error(ctx,&et,&ed);
- fprintf(stderr,"%s: edg_wll_QuerySequenceCodeProxy(): %s (%s)\n",
- argv[0],et,ed);
- free(et); free(ed);
- }
-
- if ( code ) {
- puts(code);
- free(code);
- }
-
- edg_wll_FreeContext(ctx);
-
- return err;
-}
+++ /dev/null
-# macro definition for WAITING state
-
-:waiting:
-# NetworkServer
-
--s NetworkServer,-e EnQueued, --queue="destination queue", --job="job description in receiver language", --result=OK, --reason="detailed description of transfer"
-# -s NetworkServer,-e Transfer,--destination="WorkloadManager",--dest_host="destination hostname",--dest_instance="destination instance",--dest_jobid="job description in receiver language",--result=OK,--reason="detailed description of transfer",--dest_jobid="destination internal jobid"
-
-# WorkloadManager
-
--s WorkloadManager,-e DeQueued, --queue="queue name", --local_jobid="new jobId assigned by the receiving component"
--s WorkloadManager,-e HelperCall, --helper_name="name of the called component",--helper_params="parameters of the call", --src_role=CALLING
-#-s Helper,-e HelperCall, --helper_name="name of the called component",--helper_params="parameters of the call", --src_role=CALLED
-#-s Helper,-e HelperReturn, --helper_name="name of the called component",--retval="returned data", --src_role=CALLED
--s WorkloadManager,-e Match,--dest_id="${DESTINATION:-destination CE/queue}"
--s WorkloadManager,-e HelperReturn, --helper_name="name of the called component",--retval="returned data", --src_role=CALLING
--s WorkloadManager,-e EnQueued, --queue="destination queue", --job="job description in receiver language", --result=OK, --reason="detailed description of transfer"
-
+++ /dev/null
-# macro definition for WAITING state
-
-:waiting_dag:
-# NetworkServer
-
--s NetworkServer,-e EnQueued, --queue="destination queue", --job="job description in receiver language", --result=OK, --reason="detailed description of transfer"
-
-# WorkloadManager
-
--s WorkloadManager,-e DeQueued, --queue="queue name", --local_jobid="new jobId assigned by the receiving component"
-
--s WorkloadManager,-e EnQueued, --queue="destination queue", --job="job description in receiver language", --result=OK, --reason="detailed description of transfer"
-
+++ /dev/null
-# macro definition for WAITING state
-
-:waiting_subjob:
-# WorkloadManager
-
--s WorkloadManager,-e Match,--dest_id="Id of the destination CE/queue"
--s WorkloadManager,-e HelperReturn, --helper_name="name of the called component",--retval="returned data", --src_role=CALLING
-
+++ /dev/null
-# one resubmission cycle
-
--s LogMonitor,-e EnQueued, --queue="wm_input.fl", --job="job description in receiver language", --result=OK, --reason="detailed description of transfer"
-
--s WorkloadManager,-e DeQueued, --queue="wm_input.fl", --local_jobid="WM_ID"
--s WorkloadManager, -e Resubmission, --result=${RESUB:-WILLRESUB}, --reason="let's try again", --tag=none
--s WorkloadManager,-e HelperCall, --helper_name="name of the called component",--helper_params="parameters of the call", --src_role=CALLING
--s WorkloadManager,-e Match,--dest_id="${DESTINATION:-destination CE/queue}"
--s WorkloadManager,-e HelperReturn, --helper_name="name of the called component",--retval="returned data", --src_role=CALLING
--s WorkloadManager,-e EnQueued, --queue="wm_output.fl", --job="job description in receiver language", --result=OK, --reason="detailed description of transfer"
-
--s JobController,-e DeQueued, --queue="wm_output.fl", --local_jobid="JC_ID"
--s JobController,-e Transfer,--destination="LRMS",--dest_host="destination hostname",--dest_instance="destination instance",--dest_jobid="job description in receiver language",--result=OK,--reason="detailed description of transfer",--dest_jobid="destination internal jobid"
-
--s LogMonitor,-e Accepted, --from="JobController", --from_host="sending component hostname", --from_instance="sending component instance", --local_jobid="new jobId (Condor, Globus ...)"
--s LogMonitor,-e Transfer,--destination="LRMS",--dest_host="destination hostname",--dest_instance="destination instance",--dest_jobid="job description in receiver language",--result=OK,--reason="detailed description of transfer",--dest_jobid="destination internal jobid"
-
--s LogMonitor,-e Running,--node="${CE_NODE:-worker node}"
-
+++ /dev/null
-# resubmitted job example
-
-! DESTINATION=CE1/queue1
-! CE_NODE=worker1
-:running:
-
--s LogMonitor, -e Done, --status_code=FAILED, --reason="reason for the change", --exit_code=141
--s LogMonitor, -e Resubmission, --result=WILLRESUB, --reason="let's try again", --tag=none
-
-! DESTINATION=CE2/queue2
-! CE_NODE=worker2
-:resubmission_deep:
-
--s LogMonitor, -e Done, --status_code=FAILED, --reason="reason for the change", --exit_code=141
--s LogMonitor, -e Resubmission, --result=WILLRESUB, --reason="let's try again", --tag=none
-
-! DESTINATION=CE3/queue3
-! CE_NODE=worker3
-:resubmission_deep:
-
+++ /dev/null
-# macro definition for RUNNING state
-
-:scheduled:
--s LogMonitor,-e Running,--node="${CE_NODE:-worker node}"
+++ /dev/null
-# macro definition for RUNNING state
-
-:scheduled_dag:
--s LogMonitor,-e Running,--node"DAGMan running on server"
+++ /dev/null
-# macro definition for RUNNING state
-
-:scheduled_subjob:
--s LogMonitor,-e Running,--node"worker node where the executable is run"
+++ /dev/null
-# macro definition for SCHEDULED state
-
-:ready:
-# JobSubmition
-
--s JobController,-e DeQueued, --queue="queue name", --local_jobid="new jobId assigned by the receiving component"
--s JobController,-e Transfer,--destination="LRMS",--dest_host="destination hostname",--dest_instance="destination instance",--dest_jobid="job description in receiver language",--result=OK,--reason="detailed description of transfer",--dest_jobid="destination internal jobid"
-
-# LogMonitor
-
--s LogMonitor,-e Accepted, --from="JobController", --from_host="sending component hostname", --from_instance="sending component instance", --local_jobid="new jobId (Condor, Globus ...)"
--s LogMonitor,-e Transfer,--destination="LRMS",--dest_host="destination hostname",--dest_instance="destination instance",--dest_jobid="job description in receiver language",--result=OK,--reason="detailed description of transfer",--dest_jobid="destination internal jobid"
-
+++ /dev/null
-# macro definition for SCHEDULED state
-
-:ready_dag:
-# JobSubmition
-
--s JobController,-e DeQueued, --queue="queue name", --local_jobid="new jobId assigned by the receiving component"
--s JobController,-e Transfer,--destination="LogMonitor",--dest_host="destination hostname",--dest_instance="destination instance",--dest_jobid="job description in receiver language",--result=START,--reason="detailed description of transfer",--dest_jobid="destination internal jobid"
-
-# LogMonitor
-
--s LogMonitor,-e Accepted, --from="JobController", --from_host="sending component hostname", --from_instance="sending component instance", --local_jobid="new jobId (Condor, Globus ...)"
-
+++ /dev/null
-# macro definition for SCHEDULED state
-
-:ready_subjob:
-# LogMonitor
-
--s LogMonitor,-e Transfer,--destination="LRMS",--dest_host="destination hostname",--dest_instance="destination instance",--dest_jobid="job description in receiver language",--result=OK,--reason="detailed description of transfer",--dest_jobid="destination internal jobid"
-
+++ /dev/null
-# shallow resubmission job example
-
-! DESTINATION=CE1/queue1
-! CE_NODE=worker1
-:running:
-
--s LogMonitor, -e Done, --status_code=FAILED, --reason="reason for the change", --exit_code=141
--s LogMonitor, -e Resubmission, --result=WILLRESUB, --reason="let's try again", --tag=none
-
-! DESTINATION=CE2/queue2
-! CE_NODE=worker2
-! RESUB=SHALLOW
-:resubmission:
-
--s LogMonitor, -e Done, --status_code=FAILED, --reason="reason for the change", --exit_code=141
--s LogMonitor, -e Resubmission, --result=WILLRESUB, --reason="let's try again", --tag=none
-
-! DESTINATION=CE3/queue3
-! CE_NODE=worker3
-! RESUB=SHALLOW
-:resubmission:
-
--s LogMonitor, -e ReallyRunning, --wn_seq="$EDG_WL_SEQUENCE"
-
-# deep resubmission
-
--s LogMonitor, -e Done, --status_code=FAILED, --reason="reason for the change", --exit_code=141
--s LogMonitor, -e Resubmission, --result=WILLRESUB, --reason="let's try again", --tag=none
-
-! DESTINATION=CE2/queue2
-! CE_NODE=worker2
-! RESUB=DEEP
-:resubmission:
-
-# payload_running=false
-# destination=CE2/queue2
-# ce_node=worker2
-# possible_destinations=CE2/queue2
-# possible_ce_nodes=worker2
-
+++ /dev/null
-# shallow resubmission job example
-
-! DESTINATION=CE1/queue1
-! CE_NODE=worker1
-! RESUB=SHALLOW
-:running:
-
--s LogMonitor, -e Done, --status_code=FAILED, --reason="reason for the change", --exit_code=141
--s LogMonitor, -e Resubmission, --result=WILLRESUB, --reason="let's try again", --tag=none
-
-! DESTINATION=CE2/queue2
-! CE_NODE=worker2
-! RESUB=SHALLOW
-:resubmission:
-! BRANCH_SEQUENCE="$EDG_WL_SEQUENCE"
-
--s LogMonitor, -e Done, --status_code=FAILED, --reason="reason for the change", --exit_code=141
--s LogMonitor, -e Resubmission, --result=WILLRESUB, --reason="let's try again", --tag=none
-
-! DESTINATION=CE3/queue3
-! CE_NODE=worker3
-! RESUB=SHALLOW
-:resubmission:
-
--s LogMonitor, -e ReallyRunning, --wn_seq="$BRANCH_SEQUENCE"
-
-# payload_running=true
-# destination=CE2/queue2
-# ce_node=worker2
-# possible_destinations=CE1/queue1 CE2/queue2 CE3/queue3
-# possible_ce_nodes=worker1 worker2 worker3
-
-# deep resubmission
-
--s LogMonitor, -e Done, --status_code=FAILED, --reason="reason for the change", --exit_code=141
--s LogMonitor, -e Resubmission, --result=WILLRESUB, --reason="let's try again", --tag=none
-
-! DESTINATION=CE4/queue4
-! CE_NODE=worker4
-! RESUB=DEEP
-:resubmission:
-
-# payload_running=false
-# destination=CE4/queue4
-# ce_node=worker4
-# possible_destinations=CE4/queue4
-# possible_ce_nodes=worker4
-
+++ /dev/null
-# shallow resubmission job example
-
-! DESTINATION=CE1/queue1
-! CE_NODE=worker1
-:running:
-
--s LogMonitor, -e Done, --status_code=FAILED, --reason="reason for the change", --exit_code=141
--s LogMonitor, -e Resubmission, --result=WILLRESUB, --reason="let's try again", --tag=none
-
-! DESTINATION=CE2/queue2
-! CE_NODE=worker2
-! RESUB=SHALLOW
-:resubmission:
-
--s LogMonitor, -e Done, --status_code=FAILED, --reason="reason for the change", --exit_code=141
--s LogMonitor, -e Resubmission, --result=WILLRESUB, --reason="let's try again", --tag=none
-
-! DESTINATION=CE3/queue3
-! CE_NODE=worker3
-! RESUB=SHALLOW
-:resubmission:
-
--s LogMonitor, -e ReallyRunning, --wn_seq="$EDG_WL_SEQUENCE"
-
-# payload_running=true
-# destination=CE3/queue3
-# ce_node=worker3
-# possible_destinations=CE1/queue1 CE2/queue2 CE3/queue3
-# possible_ce_nodes=worker1 worker2 worker3
-
+++ /dev/null
-# shallow resubmission job example
-
-! DESTINATION=CE1/queue1
-! CE_NODE=worker1
-:running:
-
--s LogMonitor, -e Done, --status_code=FAILED, --reason="reason for the change", --exit_code=141
--s LogMonitor, -e Resubmission, --result=WILLRESUB, --reason="let's try again", --tag=none
-
-! DESTINATION=CE2/queue2
-! CE_NODE=worker2
-! RESUB=SHALLOW
-:resubmission:
-! BRANCH_SEQUENCE="$EDG_WL_SEQUENCE"
-
--s LogMonitor, -e Done, --status_code=FAILED, --reason="reason for the change", --exit_code=141
--s LogMonitor, -e Resubmission, --result=WILLRESUB, --reason="let's try again", --tag=none
-
-! DESTINATION=CE3/queue3
-! CE_NODE=worker3
-! RESUB=SHALLOW
-:resubmission:
-
--s LogMonitor, -e ReallyRunning, --wn_seq="$BRANCH_SEQUENCE"
-
-# payload_running=true
-# destination=CE2/queue2
-# ce_node=worker2
-# possible_destinations=CE1/queue1 CE2/queue2 CE3/queue3
-# possible_ce_nodes=worker1 worker2 worker3
-
+++ /dev/null
-#include <stdio.h>
-#include <time.h>
-#include <string.h>
-
-#include "glite/lb/statistics.h"
-
-
-int main(int argc,char **argv)
-{
- edg_wll_Context ctx;
- edg_wll_QueryRec group[2];
- time_t now,from,to;
- char *cfrom,*cto;
- int from_res,to_res;
- float val;
-
-
- edg_wll_InitContext(&ctx);
-
- if (argc != 2) {
- fprintf(stderr,"usage: %s <CE name>\n",argv[0]);
- return 1;
- }
-
-/* the only supported grouping for now */
- group[0].attr = EDG_WLL_QUERY_ATTR_DESTINATION;
- group[0].op = EDG_WLL_QUERY_OP_EQUAL;
- group[0].value.c = argv[1];
- group[1].attr = EDG_WLL_QUERY_ATTR_UNDEF;
-
-
- time(&now);
- to = now;
- from = now - 60;
-
-/* not implemented yet
- if (edg_wll_StateDuration(ctx,group,EDG_WLL_JOB_SCHEDULED,0,
- &from,&to,&val,&from_res,&to_res))
- {
- char *et,*ed;
- edg_wll_Error(ctx,&et,&ed);
- fprintf(stderr,"edg_wll_StateDuration(): %s, %s\n",et,ed);
- return 1;
- }
-
- cfrom = strdup(ctime(&from));
- cto = strdup(ctime(&to));
- cfrom[strlen(cfrom)-1] = 0;
- cto[strlen(cto)-1] = 0;
-
- printf("Average queue traversal time at \"%s\": %f s\n"
- " Measuered from %s to %s\n"
- " With resolution from %d to %d s\n",
- argv[1],val,cfrom,cto,from_res,to_res);
-
-*/
-
- to = now;
- from = now - 60;
-
- if (edg_wll_StateRate(ctx,group,EDG_WLL_JOB_DONE,EDG_WLL_STAT_FAILED,
- &from,&to,&val,&from_res,&to_res))
- {
- char *et,*ed;
- edg_wll_Error(ctx,&et,&ed);
- fprintf(stderr,"edg_wll_StateRate(): %s, %s\n",et,ed);
- return 1;
- }
-
- cfrom = strdup(ctime(&from));
- cto = strdup(ctime(&to));
- cfrom[strlen(cfrom)-1] = 0;
- cto[strlen(cto)-1] = 0;
-
- printf("Average failure rate at \"%s\": %f jobs/s\n"
- " Measuered from %s to %s\n"
- " With resolution from %d to %d s\n",
- argv[1],val,cfrom,cto,from_res,to_res);
-
- return 0;
-}
-
+++ /dev/null
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <signal.h>
-#include <limits.h>
-
-#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<nerrors; i++)
- fprintf(errf,"%d %s %s\n",errors[i].err,errors[i].text,errors[i].desc);
-
- fprintf(errf,"\n%d errors, %d successful attempts\n",nerrors,good);
-
- fclose(errf);
- exit(0);
-}
-
-static void usage(const char *me)
-{
- fprintf(stderr,"usage: %s [-n nproc] [-o outfile] jobid\n",me);
-}
-
-int main(int argc,char **argv)
-{
- int nproc = 10,opt,i;
-
- while ((opt = getopt(argc,argv,"n:o:")) != -1) switch (opt) {
- case 'n': nproc = atoi(optarg); break;
- case 'o': outfile = optarg; break;
- case '?': usage(argv[0]); exit(1);
- }
-
- if (optind != argc-1) { usage(argv[0]); exit(1); }
-
- if (edg_wlc_JobIdParse(argv[optind],&job)) {
- fprintf(stderr,"%s: can't parse\n",argv[optind]);
- exit(1);
- }
-
- signal(SIGTERM,killslaves);
- signal(SIGINT,killslaves);
- signal(SIGHUP,killslaves);
- signal(SIGCHLD,SIG_IGN);
-
- if (nproc == 1) slave(0);
- else for (i=0; i<nproc; i++) switch(fork()) {
- case -1: perror("fork()"); exit(1);
- case 0: slave(i); /* don't return */
- default: break;
- }
-
- puts("Slaves started, press Ctrl-C to stop");
-
- while(1) pause();
-}
+++ /dev/null
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-#include <fcntl.h>
-
-#include "glite/wmsutils/jobid/cjobid.h"
-#include "glite/lb/producer.h"
-#include "glite/lb/events.h"
-
-#define MAXMSGSIZE 10240
-
-extern char *optarg;
-extern int opterr,optind;
-
-extern int edg_wll_DoLogEvent(edg_wll_Context context, edg_wll_LogLine logline);
-extern int edg_wll_DoLogEventProxy(edg_wll_Context context, edg_wll_LogLine logline);
-
-static const char *me;
-
-static void usage()
-{
- fprintf(stderr,"usage: %s -m bkserver [-x] [-N numjobs] [-n subjobs (each)] -f file_name \n", me);
-}
-
-int main(int argc, char *argv[])
-{
- char *job = NULL,*server = NULL,*seq = NULL,*filename = NULL;
- char buf[MAXMSGSIZE];
- int lbproxy = 0, num_subjobs = 0;
- int done = 0, njobs = 1,i;
- edg_wll_Context ctx;
- edg_wlc_JobId jobid,*subjobs;
- FILE *f;
-
- edg_wll_InitContext(&ctx);
-
- opterr = 0;
-
- me = strdup(argv[0]);
-
- do {
- switch (getopt(argc,argv,"m:xN:n:f:")) {
- case 'm': server = strdup(optarg); break;
- case 'x': lbproxy = 1; break;
- case 'N': njobs = atoi(optarg); break;
- case 'n': num_subjobs = atoi(optarg); break;
- case 'f': filename = (char *) strdup(optarg); break;
- case '?': usage(); exit(EINVAL);
- case -1: done = 1; break;
- }
- } while (!done);
-
- if (!server) {
- fprintf(stderr,"%s: -m required\n",me);
- usage();
- exit(1);
- }
-
- if ((njobs <= 0) || (num_subjobs)) {
- fprintf(stderr,"%s: wrong number of jobs\n",me);
- usage();
- exit(1);
- }
-
- if (!filename) {
- fprintf(stderr,"%s: -f required\n",me);
- usage();
- exit(1);
- }
-
- if ( (f = fopen(filename,"r")) == NULL) {
- perror(filename);
- exit(1);
- }
-
-/* MAIN LOOP */
-for (i = 1; i<njobs; i++) {
- /* create jobid */
- if (!job) {
- char *p = strchr(server,':');
- if (p) *p=0;
- edg_wlc_JobIdCreate(server,p?atoi(p+1):0,&jobid);
- job = edg_wlc_JobIdUnparse(jobid);
- fprintf(stdout,"new jobid: %s\n",job);
- }
- else if ((errno = edg_wlc_JobIdParse(job,&jobid))) {
- perror(job);
- exit(1);
- }
-
- /* register */
- edg_wll_SetParam(ctx,EDG_WLL_PARAM_SOURCE,EDG_WLL_SOURCE_USER_INTERFACE);
- // edg_wll_SetParam(ctx,EDG_WLL_PARAM_SOURCE,edg_wll_StringToSource(src));
-
- if (lbproxy) {
- if (edg_wll_RegisterJobProxy(ctx,jobid,
- num_subjobs?EDG_WLL_REGJOB_COLLECTION:EDG_WLL_REGJOB_SIMPLE,
- "JDL: blabla", "NNNSSSS",
- num_subjobs,NULL,&subjobs))
- {
- char *et,*ed;
- edg_wll_Error(ctx,&et,&ed);
- fprintf(stderr,"edg_wll_RegisterJobProxy(%s): %s (%s)\n",job,et,ed);
- exit(1);
- }
- } else {
- if (edg_wll_RegisterJobSync(ctx,jobid,
- num_subjobs?EDG_WLL_REGJOB_COLLECTION:EDG_WLL_REGJOB_SIMPLE,
- "JDL: blabla", "NNNSSSS",
- num_subjobs,NULL,&subjobs))
- {
- char *et,*ed;
- edg_wll_Error(ctx,&et,&ed);
- fprintf(stderr,"edg_wll_RegisterJobSync(%s): %s (%s)\n",job,et,ed);
- exit(1);
- }
- }
-
- /* log events */
- while (!feof(f)) {
- edg_wll_LogLine logline;
-
- if (!fgets(buf,sizeof(buf),f)) break;
- if (strcmp(buf,"\n")) {
- // fprintf(stdout,"%d: %s\n",i,buf);
- asprintf(&logline,"DG.JOBID=\"%s\" %s",job,buf);
- if (lbproxy) {
- if (edg_wll_DoLogEventProxy(ctx,logline)) {
- char *et,*ed;
- edg_wll_Error(ctx,&et,&ed);
- fprintf(stderr,"edg_wll_DoLogEventProxy(): %s (%s)\n",et,ed);
- exit(1);
- }
- } else {
- if (edg_wll_DoLogEvent(ctx,logline)) {
- char *et,*ed;
- edg_wll_Error(ctx,&et,&ed);
- fprintf(stderr,"edg_wll_DoLogEvent(): %s (%s)\n",et,ed);
- exit(1);
- }
- }
- if (logline) free(logline);
- }
- }
- rewind(f);
- if (job) free(job); job = NULL;
-
- /* seq. code */
- seq = edg_wll_GetSequenceCode(ctx);
- fprintf(stdout,"\n%s=\"%s\"\n",num_subjobs?"EDG_WL_COLLECTION_JOBID":"EDG_JOBID",job);
- fprintf(stdout,"EDG_WL_SEQUENCE=\"%s\"\n",seq);
- free(seq);
-
- if (num_subjobs) for (i=0; subjobs[i]; i++) {
- char *job_s = edg_wlc_JobIdUnparse(subjobs[i]);
- fprintf(stdout,"EDG_WL_SUB_JOBID[%d]=\"%s\"\n",i,job_s);
- free(job_s);
- }
-
-} /* MAIN LOOP */
-
- fclose(f);
- edg_wll_FreeContext(ctx);
-
- return 0;
-}
+++ /dev/null
-# macro definition for SUBMITTED state
-
-# only job registration needed for submitted state
-#-p,-s UserInterface,-e Transfer,--destination="NetworkServer",--destination_host="destination hostname",--destination_instance="destination instance",--destination_jobid="job description in receiver language",--result=OK,--reason="detailed description of transfer",--destination_jobid="destination internal jobid"
-
+++ /dev/null
-# macro definition for SUBMITTED state
-
-# only job registration needed for submitted state
-
+++ /dev/null
-# macro definition for SUBMITTED state
-
-# only job registration needed for submitted state
-
+++ /dev/null
-#!/usr/bin/perl -n
-
-BEGIN{
- @pf = split /,/,shift;
-};
-
-next if /^\s*$/;
-
-@F = split / /;
-
-undef $prev;
-undef %f;
-
-for $f (@F) {
- if ($f =~ /^[.A-Z_]+="/) {
-# print $prev,"\n" if $prev;
- @P = split /=/,$prev,2;
- $f{$P[0]} = $P[1];
- $prev = $f;
- }
- else { $prev .= $f; }
-}
-
-# print $prev,"\n";
-@P = split /=/,$prev,2;
-$f{$P[0]} = $P[1];
-
-for $f (@pf) {
- print "$f=$f{$f}\n" if $f{$f};
-}
-print "\n";
+++ /dev/null
-#ident "$Header$"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <expat.h>
-
-#include "glite/lb/context.h"
-#include "glite/lb/xml_conversions.h"
-#include "glite/lb/consumer.h"
-
-int use_proxy = 0;
-
-int (*user_jobs)(edg_wll_Context, edg_wlc_JobId **, edg_wll_JobStat **);
-
-
-void
-usage(char *me)
-{
- fprintf(stderr,"usage: %s [-h] [-x] [userid]\n", me);
-}
-
-int main(int argc,char **argv)
-{
- edg_wll_Context ctx;
- char *errt,*errd;
- edg_wlc_JobId *jobs = NULL;
- edg_wll_JobStat *states = NULL;
- int i,j;
- char *owner = NULL;
-
- user_jobs = edg_wll_UserJobs;
- for ( i = 1; i < argc; i++ ) {
- if ( !strcmp(argv[i], "-h") || !strcmp(argv[i], "--help") ) {
- usage(argv[0]);
- exit(0);
- } else if ( !strcmp(argv[i], "-x") ) {
- user_jobs = edg_wll_UserJobsProxy;
- continue;
- }
-
- owner = strdup(argv[i]);
- break;
- }
-
- edg_wll_InitContext(&ctx);
- if ( user_jobs == edg_wll_UserJobsProxy && owner )
- edg_wll_SetParam(ctx, EDG_WLL_PARAM_LBPROXY_USER, owner);
-
- if (user_jobs(ctx,&jobs,&states)) goto err;
- for (i=0; states[i].state != EDG_WLL_JOB_UNDEF; i++) {
- char *id = edg_wlc_JobIdUnparse(states[i].jobId),
- *st = edg_wll_StatToString(states[i].state);
-
- if (!states[i].parent_job) {
- if (states[i].jobtype == EDG_WLL_STAT_SIMPLE) {
- printf(" %s .... %s %s\n", id, st, (states[i].state==EDG_WLL_JOB_DONE) ? edg_wll_done_codeToString(states[i].done_code) : "" );
- }
- else if ((states[i].jobtype == EDG_WLL_STAT_DAG) ||
- (states[i].jobtype == EDG_WLL_STAT_COLLECTION)) {
- printf("%s %s .... %s %s\n", (states[i].jobtype==EDG_WLL_STAT_DAG)?"DAG ":"COLL",id, st, (states[i].state==EDG_WLL_JOB_DONE) ? edg_wll_done_codeToString(states[i].done_code) : "");
- for (j=0; states[j].state != EDG_WLL_JOB_UNDEF; j++) {
- if (states[j].parent_job) {
- char *par_id = edg_wlc_JobIdUnparse(states[j].parent_job);
-
- if (!strcmp(id,par_id)) {
- char *sub_id = edg_wlc_JobIdUnparse(states[j].jobId),
- *sub_st = edg_wll_StatToString(states[j].state);
-
- printf(" `- %s .... %s %s\n", sub_id, sub_st, (states[j].state==EDG_WLL_JOB_DONE) ? edg_wll_done_codeToString(states[j].done_code) : "");
- free(sub_id);
- free(sub_st);
- }
- free(par_id);
- }
- }
- }
- }
-
- free(id);
- free(st);
- }
-
- printf("\nFound %d jobs\n",i);
-
-err:
- free(owner);
- if (jobs) {
- for (i=0; jobs[i]; i++) edg_wlc_JobIdFree(jobs[i]);
- free(jobs);
- }
-
- if (states) {
- for (i=0; states[i].state; i++) edg_wll_FreeStatus(&states[i]);
- free(states);
- }
-
- if (edg_wll_Error(ctx,&errt,&errd)) {
- fprintf(stderr,"%s: %s (%s)\n",argv[0],errt,errd);
- edg_wll_FreeContext(ctx);
- return 1;
- }
-
- edg_wll_FreeContext(ctx);
- return 0;
-}
-
+++ /dev/null
-#ident "$Header$"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <getopt.h>
-
-#include <expat.h>
-
-#include <pthread.h>
-#include <globus_common.h>
-
-#include "glite/lb/context.h"
-#include "glite/lb/xml_conversions.h"
-#include "glite/lb/consumer.h"
-
-int use_proxy = 0;
-
-int (*user_jobs)(edg_wll_Context, edg_wlc_JobId **, edg_wll_JobStat **);
-
-
-
-static const char *get_opt_string = "hxj:t:p:r:s:w:";
-
-static struct option opts[] = {
- {"help", 0, NULL, 'h'},
- {"proxy", 0, NULL, 'x'},
- {"owner", 1, NULL, 'o'},
- {"num-threads", 1, NULL, 't'},
- {"port_range", 1, NULL, 'p'},
- {"repeat", 1, NULL, 'r'},
- {"rand-start", 1, NULL, 's'},
-// {"rand-work", 1, NULL, 'w'},
- {NULL, 0, NULL, 0}
-};
-
-
-
-static void usage(char *me)
-{
- fprintf(stderr,"usage: %s [option]\n"
- "\t-h, --help\t show this help\n"
- "\t-x, --proxy\t contact proxy (not implemented yet)\n"
- "\t-o, --owner DN\t show jobs of user with this DN\n"
- "\t-t, --num-threads N\t number for threads to create\n"
- "\t-p, --port-range N\t connect to server:port, server:port+10, \n"
- "\t\t\t ... server:port+N*10 bkservers\n"
- "\t-r, --repeat N\t repeat query in each slave N-times \n"
- "\t-s, --rand-start N\t start threads in random interval <0,N> sec\n"
-// "\t-w, --rand-work N\t simulate random server respose time <0,N> sec\n"
- "\n"
- ,me);
-}
-
-
-typedef struct {
- char *owner;
- int proxy;
- int rand_start;
- int port_range;
- int repeat;
- char *argv_0;} thread_code_args;
-
-void *thread_code(thread_code_args *arguments) {
-
- edg_wll_Context ctx;
- char *errt,*errd;
- edg_wlc_JobId *jobs = NULL;
- edg_wll_JobStat *states = NULL;
- int i,j,k,port;
- long sl;
-
-
- sl = (unsigned long) ((double) random()/ RAND_MAX * arguments->rand_start * 1000000);
- printf("Thread [%d] - sleeping for %ld us\n",pthread_self(),sl);
- usleep( sl );
-
- user_jobs = edg_wll_UserJobs;
-
- if (arguments->proxy) {
- user_jobs = edg_wll_UserJobsProxy;
- }
-
- edg_wll_InitContext(&ctx);
- if ( user_jobs == edg_wll_UserJobsProxy && arguments->owner )
- edg_wll_SetParam(ctx, EDG_WLL_PARAM_LBPROXY_USER, arguments->owner);
-
- edg_wll_GetParam(ctx, EDG_WLL_PARAM_QUERY_SERVER_PORT, &port);
- // pthread_self tend to return even number, so /7 makes some odd numbers...
- edg_wll_SetParam(ctx, EDG_WLL_PARAM_QUERY_SERVER_PORT,
- port + ((long) pthread_self()/7 % arguments->port_range)*10 );
-
- for (k=0; k<arguments->repeat; k++) {
- if (user_jobs(ctx,&jobs,&states)) goto err;
- for (i=0; states[i].state != EDG_WLL_JOB_UNDEF; i++) {
- char *id = edg_wlc_JobIdUnparse(states[i].jobId),
- *st = edg_wll_StatToString(states[i].state);
-
- if (!states[i].parent_job) {
- if (states[i].jobtype == EDG_WLL_STAT_SIMPLE) {
- printf(" %s .... %s %s\n", id, st,
- (states[i].state==EDG_WLL_JOB_DONE) ?
- edg_wll_done_codeToString(states[i].done_code) : "" );
- }
- else if (states[i].jobtype == EDG_WLL_STAT_DAG) {
- printf("DAG %s .... %s %s\n", id, st,
- (states[i].state==EDG_WLL_JOB_DONE) ?
- edg_wll_done_codeToString(states[i].done_code) : "");
- for (j=0; states[j].state != EDG_WLL_JOB_UNDEF; j++) {
- if (states[j].parent_job) {
- char *par_id = edg_wlc_JobIdUnparse(states[j].parent_job);
-
- if (!strcmp(id,par_id)) {
- char *sub_id = edg_wlc_JobIdUnparse(states[j].jobId),
- *sub_st = edg_wll_StatToString(states[j].state);
-
- printf(" `- %s .... %s %s\n", sub_id, sub_st,
- (states[j].state==EDG_WLL_JOB_DONE) ?
- edg_wll_done_codeToString(states[j].done_code) : "");
- free(sub_id);
- free(sub_st);
- }
- free(par_id);
- }
- }
- }
- }
-
- free(id);
- free(st);
- }
-
- printf("\nFound %d jobs\n",i);
- }
-err:
- free(arguments->owner);
- if (jobs) {
- for (i=0; jobs[i]; i++) edg_wlc_JobIdFree(jobs[i]);
- free(jobs);
- }
-
- if (states) {
- for (i=0; states[i].state; i++) edg_wll_FreeStatus(&states[i]);
- free(states);
- }
-
- if (edg_wll_Error(ctx,&errt,&errd)) {
- fprintf(stderr,"%s: %s (%s)\n",arguments->argv_0,errt,errd);
- edg_wll_FreeContext(ctx);
- pthread_exit(NULL);
- }
-
- edg_wll_FreeContext(ctx);
-
-// printf("Thread %d exitting\n",(int)pthread_self());
-
- pthread_exit(NULL);
-
-}
-
-int main(int argc,char **argv)
-{
- thread_code_args arguments = { NULL, 0, 0, 1, 1,NULL };
- int i,rc,status,opt;
- int thr_num = 10; // default
-
-
- while ((opt = getopt_long(argc,argv,get_opt_string,opts,NULL)) != EOF) switch (opt) {
- case 'x': arguments.proxy = 1; break;
- case 'o': arguments.owner = optarg; break;
- case 't': thr_num = atoi(optarg); break;
- case 'p': arguments.port_range = atoi(optarg); break;
- case 'r': arguments.repeat = atoi(optarg); break;
- case 's': arguments.rand_start = atoi(optarg); break;
- default : usage(argv[0]); exit(0); break;
- }
-
- arguments.argv_0 = argv[0];
-
- /* Do a thready work */
- {
- pthread_t threads[thr_num];
- pthread_attr_t attr;
-
- if (globus_module_activate(GLOBUS_COMMON_MODULE) != GLOBUS_SUCCESS) {
- fputs("globus_module_activate()\n",stderr);
- return 1;
- }
-
- pthread_attr_init(&attr);
- pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
-
- for (i=0;i<thr_num;i++) {
- printf("Running thread %d\n",i);
- rc = pthread_create(&threads[i], &attr, (void*)thread_code, &arguments );
- if (rc){
- printf("ERROR; return code from pthread_create() is %d\n", rc);
- exit(-1);
- }
- }
-
-
-
- // thread_code(&arguments);
-
- // pthread_exit(NULL)
-
- pthread_attr_destroy(&attr);
-
- for (i=0;i<thr_num;i++) {
- // printf("*** Joining thread %d.\n",i);
- rc=pthread_join(threads[i],(void **)&status);
- // printf("*** Thread %d joined. (status %d ret. code %d)\n",i,status,rc);
-
- }
- }
-
- printf("Threaded example main() exitting\n");
-
-
-// exit(0);
-// pthread_exit(NULL);
-}
-
+++ /dev/null
-# macro definition for WAITING state
-
-:submitted:
-# NetworkServer
-
--s NetworkServer,-e Accepted, --from="UserInterface", --from_host="sending component hostname", --from_instance="sending component instance", --local_jobid="new jobId (Condor, Globus ...)"
+++ /dev/null
-# macro definition for WAITING state
-
-:submitted_dag:
-# NetworkServer
-
--s NetworkServer,-e Accepted, --from="UserInterface", --from_host="sending component hostname", --from_instance="sending component instance", --local_jobid="new jobId (Condor, Globus ...)"
+++ /dev/null
-# macro definition for WAITING state
-
-:submitted_subjob:
-# WorkloadManager
-
--s WorkloadManager,-e HelperCall, --helper_name="name of the called component",--helper_params="parameters of the call", --src_role=CALLING
+++ /dev/null
-MultiStruct.pm
-StructField.pm
-at3
-events.T
-status.T
-types.T
+++ /dev/null
-#Fri Aug 18 12:27:36 CEST 2006
-module.build=0243
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- Copyright (c) 2004 on behalf of the EU EGEE Project:
- The European Organization for Nuclear Research (CERN),
- Istituto Nazionale di Fisica Nucleare (INFN), Italy
- Datamat Spa, Italy
- Centre National de la Recherche Scientifique (CNRS), France
- CS Systeme d'Information (CSSI), France
- Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden
- Universiteit van Amsterdam (UvA), Netherlands
- University of Helsinki (UH.HIP), Finland
- University of Bergen (UiB), Norway
- Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom
-
- Configuration options for the GLite LB Client module
-
- Authors: Ales Krenek <ljocha@ics.muni.cz>
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
- Revision 1.8.2.1 2006/11/28 20:24:00 akrenek
- PREFIX is set to stage by default
- - fix build in the old glite fashion
- - should not break build in etics
-
- Revision 1.8 2006/09/20 10:50:08 zsalvet
- Remove CVS conflict section.
-
- Revision 1.7 2006/09/19 20:27:40 akrenek
- Builds after merge _RC31
-
- Revision 1.6 2006/04/20 07:06:31 jpospi
- lb4vdt stuff and cleanup
-
- Revision 1.5 2006/03/15 18:02:37 akrenek
- cares
-
- Revision 1.4 2006/03/15 17:59:04 akrenek
- merge 1.5
-
- Revision 1.3.14.1 2006/03/08 11:49:31 jpospi
- added mysql dependency
-
- Revision 1.3 2004/08/31 16:32:31 jpospi
- First attempt to producer test
-
- Revision 1.2 2004/07/06 20:47:11 flammer
- Moved to configure.properties.xml
-
-
--->
-
- <!-- ======================================================
- Define extra properties here ...
- ====================================================== -->
-
- <project name="LB Client configuration options">
- <target name="lbmakefiles">
- <exec executable="ln" failonerror="true">
- <arg line="-fs ${component.dir}/Makefile ${module.build.dir}/Makefile"/>
- </exec>
- <echo file="${module.build.dir}/Makefile.inc">
-top_srcdir=..
-builddir=build
-stagedir=${stage.abs.dir}
-distdir=${dist.dir}
-globalprefix=${global.prefix}
-lbprefix=${subsystem.prefix}
-package=${module.package.name}
-# PREFIX=${install.dir}
-version=${module.version}
-glite_location=${with.glite.location}
-globus_prefix=${with.globus.prefix}
-expat_prefix=${with.expat.prefix}
-mysql_prefix=${with.mysql.prefix}
-mysql_version=${ext.mysql.version}
-cppunit_prefix=${with.cppunit.prefix}
-thrflavour=${with.globus.thr.flavor}
-nothrflavour=${with.globus.nothr.flavor}
- </echo>
- </target>
- </project>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2004 on behalf of the EU EGEE Project:
- The European Organization for Nuclear Research (CERN),
- Istituto Nazionale di Fisica Nucleare (INFN), Italy
- Datamat Spa, Italy
- Centre National de la Recherche Scientifique (CNRS), France
- CS Systeme d'Information (CSSI), France
- Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden
- Universiteit van Amsterdam (UvA), Netherlands
- University of Helsinki (UH.HIP), Finland
- University of Bergen (UiB), Norway
- Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom
-
- Common build properties file for the Glite LB Client component
-
- Authors: Ales Krenek <ljocha@ics.muni.cz>
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
- Revision 1.2 2004/06/23 00:30:55 dimeglio
- First version of this file
-
--->
-
-<project name="LB Client component common properties">
-
- <!-- Include build properties to allow overwriting
- of properties for subsystem -->
- <property file="project/build.properties" />
-
- <!-- ======================================================
- Define corresponding subsystem properties
- ====================================================== -->
-
- <!-- Subsystem name -->
- <property name="subsystem.name" value="${lb.subsystem.name}"/>
-
- <!-- Subsystem prefix -->
- <property name="subsystem.prefix" value="${lb.subsystem.prefix}"/>
-
- <!-- ======================================================
- Define component properties
- ====================================================== -->
-
- <!-- Component name prefix -->
- <property name="component.prefix" value="client" />
-
- <!-- ======================================================
- Define general component properties
- ====================================================== -->
-
- <import file="${component.general.properties.file}" />
-
- <!-- ======================================================
- Define extra properties here ...
- ====================================================== -->
-
-
-</project>
+++ /dev/null
-tar_exclude
-CVS
-build.xml
-build
-build.properties
-properties.xml
-configure.properties.xml
-.cvsignore
-.project
-.cdtproject
+++ /dev/null
-# $Header$
-module.version=2.3.5
-module.age=1
+++ /dev/null
-/*
-@@@AUTO
-*/
-
-#include <utility>
-#include <vector>
-#include <string>
-#include <stdio.h>
-
-#include <errno.h>
-
-#include "glite/wmsutils/jobid/cjobid.h"
-
-#include "glite/lb/Event.h"
-#include "glite/wmsutils/jobid/JobIdExceptions.h"
-#include "glite/lb/LoggingExceptions.h"
-
-#include "glite/lb/consumer.h"
-#include "glite/lb/events.h"
-#include "glite/lb/notifid.h"
-
-EWL_BEGIN_NAMESPACE;
-
-#define CLASS_PREFIX "glite::lb::Event::"
-
-@@@{
-sub typeswitch {
- my $ftype = shift;
- my $resc = shift;
- local $_;
- my %ctype;
- $ctype{$_} = 1 while $_ = shift;
-
- $resc = 'break;' unless $resc;
-
- gen $indent."switch (attr) {\n";
- selectType $event $ftype;
- for (getFields $event) {
- my $f = selectField $event $_;
- if($ctype{$f->{type}}) {
- my $cstr = $ftype eq '_common_' ? 'any' : lcfirst $ftype;
- if ($cstr =~ m/^pBS/) { $cstr = ucfirst $cstr; }
- if ($cstr =~ m/^condor/) { $cstr = ucfirst $cstr; }
- my $cname = getName $f 'C';
- gen "$indent\tcase Event::".uc($f->{name}).": return(cev->$cstr.$cname);\n";
- } elsif (($f->{type} eq "int") &&
- ($ctype{"string"}) &&
- $f->{codes}) {
- # conversion from int to string (well, enum to string)
- my $cstr = $ftype eq '_common_' ? 'any' : lcfirst $ftype;
- if ($cstr =~ m/^pBS/) { $cstr = ucfirst $cstr; }
- if ($cstr =~ m/^condor/) { $cstr = ucfirst $cstr; }
- my $cname = getName $f 'C';
- my $fn = $ftype eq '_common_' ? "" : ucfirst $ftype;
- my $c = $fn . ucfirst $f->{name};
- $cast = ($c eq 'Level') ? "(edg_wll_Level)" : "";
- gen "$indent\tcase Event::".uc($f->{name}).": return((const char *)edg_wll_${c}ToString(${cast}cev->$cstr.$cname));\n";
- } elsif (($f->{type} eq "jobid") &&
- ($ctype{"string"})) {
- # conversion from jobid to string
- }
- }
- gen "$indent\tdefault: $resc\n" if $resc;
- gen "$indent\}\n";
-}
-@@@}
-
-Event::Event(void)
-{
- type = UNDEF;
- flesh = 0;
-}
-
-
-Event::Event(const Event &in)
-{
- type = in.type;
- flesh = in.flesh;
- if (flesh) flesh->use();
-}
-
-
-Event::Event(edg_wll_Event *in)
-{
- type = (Type)in->type;
- flesh = new CountRef<Event>((void*)in);
-}
-
-
-Event::~Event(void)
-{
- if (flesh) flesh->release();
-}
-
-
-Event &
-Event::operator= (const Event &in)
-{
- if (flesh) flesh->release();
- type = in.type;
- flesh = in.flesh;
- if (flesh) flesh->use();
-
- return *this;
-}
-
-int Event::getValInt(Attr attr) const
-{
- edg_wll_Event const *cev = (edg_wll_Event *) flesh->ptr;
-
-@@@{
- $indent = "\t";
- typeswitch '_common_',undef,'int','port','logsrc';
-@@@}
-
- switch (cev->type) {
-@@@{
- $indent = "\t\t";
- for my $t (getTypes $event) {
- gen "\t\tcase ".uc($t).":\n";
- typeswitch $t,'goto badattr;','int','port','logsrc';
- }
-@@@}
- default:
- STACK_ADD;
- throw(Exception(EXCEPTION_MANDATORY, EINVAL,
- "attribute is not of int type"));
- }
-badattr:
- STACK_ADD;
- throw(Exception(EXCEPTION_MANDATORY, ENOENT, "invalid attribute"));
- return -1; /* gcc, shut up! */
-}
-
-float Event::getValFloat(Attr attr) const
-{
- edg_wll_Event const *cev = (edg_wll_Event *) flesh->ptr;
-
-@@@{
- $indent = "\t";
- typeswitch '_common_',undef,'float';
-@@@}
-
- switch (cev->type) {
-@@@{
- $indent = "\t\t";
- for my $t (getTypes $event) {
- gen "\t\tcase ".uc($t).":\n";
- typeswitch $t,'goto badattr;','float';
- }
-@@@}
- default:
- STACK_ADD;
- throw(Exception(EXCEPTION_MANDATORY, EINVAL,
- "attribute is not of float type"));
- }
-badattr:
- STACK_ADD;
- throw(Exception(EXCEPTION_MANDATORY, ENOENT, "invalid attribute"));
- return -1; /* gcc, shut up! */
-}
-
-double Event::getValDouble(Attr attr) const
-{
- edg_wll_Event const *cev = (edg_wll_Event *) flesh->ptr;
-
-@@@{
- $indent = "\t";
- typeswitch '_common_',undef,'double';
-@@@}
-
- switch (cev->type) {
-@@@{
- $indent = "\t\t";
- for my $t (getTypes $event) {
- gen "\t\tcase ".uc($t).":\n";
- typeswitch $t,'goto badattr;','double';
- }
-@@@}
- default:
- STACK_ADD;
- throw(Exception(EXCEPTION_MANDATORY, EINVAL,
- "attribute is not of double type"));
- }
-badattr:
- STACK_ADD;
- throw(Exception(EXCEPTION_MANDATORY, ENOENT, "invalid attribute"));
- return -1; /* gcc, shut up! */
-}
-
-static char const *get_string_val(const edg_wll_Event *cev, Event::Attr attr)
-{
-@@@{
- $indent = "\t";
- typeswitch '_common_',undef,'string';
-@@@}
-
- switch (cev->type) {
-@@@{
- $indent = "\t\t";
- for my $t (getTypes $event) {
- gen "\t\tcase Event::".uc($t).":\n";
- typeswitch $t,'goto badattr;','string';
- }
-@@@}
- default:
- STACK_ADD;
- throw(Exception(EXCEPTION_MANDATORY, EINVAL,
- "attribute is not of string type and can not be converted"));
- }
-badattr:
- STACK_ADD;
- throw(Exception(EXCEPTION_MANDATORY, ENOENT, "invalid attribute"));
- return NULL; /* gcc, shut up! */
-}
-
-
-std::string
-Event::getValString(Attr attr) const
-{
- edg_wll_Event const *cev = (edg_wll_Event *) flesh->ptr;
- std::string ret;
-
- try {
- char const *s = get_string_val(cev,attr);
- if (s) ret.assign(s);
- return ret;
- } catch (Exception &e) {
- STACK_ADD;
- throw;
- }
-}
-
-
-struct timeval
-Event::getValTime(Attr attr) const
-{
- edg_wll_Event const *cev = (edg_wll_Event *) flesh->ptr;
-@@@{
- $indent = "\t";
- typeswitch '_common_',undef,'timeval';
-@@@}
-
- /* XXX
- * to make things simpler we don't include this here as there are no
- * type specific timeval attributes currently
- *
- * switch (cev->type) {
- */
-
- STACK_ADD;
- throw(Exception(EXCEPTION_MANDATORY, ENOENT, "invalid attribute"));
-}
-
-static
-edg_wlc_JobId
-get_val_jobid(edg_wll_Event const *cev, Event::Attr attr)
-{
-@@@{
- $indent = "\t";
- typeswitch '_common_', undef,'jobid';
-@@@}
- switch (cev->type) {
-@@@{
- $indent = "\t\t";
- for my $t (getTypes $event) {
- gen "\t\tcase Event::".uc($t).":\n";
- typeswitch $t,'goto badattr;','jobid';
- }
-@@@}
- default:
- STACK_ADD;
- throw(Exception(EXCEPTION_MANDATORY, EINVAL,
- "attribute is not of jobid type"));
- }
-badattr:
- STACK_ADD;
- throw(Exception(EXCEPTION_MANDATORY, ENOENT, "invalid attribute"));
- return NULL; /* gcc, shut up! */
-}
-
-const
-glite::wmsutils::jobid::JobId
-Event::getValJobId(Attr attr) const
-{
- edg_wll_Event const *cev = (edg_wll_Event *) flesh->ptr;
- try {
- edg_wlc_JobId job_id = get_val_jobid(cev,attr);
- return(glite::wmsutils::jobid::JobId(job_id));
- }
- catch (Exception &e) {
- STACK_ADD;
- throw;
- }
-
-}
-
-
-static std::string const names[Event::TYPE_MAX] = {
- "undefined",
-@@@{
- for (sort { $event->{order}->{$a} <=> $event->{order}->{$b} }
- $event->getTypes)
- {
- gen "\t\"$_\",\n";
- }
-@@@}
-};
-
-const std::string &
-Event::name(void) const
-{
- if (type<0 || type>TYPE_MAX) {
- STACK_ADD;
- throw(Exception(EXCEPTION_MANDATORY, EINVAL, "invalid event type"));
- }
- return names[type];
-}
-
-
-static
-std::string const attr_names[Event::ATTR_MAX] = {
-@@@{
- for (sort {$a cmp $b} getAllFields $event) {
- gen "\t\"$_\",\n";
- }
-@@@}
-};
-
-const std::string &
-Event::getAttrName(Attr attr)
-{
- if (attr<0 || attr>=ATTR_MAX) {
- STACK_ADD;
- throw(Exception(EXCEPTION_MANDATORY, EINVAL, "invalid attribute"));
- }
- return attr_names[attr];
-}
-
-
-typedef std::pair<Event::Attr,Event::AttrType> tpair;
-static std::vector<tpair> attrs[Event::TYPE_MAX];
-
-#define apush(etype,attr,atype) \
- attrs[etype].push_back(tpair(attr,atype))
-
-static bool attrs_inited = false;
-
-static void init_attrs(void)
-{
-@@@{
- for my $t (getTypes $event) {
- my $tu = uc $t;
- selectType $event '_common_';
- for (getFields $event) {
- my $fu = uc $_;
- my $f = selectField $event $_;
- my $ftu = uc "$f->{type}_T";
- gen "\tapush(Event::$tu,Event::$fu,Event::$ftu);\n";
- }
- selectType $event $t;
- for (getFields $event) {
- my $fu = uc $_;
- my $f = selectField $event $_;
- my $ftu = uc "$f->{type}_T";
- gen "\tapush(Event::$tu,Event::$fu,Event::$ftu);\n";
- }
- }
-@@@}
-}
-
-std::vector<std::pair<Event::Attr,Event::AttrType> > const & Event::getAttrs(void) const
-{
- if (type<0 || type>=TYPE_MAX) {
- STACK_ADD;
- throw(Exception(EXCEPTION_MANDATORY, EINVAL, "invalid event type"));
- }
-
- /* FIXME: thread safety */
- if (!attrs_inited) {
- init_attrs();
- attrs_inited = true;
- }
-
- return attrs[type];
-}
-
-
-const std::string Event::getEventName(Type type)
-{
- if(type < 0 || type >= TYPE_MAX) {
- STACK_ADD;
- throw(Exception(EXCEPTION_MANDATORY, EINVAL, "invalid event type"));
- }
-
- return std::string(edg_wll_EventToString(edg_wll_EventCode(type)));
-}
-
-
-void
-Event::destroyFlesh(void *in)
-{
- edg_wll_FreeEvent((edg_wll_Event *) in);
- free(in);
-}
-
-EWL_END_NAMESPACE;
+++ /dev/null
-#ident "$Header$"
-
-/**
- * @file Job.cpp
- * @version $Revision$
- */
-
-
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <string>
-
-#include "glite/wmsutils/jobid/JobIdExceptions.h"
-
-#include "glite/lb/Job.h"
-#include "glite/lb/LoggingExceptions.h"
-#include "glite/lb/consumer.h"
-#include "glite/lb/context-int.h"
-
-EWL_BEGIN_NAMESPACE;
-
-#define CLASS_PREFIX "glite::lb::Job::"
-
-const int Job::STAT_CLASSADS = EDG_WLL_STAT_CLASSADS;
-const int Job::STAT_CHILDREN = EDG_WLL_STAT_CHILDREN;
-const int Job::STAT_CHILDSTAT = EDG_WLL_STAT_CHILDSTAT;
-
-Job::Job(void)
-{
-}
-
-
-Job::Job(const glite::wmsutils::jobid::JobId &in)
-{
- try {
- jobId = in;
- } catch (Exception &e) {
- STACK_ADD;
- throw;
- }
-}
-
-
-Job::~Job(void)
-{
-}
-
-
-Job & Job::operator= (const glite::wmsutils::jobid::JobId &in)
-{
- try {
- jobId = in;
- return *this;
- } catch (Exception &) {
- STACK_ADD;
- throw;
- }
-}
-
-
-JobStatus
-Job::status(int flags) const
-{
- JobStatus jobStatus;
-
- try {
- edg_wll_JobStat *cstat = jobStatus.c_ptr();
- int ret = edg_wll_JobStatus(server.getContext(),
- jobId, // automagically converted by member operator
- flags,
- cstat);
- check_result(ret,
- server.getContext(),
- "edg_wll_JobStatus");
-
-/* XXX the enums match due to automatic generation */
- jobStatus.status = (JobStatus::Code) cstat->state;
-
- return(jobStatus);
-
- } catch (Exception &e) {
- STACK_ADD;
- throw;
- }
-}
-
-
-void
-Job::log(std::vector<Event> &eventList) const
-{
- edg_wll_Event *events = NULL,*ev;
- int result, qresults_param;
- char *errstr = NULL;
- edg_wll_Context context;
-
- try {
- context = server.getContext();
- result = edg_wll_JobLog(context, jobId, &events);
- if (result == E2BIG) {
- edg_wll_Error(context, NULL, &errstr);
- check_result(edg_wll_GetParam(context,
- EDG_WLL_PARAM_QUERY_RESULTS, &qresults_param),
- context,
- "edg_wll_GetParam(EDG_WLL_PARAM_QUERY_RESULTS)");
- if (qresults_param != EDG_WLL_QUERYRES_LIMITED) {
- edg_wll_SetError(context, result, errstr);
- check_result(result, context,"edg_wll_JobLog");
- }
- } else {
- check_result(result, context,"edg_wll_JobLog");
- }
-
- for (int i=0; events[i].type != EDG_WLL_EVENT_UNDEF; i++) {
- ev = (edg_wll_Event *) malloc(sizeof *ev);
- memcpy(ev,events+i,sizeof *ev);
- eventList.push_back(Event(ev));
- }
-
- free(events);
-
- if (result) {
- edg_wll_SetError(context, result, errstr);
- check_result(result, context,"edg_wll_JobLog");
- }
- } catch (Exception &e) {
- if(errstr) free(errstr);
-
- STACK_ADD;
- throw;
- }
-
-}
-
-
-const std::vector<Event>
-Job::log(void) const
-{
- std::vector<Event> eventList;
-
- log(eventList);
- return(eventList);
-}
-
-
-const std::pair<std::string,u_int16_t>
-Job::queryListener(std::string const & name) const
-{
- std::string host;
- char *c_host = NULL;
- uint16_t port;
-
- try {
- int ret = edg_wll_QueryListener(server.getContext(),
- jobId,
- name.c_str(),
- &c_host,
- &port);
- check_result(ret,
- server.getContext(),
- "edg_wll_QueryListener");
-
- host = c_host;
- free(c_host);
- return(std::pair<std::string,u_int16_t>(host,port));
-
- } catch (Exception &e) {
- if(c_host) free(c_host);
- STACK_ADD;
- throw;
- }
-}
-
-
-void Job::setParam(edg_wll_ContextParam par, int val)
-{
- server.setParam(par,val);
-}
-
-void Job::setParam(edg_wll_ContextParam par, const std::string val)
-{
- server.setParam(par,val);
-}
-
-void Job::setParam(edg_wll_ContextParam par, const struct timeval & val)
-{
- server.setParam(par,val);
-}
-
-
-int Job::getParamInt(edg_wll_ContextParam par) const
-{
- return server.getParamInt(par);
-}
-
-std::string Job::getParamString(edg_wll_ContextParam par) const
-{
- return server.getParamString(par);
-}
-
-struct timeval Job::getParamTime(edg_wll_ContextParam par) const
-{
- return server.getParamTime(par);
-}
-
-
-
-EWL_END_NAMESPACE;
+++ /dev/null
-#include <utility>
-#include <vector>
-#include <string>
-#include <errno.h>
-#include <stdlib.h>
-
-#include "glite/wmsutils/jobid/JobId.h"
-
-#include "glite/lb/JobStatus.h"
-#include "glite/lb/LoggingExceptions.h"
-#include "glite/lb/consumer.h"
-
-
-EWL_BEGIN_NAMESPACE;
-
-#define CLASS_PREFIX "glite::lb::JobStatus::"
-
-@@@{
-sub typeswitch {
- my ($ftype,$ctype,$resc) = @_;
- local $_;
-
- $resc = "break;" unless $resc;
-
- gen $indent."switch (attr) {\n";
- selectType $status $ftype;
- for (getFields $status) {
- my $f = selectField $status $_;
- if($f->{type} eq $ctype) {
- my $fnu = $f->{name};
- $fnu =~ s/([a-z])([A-Z])/$1_$2/g;
- $fnu = uc $fnu;
- my $cname = getName $f 'C';
- gen "$indent\tcase JobStatus::$fnu: return cstat->$cname;\n"
- };
- # XXX: when there are conversion functions, we may get these as strings as well
- #elsif (($f->{type} eq "int") &&
- # ($ctype eq "string") &&
- # $f->{codes}) {
- # my $fnu = $f->{name};
- # $fnu =~ s/([a-z])([A-Z])/$1_$2/g;
- # $fnu = uc $fnu;
- # my $cname = getName $f 'C';
- # my $fn = $ftype eq '_common_' ? "" : ucfirst $ftype;
- # my $c = $fn . ucfirst $f->{name};
- # $cast = ($c eq 'Level') ? "(edg_wll_Level)" : "";
- # gen "$indent\tcase JobStatus::$fnu: return((const char *)edg_wll_${c}ToString(${cast}cstat->$cname));\n"; }
- }
- gen "$indent\tdefault: $resc\n" if $resc;
- gen "$indent\}\n";
-}
-@@@}
-
-JobStatus::JobStatus(void)
-{
- status = UNDEF;
- flesh = 0;
-}
-
-JobStatus::JobStatus(const JobStatus & in)
-{
- status = in.status;
- flesh = in.flesh;
- if (flesh) flesh->use();
-}
-
-JobStatus &
-JobStatus::operator=(const JobStatus & in)
-{
- if (flesh) flesh->release();
- status = in.status;
- flesh = in.flesh;
- if (flesh) flesh->use();
- return *this;
-}
-
-JobStatus::JobStatus(const edg_wll_JobStat & in)
-{
- status = (Code)in.state;
- flesh = new CountRef<JobStatus>((void*)&in);
-}
-
-JobStatus &
-JobStatus::operator=(const edg_wll_JobStat & in)
-{
- if(flesh)
- flesh->release();
- status = (Code)in.state;
- flesh = new CountRef<JobStatus>((void*)&in);
- return(*this);
-}
-
-JobStatus::~JobStatus()
-{
- if (flesh) flesh->release();
-}
-
-edg_wll_JobStat *
-JobStatus::c_ptr(void)
-{
- edg_wll_JobStat *s;
-
- if(flesh)
- return((edg_wll_JobStat*)flesh->ptr);
-
- s = new edg_wll_JobStat;
- // XXX - is it neccessary? new should throw exception itself...
- if(!s) throw(Exception(EXCEPTION_MANDATORY,
- ENOMEM,
- "out of memory allocating c-struct for JobStatus"));
-
- edg_wll_InitStatus(s);
- flesh = new CountRef<JobStatus>((void*)s);
- return(s);
-}
-
-
-static std::string const names[JobStatus::CODE_MAX] = {
- "undefined",
-@@@{
- for (sort { $status->{order}->{$a} <=> $status->{order}->{$b} }
- $status->getTypes)
- {
- gen "\t\"$_\",\n";
- }
-@@@}
-};
-
-const std::string& JobStatus::name(void) const
-{
- if (status<0 || status>=CODE_MAX) {
- STACK_ADD;
- throw(Exception(EXCEPTION_MANDATORY,
- EINVAL,
- "status code invalid"));
- }
- return names[status];
-}
-
-int JobStatus::getValInt(JobStatus::Attr attr) const
-{
- edg_wll_JobStat const *cstat = (edg_wll_JobStat *) flesh->ptr;
-@@@{
- $indent = "\t";
- typeswitch '_common_','int';
-@@@}
-
- STACK_ADD;
- throw(Exception(EXCEPTION_MANDATORY,
- ENOENT,
- "no such attribute"));
- return -1; /* make gcc shut up -- never returns */
-}
-
-bool JobStatus::getValBool(JobStatus::Attr attr) const
-{
- edg_wll_JobStat const *cstat = (edg_wll_JobStat *) flesh->ptr;
-@@@{
- $indent = "\t";
- typeswitch '_common_','bool';
-@@@}
-
- STACK_ADD;
- throw(Exception(EXCEPTION_MANDATORY,
- ENOENT,
- "no such attribute"));
- return -1; /* make gcc shut up -- never returns */
-}
-
-static const char *
-get_string_val(const edg_wll_JobStat *cstat,JobStatus::Attr attr)
-{
-@@@{
- $indent = "\t";
- typeswitch '_common_','string';
-@@@}
- STACK_ADD;
- throw(Exception(EXCEPTION_MANDATORY,
- ENOENT,
- "no such attribute"));
- return 0; /* make gcc shut up -- never returns */
-}
-
-std::string
-JobStatus::getValString(JobStatus::Attr attr) const
-{
- edg_wll_JobStat const *cstat = (edg_wll_JobStat *) flesh->ptr;
- std::string ret;
-
- try{
- const char *s = get_string_val(cstat,attr);
- if (s) ret.assign(s);
- return ret;
- } catch (Exception &e) {
- STACK_ADD;
- throw;
- }
-}
-
-
-struct timeval
-JobStatus::getValTime(Attr attr) const
-{
- edg_wll_JobStat const *cstat = (edg_wll_JobStat *) flesh->ptr;
-
-@@@{
- $indent = "\t";
- typeswitch '_common_','timeval';
-@@@}
- STACK_ADD;
- throw(Exception(EXCEPTION_MANDATORY,
- ENOENT,
- "no such attribute"));
-}
-
-
-const
-edg_wlc_JobId
-get_val_jobid(edg_wll_JobStat const *cstat, JobStatus::Attr attr)
-{
-@@@{
- $indent = "\t";
- typeswitch '_common_','jobid';
-@@@}
- STACK_ADD;
- throw(Exception(EXCEPTION_MANDATORY,
- ENOENT,
- "no such attribute"));
- return 0; /* make gcc shut up -- never returns */
-}
-
-
-const
-glite::wmsutils::jobid::JobId
-JobStatus::getValJobId(Attr attr) const
-{
- edg_wll_JobStat const *cstat = (edg_wll_JobStat *) flesh->ptr;
-
- try {
- edg_wlc_JobId job_id = get_val_jobid(cstat, attr);
- return(glite::wmsutils::jobid::JobId(job_id));
- }
- catch(Exception &e) {
- STACK_ADD;
- throw;
- }
-}
-
-const
-int *
-get_val_intlist(edg_wll_JobStat const *cstat, JobStatus::Attr attr)
-{
-@@@{
- $indent = "\t";
- typeswitch '_common_','intlist';
-@@@}
- STACK_ADD;
- throw(Exception(EXCEPTION_MANDATORY,
- ENOENT,
- "no such attribute"));
- return 0; /* make gcc shut up -- never returns */
-}
-
-
-const
-std::vector<int>
-JobStatus::getValIntList(Attr attr) const
-{
- edg_wll_JobStat const *cstat = (edg_wll_JobStat *) flesh->ptr;
-
- std::vector<int> result;
- const int *r;
-
- try {
- r = get_val_intlist(cstat, attr);
- if(r)
- for(int i = 1; i <= r[0]; i++)
- result.push_back(r[i]);
- } catch(Exception &e) {
- STACK_ADD;
- throw;
- }
- return result;
-}
-
-
-char ** const
-get_val_stringlist(edg_wll_JobStat const *cstat, JobStatus::Attr attr)
-{
-@@@{
- $indent = "\t";
- typeswitch '_common_','strlist';
-@@@}
- STACK_ADD;
- throw(Exception(EXCEPTION_MANDATORY,
- ENOENT,
- "no such attribute"));
- return 0; /* make gcc shut up -- never returns */
-}
-
-
-const
-std::vector<std::string>
-JobStatus::getValStringList(Attr attr) const
-{
- edg_wll_JobStat const *cstat = (edg_wll_JobStat *) flesh->ptr;
-
- std::vector<std::string> result;
- char **r , **p;
-
- try {
- r = (char**)get_val_stringlist(cstat, attr);
- if(r)
- for(p = r; *p; p++)
- result.push_back(std::string(*p));
- } catch(Exception &e) {
- STACK_ADD;
- throw;
- }
- return result;
-}
-
-
-edg_wll_TagValue * const
-get_val_taglist(edg_wll_JobStat const *cstat, JobStatus::Attr attr)
-{
-@@@{
- $indent = "\t";
- typeswitch '_common_','taglist';
-@@@}
- STACK_ADD;
- throw(Exception(EXCEPTION_MANDATORY,
- ENOENT,
- "no such attribute"));
- return 0; /* make gcc shut up -- never returns */
-}
-
-
-const
-std::vector<std::pair<std::string,std::string> >
-JobStatus::getValTagList(Attr attr) const
-{
- edg_wll_JobStat const *cstat = (edg_wll_JobStat *) flesh->ptr;
-
- std::vector<std::pair<std::string,std::string> > result;
- edg_wll_TagValue *r , *p;
-
- try {
- r = get_val_taglist(cstat, attr);
- if(r)
- for(p = r; p->tag ; p++)
- result.push_back(std::pair<std::string,std::string>
- (std::string(p->tag),std::string(p->value)));
- } catch(Exception &e) {
- STACK_ADD;
- throw;
- }
- return result;
-}
-
-
-const
-edg_wll_JobStat *
-get_val_stslist(edg_wll_JobStat const *cstat, JobStatus::Attr attr)
-{
-@@@{
- $indent = "\t";
- typeswitch '_common_','stslist';
-@@@}
- STACK_ADD;
- throw(Exception(EXCEPTION_MANDATORY,
- ENOENT,
- "no such attribute"));
- return 0; /* make gcc shut up -- never returns */
-}
-
-
-const
-std::vector<JobStatus>
-JobStatus::getValJobStatusList(Attr attr) const
-{
- edg_wll_JobStat const *cstat = (edg_wll_JobStat *) flesh->ptr;
-
- std::vector<JobStatus> result;
- const edg_wll_JobStat *r, *p;
-
- try {
- r = get_val_stslist(cstat, attr);
- if(r)
- for(p=r; p->state != EDG_WLL_JOB_UNDEF; p++) {
- edg_wll_JobStat *jsep = new edg_wll_JobStat;
- if (!edg_wll_CpyStatus(p,jsep)) {
- STACK_ADD;
- throw(Exception(EXCEPTION_MANDATORY,
- ENOMEM,
- "cannot copy edg_wll_JobStat"));
- }
- result.push_back(JobStatus(*jsep));
- }
- } catch(Exception &e) {
- STACK_ADD;
- throw;
- }
- return(result);
-}
-
-
-static std::string const attr_names[JobStatus::ATTR_MAX] = {
-@@@{
- for (sort {$a cmp $b} getAllFields $status) {
- gen "\t\"$_\",\n";
- }
-@@@}
-};
-
-const std::string &
-JobStatus::getAttrName(JobStatus::Attr attr)
-{
- if (attr<0 || attr>=ATTR_MAX) {
- STACK_ADD;
- throw(Exception(EXCEPTION_MANDATORY,
- ENOENT,
- "no such attribute"));
- }
-
- return attr_names[attr];
-}
-
-
-typedef std::pair<JobStatus::Attr,JobStatus::AttrType> tpair;
-static std::vector<tpair> attrs;
-
-static bool attrs_inited = false;
-
-static void init_attrs(void)
-{
-/* XXX: currently only common attributes in JobStatus */
-@@@{
- selectType $status '_common_';
- for (getFields $status) {
- my $fu = $_;
- my $f = selectField $status $_;
- my $ftu = uc "$f->{type}_T";
- $fu =~ s/([a-z])([A-Z])/$1_$2/g;
- $fu = uc $fu;
-
- gen "\tattrs.push_back(tpair(JobStatus::$fu,JobStatus::$ftu));\n";
- }
-@@@}
-}
-
-
-const std::vector<tpair>&
-JobStatus::getAttrs(void) const
-{
- if (status<0 || status>=CODE_MAX) {
- STACK_ADD;
- throw(Exception(EXCEPTION_MANDATORY,
- EINVAL,
- "status code invalid"));
- }
-
-/* FIXME: thread safety */
- if (!attrs_inited) {
- init_attrs();
- attrs_inited = true;
- }
- return attrs;
-}
-
-const std::string &
-JobStatus::getStateName(Code state)
-{
- if (state<0 || state>=CODE_MAX) {
- STACK_ADD;
- throw(Exception(EXCEPTION_MANDATORY,
- EINVAL,
- "status code invalid"));
- }
- return names[state];
-}
-
-
-void
-JobStatus::destroyFlesh(void *p)
-{
- edg_wll_JobStat *stat = (edg_wll_JobStat *) p;
- if (stat) {
- edg_wll_FreeStatus(stat);
- free(stat);
- }
-}
-
-EWL_END_NAMESPACE;
+++ /dev/null
-#ident "$Header$"
-
-/**
- * @file Notification.cpp
- * @version $Revision$
- */
-
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <string>
-#include <vector>
-
-#include "glite/lb/Notification.h"
-#include "glite/lb/JobStatus.h"
-#include "glite/lb/LoggingExceptions.h"
-#include "glite/lb/ServerConnection.h"
-
-#include "glite/lb/notifid.h"
-#include "glite/lb/notification.h"
-
-EWL_BEGIN_NAMESPACE;
-
-#define CLASS_PREFIX "glite::lb::Notification::"
-
-/* external prototypes */
-extern edg_wll_QueryRec **
-convertQueryVectorExt(const std::vector<std::vector<glite::lb::QueryRecord> > &);
-
-extern void
-freeQueryRecVector(edg_wll_QueryRec *);
-
-/* Constructors */
-Notification::Notification(void)
-{
- try {
- int ret = edg_wll_InitContext(&this->ctx);
- check_result(ret,this->ctx,"edg_wll_InitContext");
- this->notifId = NULL;
- this->valid = 0;
- } catch (Exception &e) {
- STACK_ADD;
- throw;
- }
-}
-
-Notification::Notification(const std::string notifid_str)
-{
- try {
- char *host;
- unsigned int port;
- int ret = edg_wll_InitContext(&this->ctx);
- check_result(ret,this->ctx,"edg_wll_InitContext");
- ret = edg_wll_NotifIdParse(notifid_str.c_str(),&this->notifId);
- check_result(ret,this->ctx,"edg_wll_NotifIdParse");
- edg_wll_NotifIdGetServerParts(this->notifId,&host,&port);
- edg_wll_SetParam(this->ctx, EDG_WLL_PARAM_NOTIF_SERVER, host);
- edg_wll_SetParam(this->ctx, EDG_WLL_PARAM_NOTIF_SERVER_PORT, port);
- free(host);
- this->valid = 0;
- } catch (Exception &e) {
- STACK_ADD;
- throw;
- }
-}
-
-Notification::Notification(const std::string host,const u_int16_t port)
-{
- try {
- int ret = edg_wll_InitContext(&ctx);
- check_result(ret,ctx,"edg_wll_InitContext");
- edg_wll_SetParam(ctx, EDG_WLL_PARAM_NOTIF_SERVER, host.c_str());
- edg_wll_SetParam(ctx, EDG_WLL_PARAM_NOTIF_SERVER_PORT, port);
- this->notifId = NULL;
- this->valid = 0;
- check_result(ret,ctx,"edg_wll_NotifIdCreate");
- } catch (Exception &e) {
- STACK_ADD;
- throw;
- }
-}
-
-/* Destructor */
-Notification::~Notification(void)
-{
- try {
- edg_wll_FreeContext(this->ctx);
- edg_wll_NotifIdFree(this->notifId);
- } catch (Exception &e) {
- STACK_ADD;
- throw;
- }
-}
-
-/* Methods */
-std::string
-Notification::getNotifId(void) const
-{
- try {
- std::string notifid_str;
- if (this->notifId != NULL) {
- notifid_str = edg_wll_NotifIdUnparse(this->notifId);
- return(notifid_str);
- } else {
- STACK_ADD;
- throw Exception(EXCEPTION_MANDATORY, EINVAL, "notifId not known at the moment");
- }
- } catch (Exception &e) {
- STACK_ADD;
- throw;
- }
-}
-
-time_t
-Notification::getValid(void) const
-{
- return(this->valid);
-}
-
-int
-Notification::getFd(void) const
-{
- try {
- int ret = edg_wll_NotifGetFd(this->ctx);
- check_result(ret,this->ctx,"edg_wll_NotifGetFd");
- return(ret);
- } catch (Exception &e) {
- STACK_ADD;
- throw;
- }
-}
-
-void
-Notification::addJob(const glite::wmsutils::jobid::JobId &jobId)
-{
- std::vector<glite::wmsutils::jobid::JobId>::iterator it;
-
- try {
- if (this->notifId != NULL) {
- STACK_ADD;
- throw Exception(EXCEPTION_MANDATORY, EINVAL, "adding jobs allowed only before registering");
- }
- for( it = jobs.begin(); it != jobs.end(); it++ ) {
- if ( (*it).toString() == jobId.toString() ) {
- STACK_ADD;
- throw Exception(EXCEPTION_MANDATORY, EINVAL, "job already exists");
- }
- }
- jobs.push_back(jobId);
-
- } catch (Exception &e) {
- STACK_ADD;
- throw;
- }
-}
-
-void
-Notification::removeJob(const glite::wmsutils::jobid::JobId &jobId)
-{
- std::vector<glite::wmsutils::jobid::JobId>::iterator it;
- int removed = 0;
-
- try {
- if (this->notifId != NULL) {
- STACK_ADD;
- throw Exception(EXCEPTION_MANDATORY, EINVAL, "removing jobs allowed only before registering");
- }
- for( it = jobs.begin(); it != jobs.end(); it++ ) {
- if ( (*it).toString() == jobId.toString() ) {
- jobs.erase(it);
- removed += 1;
-// break;
- }
- }
- } catch (Exception &e) {
- STACK_ADD;
- throw;
- }
-
- if (removed == 0) {
- STACK_ADD;
- throw Exception(EXCEPTION_MANDATORY, EINVAL, "no job to remove");
- }
-}
-
-/* XXX: obsolete, used only for debugging purposes */
-
-std::string
-Notification::getJobs(void)
-{
- std::vector<glite::wmsutils::jobid::JobId>::iterator it;
- std::string ret="";
-
- try {
- for( it = jobs.begin(); it != jobs.end(); it++ ) {
- ret += (*it).toString();
- ret += "\n";
- }
- return ret;
-
- } catch (Exception &e) {
- STACK_ADD;
- throw;
- }
-}
-
-void
-Notification::setStates(const std::vector<glite::lb::JobStatus::Code> &jobStates)
-{
- if (this->notifId != NULL) {
- STACK_ADD;
- throw Exception(EXCEPTION_MANDATORY, EINVAL, "removing jobs allowed only before registering");
- }
- states = jobStates;
-}
-
-std::string
-Notification::getStates(void)
-{
- std::vector<glite::lb::JobStatus::Code>::iterator it;
- JobStatus js;
- std::string ret="";
-
- try {
- for( it = states.begin(); it != states.end(); it++ ) {
- js.status = (*it);
- ret += js.name();
- ret += "\n";
- }
- return ret;
-
- } catch (Exception &e) {
- STACK_ADD;
- throw;
- }
-}
-
-void
-Notification::Register(void)
-{
- int ret = 0;
- std::vector<glite::wmsutils::jobid::JobId>::iterator it;
- std::vector<glite::lb::JobStatus::Code>::iterator its;
- std::vector<std::vector<glite::lb::QueryRecord> > queryExt;
- edg_wll_QueryRec **conditions = NULL;
- unsigned i;
-
- try {
- if (this->notifId != NULL) {
- STACK_ADD;
- throw Exception(EXCEPTION_MANDATORY, EINVAL, "registering job allowed only once");
- }
- /* fill in the query: */
- std::vector<glite::lb::QueryRecord> query;
- for( it = jobs.begin(); it != jobs.end(); it++ ) {
- QueryRecord r0(QueryRecord::JOBID,QueryRecord::EQUAL,*it);
- query.push_back(r0);
- }
- queryExt.push_back(query);
- query.clear();
-
- for( its = states.begin(); its != states.end(); its++ ) {
- QueryRecord r(QueryRecord::STATUS,QueryRecord::EQUAL,*its);
- query.push_back(r);
- }
- queryExt.push_back(query);
-
- /* convert query to conditions */
- conditions = convertQueryVectorExt(queryExt);
- /* register */
- ret = edg_wll_NotifNew(ctx,conditions,-1,NULL,¬ifId,&valid);
- check_result(ret,ctx,"edg_wll_NotifNew");
- /* clean */
- if (conditions) {
- for( i = 0; conditions[i]; i++ ) {
-// FIXME: not working :o(
-// freeQueryRecVector(conditions[i]);
- delete[] conditions[i];
- }
- delete[] conditions;
- }
- } catch (Exception &e) {
- /* clean */
- if (conditions) {
- for( i = 0; conditions[i]; i++ ) {
-// FIXME: not working :o(
-// freeQueryRecVector(conditions[i]);
- delete[] conditions[i];
- }
- delete[] conditions;
- }
- STACK_ADD;
- throw;
- }
-}
-
-void
-Notification::Bind(const std::string address_override)
-{
- try {
- if (this->notifId == NULL) {
- STACK_ADD;
- throw Exception(EXCEPTION_MANDATORY, EINVAL, "binding allowed only for given notifId");
- }
- int ret = edg_wll_NotifBind(this->ctx,this->notifId,-1,address_override.c_str(),&this->valid);
- check_result(ret,this->ctx,"edg_wll_NotifBind");
- }
- catch (Exception &e) {
- STACK_ADD;
- throw;
- }
-}
-
-
-
-
-int Notification::receive(glite::lb::JobStatus &jobStatus,timeval &timeout)
-{
- try {
- int ret = 0;
- edg_wll_JobStat *status = (edg_wll_JobStat *) calloc(1,sizeof(edg_wll_JobStat));
- if (status == NULL) {
- STACK_ADD;
- throw OSException(EXCEPTION_MANDATORY, ENOMEM, "allocating jobStatus");
- }
- ret = edg_wll_NotifReceive(ctx,-1,&timeout,status,¬ifId);
- if ( ret == ETIMEDOUT )
- return 1;
- check_result(ret,ctx,"edg_wll_NotifReceive");
- jobStatus = JobStatus(*status);
- return 0;
- }
- catch (Exception &e) {
- STACK_ADD;
- throw;
- }
-}
-
-EWL_END_NAMESPACE;
+++ /dev/null
-//#ident "$Header$"
-
-/**
- * @file ServerConnection.cpp
- * @version $Revision$
- */
-#include <string>
-#include <utility>
-#include <vector>
-
-#include <time.h>
-#include <errno.h>
-#include <stdio.h>
-
-#include <expat.h>
-
-#include "glite/wmsutils/jobid/JobId.h"
-#include "glite/wmsutils/jobid/JobIdExceptions.h"
-#include "glite/lb/context-int.h"
-#include "glite/lb/xml_conversions.h"
-
-#include "glite/lb/ServerConnection.h"
-#include "glite/lb/LoggingExceptions.h"
-
-EWL_BEGIN_NAMESPACE;
-
-/**
- * definitions of QueryRecord class
- */
-#define CLASS_PREFIX "glite::lb::QueryRecord::"
-
-
-QueryRecord::QueryRecord(const Attr a,
- const Op o,
- const std::string & v)
- : attr(a), oper(o), state(EDG_WLL_JOB_UNDEF), string_value(v)
-{
- switch(a) {
- case OWNER:
- case LOCATION:
- case DESTINATION:
- case HOST:
- case INSTANCE:
- break;
-
- default:
- STACK_ADD;
- throw Exception(EXCEPTION_MANDATORY, EINVAL, "invalid value for attribute: " + v);
- }
-}
-
-
-QueryRecord::QueryRecord(const Attr a,
- const Op o,
- const int v)
- : attr(a), oper(o), state(EDG_WLL_JOB_UNDEF), int_value(v)
-{
- switch(a) {
- case DONECODE:
- case STATUS:
- case SOURCE:
- case EVENT_TYPE:
- case LEVEL:
- case EXITCODE:
- break;
-
- default:
- STACK_ADD;
- throw Exception(EXCEPTION_MANDATORY, EINVAL, "attribute is not of integer type");
- }
-}
-
-
-QueryRecord::QueryRecord(const Attr a,
- const Op o,
- const struct timeval& v)
- : attr(a), oper(o), state(EDG_WLL_JOB_UNDEF), timeval_value(v)
-{
- switch(a) {
- case TIME:
- break;
-
- default:
- STACK_ADD;
- throw Exception(EXCEPTION_MANDATORY, EINVAL, "attribute is not of timeval type");
- }
-}
-
-
-QueryRecord::QueryRecord(const Attr a,
- const Op o,
- const glite::wmsutils::jobid::JobId& v)
- : attr(a), oper(o), state(EDG_WLL_JOB_UNDEF), jobid_value(v)
-{
- switch(a) {
- case JOBID:
- case PARENT:
- break;
-
- default:
- STACK_ADD;
- throw Exception(EXCEPTION_MANDATORY, EINVAL, "attribute is not of JobId type");
- }
-}
-
-
-QueryRecord::QueryRecord(const Attr a,
- const Op o,
- const int s,
- const struct timeval &v)
- : attr(a), oper(o), state(s), timeval_value(v)
-{
- switch(a) {
- case TIME:
- break;
-
- default:
- STACK_ADD;
- throw Exception(EXCEPTION_MANDATORY, EINVAL, "attribute is not of timeval type");
- }
-}
-
-
-QueryRecord::QueryRecord(const Attr a,
- const Op o,
- const std::string &v1,
- const std::string &v2)
- : attr(a), oper(o), state(EDG_WLL_JOB_UNDEF), string_value(v1), string_value2(v2)
-{
- switch(a) {
- case OWNER:
- case LOCATION:
- case DESTINATION:
- case HOST:
- case INSTANCE:
- break;
-
- default:
- STACK_ADD;
- throw Exception(EXCEPTION_MANDATORY, EINVAL, "invalid value for attribute type");
- }
- if(o != WITHIN) {
- STACK_ADD;
- throw Exception(EXCEPTION_MANDATORY, EINVAL, "only operator WITHIN allowed with two values");
- }
-}
-
-
-QueryRecord::QueryRecord(const Attr a,
- const Op o,
- const int v1,
- const int v2)
- : attr(a), oper(o), state(EDG_WLL_JOB_UNDEF), int_value(v1), int_value2(v2)
-{
- switch(a) {
- case DONECODE:
- case STATUS:
- case SOURCE:
- case EVENT_TYPE:
- case LEVEL:
- case EXITCODE:
- break;
-
- default:
- STACK_ADD;
- throw Exception(EXCEPTION_MANDATORY, EINVAL, "attribute is not of integer type");
- }
- if(o != WITHIN) {
- STACK_ADD;
- throw Exception(EXCEPTION_MANDATORY, EINVAL, "only operator WITHIN allowed with two values");
- }
-}
-
-
-QueryRecord::QueryRecord(const Attr a,
- const Op o,
- const struct timeval &v1,
- const struct timeval &v2)
- : attr(a), oper(o), state(EDG_WLL_JOB_UNDEF), timeval_value(v1), timeval_value2(v2)
-{
- switch(a) {
- case TIME:
- break;
-
- default:
- STACK_ADD;
- throw Exception(EXCEPTION_MANDATORY, EINVAL, "attribute is not of timeval type");
- }
- if(o != WITHIN) {
- STACK_ADD;
- throw Exception(EXCEPTION_MANDATORY, EINVAL, "only operator WITHIN allowed with two values");
- }
-}
-
-
-QueryRecord::QueryRecord(const Attr a,
- const Op o,
- const int s,
- const struct timeval &v1,
- const struct timeval &v2)
- : attr(a), oper(o), state(s), timeval_value(v1), timeval_value2(v2)
-{
- switch(a) {
- case TIME:
- break;
-
- default:
- STACK_ADD;
- throw Exception(EXCEPTION_MANDATORY, EINVAL, "attribute is not of timeval type");
- }
- if(o != WITHIN) {
- STACK_ADD;
- throw Exception(EXCEPTION_MANDATORY, EINVAL, "only operator WITHIN allowed with two values");
- }
-}
-
-
-QueryRecord::QueryRecord(const std::string &tag,
- const Op o,
- const std::string &val)
- : attr(USERTAG), oper(o), tag_name(tag), state(EDG_WLL_JOB_UNDEF), string_value(val)
-{
-}
-
-
-QueryRecord::QueryRecord(const std::string &tag,
- const Op o,
- const std::string &v1,
- const std::string &v2)
- : attr(USERTAG), oper(o), tag_name(tag), state(EDG_WLL_JOB_UNDEF),
- string_value(v1), string_value2(v2)
-
-{
- if(o != WITHIN) {
- STACK_ADD;
- throw Exception(EXCEPTION_MANDATORY, EINVAL, "only operator WITHIN allowed with two values");
- }
-}
-
-
-QueryRecord::QueryRecord(const QueryRecord &src)
-{
- attr = src.attr;
- oper = src.oper;
-
- switch (attr) {
-
- case USERTAG:
- tag_name = src.tag_name;
-
- case OWNER:
- case LOCATION:
- case DESTINATION:
- case HOST:
- case INSTANCE:
- string_value = src.string_value;
- if(src.oper == WITHIN)
- string_value2 = src.string_value2;
- break;
-
- case DONECODE:
- case STATUS:
- case SOURCE:
- case EVENT_TYPE:
- case LEVEL:
- case EXITCODE:
- int_value = src.int_value;
- if(src.oper == WITHIN)
- int_value2 = src.int_value2;
- break;
-
- case TIME:
- timeval_value = src.timeval_value;
- if(src.oper == WITHIN)
- timeval_value2 = src.timeval_value2;
- state = src.state;
- break;
-
- case JOBID:
- jobid_value = src.jobid_value;
- break;
-
- default:
- STACK_ADD;
- throw Exception(EXCEPTION_MANDATORY, EINVAL, "query attribute not defined");
- }
-}
-
-
-QueryRecord::QueryRecord() : attr(UNDEF), oper(EQUAL)
-{
-}
-
-
-QueryRecord::~QueryRecord()
-{
-}
-
-
-QueryRecord&
-QueryRecord::operator=(const QueryRecord &src)
-{
- if(this == &src)
- return(*this);
-
- attr = src.attr;
- oper = src.oper;
-
- switch (attr) {
-
- case USERTAG:
- tag_name = src.tag_name;
-
- case OWNER:
- case LOCATION:
- case DESTINATION:
- case HOST:
- case INSTANCE:
- string_value = src.string_value;
- if(oper == WITHIN)
- string_value2 = src.string_value2;
- break;
-
- case DONECODE:
- case STATUS:
- case SOURCE:
- case EVENT_TYPE:
- case LEVEL:
- case EXITCODE:
- int_value = src.int_value;
- if(oper == WITHIN)
- int_value2 = src.int_value2;
- break;
-
- case TIME:
- timeval_value = src.timeval_value;
- state = src.state;
- if(oper == WITHIN)
- timeval_value2 = src.timeval_value2;
- break;
-
- case JOBID:
- jobid_value = src.jobid_value;
- break;
-
- default:
- STACK_ADD;
- throw Exception(EXCEPTION_MANDATORY, EINVAL, "query attribute not defined");
- }
-
- return *this;
-}
-
-
-QueryRecord::operator edg_wll_QueryRec() const
-{
- edg_wll_QueryRec out;
-
- out.attr = edg_wll_QueryAttr(attr);
- out.op = edg_wll_QueryOp(oper);
-
- switch (attr) {
-
- case USERTAG:
- out.attr_id.tag = strdup(tag_name.c_str());
-
- case OWNER:
- case LOCATION:
- case DESTINATION:
- case HOST:
- case INSTANCE:
- out.value.c = strdup(string_value.c_str());
- if(oper == WITHIN)
- out.value2.c = strdup(string_value2.c_str());
- break;
-
-
- case DONECODE:
- case STATUS:
- case SOURCE:
- case EVENT_TYPE:
- case LEVEL:
- case EXITCODE:
- out.value.i = int_value;
- if(oper == WITHIN)
- out.value2.i = int_value2;
- break;
-
- case TIME:
- out.value.t = timeval_value;
- out.attr_id.state = (edg_wll_JobStatCode)state;
- if(oper == WITHIN)
- out.value2.t = timeval_value2;
- break;
-
- case JOBID:
- out.value.j = jobid_value;
- break;
-
- case UNDEF:
- break;
-
- default:
- STACK_ADD;
- throw Exception(EXCEPTION_MANDATORY, EINVAL, "query attribute not defined");
- }
-
- return(out);
-}
-
-const std::string QueryRecord::AttrName(const QueryRecord::Attr attr)
-{
- char *an = edg_wll_query_attrToString(edg_wll_QueryAttr(attr));
- std::string ret(an);
- free(an);
- return ret;
-}
-
-
-/**
- * definitions of ServerConnection class
- */
-#undef CLASS_PREFIX
-#define CLASS_PREFIX "glite::lb::ServerConnection::"
-
-ServerConnection::ServerConnection()
-{
- int ret;
- edg_wll_Context tmp_context;
-
- if((ret=edg_wll_InitContext(&tmp_context)) < 0) {
- STACK_ADD;
- throw OSException(EXCEPTION_MANDATORY, ret, "initializing context");
- }
-
- context = tmp_context;
-}
-
-
-ServerConnection::~ServerConnection()
-{
- /* no exceptions should be thrown from destructors */
- edg_wll_FreeContext(context);
-}
-
-
-/********************/
-/* BEGIN DEPRECATED */
-
-ServerConnection::ServerConnection(const std::string &in)
-{
- STACK_ADD;
- throw Exception(EXCEPTION_MANDATORY, 0, "method deprecated");
-}
-
-
-void
-ServerConnection::open(const std::string & in)
-{
- STACK_ADD;
- throw Exception(EXCEPTION_MANDATORY, 0, "method deprecated");
-}
-
-
-void
-ServerConnection::close(void)
-{
- STACK_ADD;
- throw Exception(EXCEPTION_MANDATORY, 0, "method deprecated");
-}
-
-/* END DEPRECATED */
-/******************/
-
-
-void
-ServerConnection::setQueryServer(const std::string& server, int port)
-{
- check_result(edg_wll_SetParamString(context,
- EDG_WLL_PARAM_QUERY_SERVER,
- server.c_str()),
- context,
- "setting query server address");
- check_result(edg_wll_SetParamInt(context,
- EDG_WLL_PARAM_QUERY_SERVER_PORT,
- port),
- context,
- "setting query server port");
-}
-
-
-void
-ServerConnection::setQueryTimeout(int timeout)
-{
- check_result(edg_wll_SetParamInt(context,
- EDG_WLL_PARAM_QUERY_TIMEOUT,
- timeout),
- context,
- "setting query timeout");
-}
-
-
-void ServerConnection::setX509Proxy(const std::string& proxy)
-{
- check_result(edg_wll_SetParamString(context,
- EDG_WLL_PARAM_X509_PROXY,
- proxy.c_str()),
- context,
- "setting X509 proxy");
-}
-
-
-void ServerConnection::setX509Cert(const std::string& cert, const std::string& key)
-{
- check_result(edg_wll_SetParamString(context,
- EDG_WLL_PARAM_X509_CERT,
- cert.c_str()),
- context,
- "setting X509 certificate");
- check_result(edg_wll_SetParamString(context,
- EDG_WLL_PARAM_X509_KEY,
- key.c_str()),
- context,
- "setting X509 key");
-}
-
-
-void
-ServerConnection::setQueryEventsLimit(int max) {
- check_result(edg_wll_SetParamInt(context,
- EDG_WLL_PARAM_QUERY_EVENTS_LIMIT,
- max),
- context,
- "setting query events limit");
-}
-
-void
-ServerConnection::setQueryJobsLimit(int max) {
- check_result(edg_wll_SetParamInt(context,
- EDG_WLL_PARAM_QUERY_JOBS_LIMIT,
- max),
- context,
- "setting query jobs limit");
-}
-
-
-std::pair<std::string, int>
-ServerConnection::getQueryServer() const
-{
- char *hostname;
- int port;
-
- check_result(edg_wll_GetParam(context,
- EDG_WLL_PARAM_QUERY_SERVER,
- &hostname),
- context,
- "getting query server address");
- check_result(edg_wll_GetParam(context,
- EDG_WLL_PARAM_QUERY_SERVER_PORT,
- &port),
- context,
- "getting query server port");
- return std::pair<std::string,int>(std::string(strdup(hostname)), port);
-}
-
-
-int
-ServerConnection::getQueryTimeout() const
-{
- int timeout;
-
- check_result(edg_wll_GetParam(context,
- EDG_WLL_PARAM_QUERY_TIMEOUT,
- &timeout),
- context,
- "getting query timeout");
- return timeout;
-}
-
-
-std::string
-ServerConnection::getX509Proxy() const
-{
- char *proxy;
-
- check_result(edg_wll_GetParam(context,
- EDG_WLL_PARAM_X509_PROXY,
- &proxy),
- context,
- "getting X509 proxy");
- return std::string(strdup(proxy));
-}
-
-
-std::pair<std::string, std::string>
-ServerConnection::getX509Cert() const
-{
- char *cert, *key;
-
- check_result(edg_wll_GetParam(context,
- EDG_WLL_PARAM_X509_CERT,
- &cert),
- context,
- "getting X509 cert");
- check_result(edg_wll_GetParam(context,
- EDG_WLL_PARAM_X509_KEY,
- &key),
- context,
- "getting X509 key");
-
- return std::pair<std::string, std::string>(std::string(strdup(cert)),
- std::string(strdup(key)));
-}
-
-// static
-void freeQueryRecVector(edg_wll_QueryRec *v)
-{
- for(; v->attr != EDG_WLL_QUERY_ATTR_UNDEF; v++)
- edg_wll_QueryRecFree(v);
-}
-
-std::vector<std::vector<std::pair<QueryRecord::Attr,std::string> > >
-ServerConnection::getIndexedAttrs(void) {
- edg_wll_QueryRec **recs;
- int i,j;
- std::vector<std::vector<std::pair<QueryRecord::Attr,std::string> > > out;
-
- check_result(edg_wll_GetIndexedAttrs(context,&recs),context,
- "edg_wll_GetIndexedAttrs()");
-
- if (!recs) return out;
-
- for (i=0; recs[i]; i++) {
- std::vector<std::pair<QueryRecord::Attr,std::string> > idx;
- for (j=0; recs[i][j].attr; j++) {
- char *s = strdup("");
- if (recs[i][j].attr == EDG_WLL_QUERY_ATTR_USERTAG)
- s = strdup(recs[i][j].attr_id.tag);
- else if (recs[i][j].attr == EDG_WLL_QUERY_ATTR_TIME)
- s = edg_wll_StatToString(recs[i][j].attr_id.state);
- idx.push_back(
- std::pair<QueryRecord::Attr,std::string>(
- QueryRecord::Attr(recs[i][j].attr),s)
- );
- free(s);
- }
- freeQueryRecVector(recs[i]);
- out.push_back(idx);
- }
- free(recs);
- return out;
-}
-
-
-
-
-edg_wll_QueryRec *
-convertQueryVector(const std::vector<QueryRecord> &in)
-{
- unsigned i;
- edg_wll_QueryRec *out = new edg_wll_QueryRec[in.size() + 1];
- QueryRecord empty;
-
- if(out == NULL) {
- STACK_ADD;
- throw OSException(EXCEPTION_MANDATORY, ENOMEM, "allocating vector for conversion");
- }
-
- try {
- for(i = 0; i < in.size(); i++) {
- out[i] = in[i];
- }
- out[i] = empty;
- } catch (Exception &e) {
- STACK_ADD;
- throw;
- }
- return(out);
-}
-
-
-edg_wll_QueryRec **
-convertQueryVectorExt(const std::vector<std::vector<QueryRecord> > &in)
-{
- unsigned i;
- edg_wll_QueryRec **out = new edg_wll_QueryRec*[in.size() + 1];
-
- if(out == NULL) {
- STACK_ADD;
- throw OSException(EXCEPTION_MANDATORY, ENOMEM, "allocating vector for conversion");
- }
-
- try {
- for(i = 0; i < in.size(); i++) {
- out[i] = convertQueryVector(in[i]);
- }
- out[i] = NULL;
- } catch (Exception &e) {
- STACK_ADD;
- throw;
- }
- return(out);
-}
-
-void
-ServerConnection::queryEvents(const std::vector<QueryRecord>& job_cond,
- const std::vector<QueryRecord>& event_cond,
- std::vector<Event> & eventList) const
-{
- edg_wll_QueryRec *job_rec = NULL, *event_rec = NULL;
- edg_wll_Event *events = NULL;
- unsigned i;
- int result, qresults_param;
- char *errstr = NULL;
-
- /* convert input */
- try {
- job_rec = convertQueryVector(job_cond);
- event_rec = convertQueryVector(event_cond);
-
- /* do the query */
-
- result = edg_wll_QueryEvents(context, job_rec, event_rec, &events);
- if (result == E2BIG) {
- edg_wll_Error(context, NULL, &errstr);
- check_result(edg_wll_GetParam(context,
- EDG_WLL_PARAM_QUERY_RESULTS, &qresults_param),
- context,
- "edg_wll_GetParam(EDG_WLL_PARAM_QUERY_RESULTS)");
- if (qresults_param != EDG_WLL_QUERYRES_LIMITED) {
- edg_wll_SetError(context, result, errstr);
- check_result(result, context,"edg_wll_QueryEvents");
- }
- } else {
- check_result(result, context,"edg_wll_QueryEvents");
- }
-
- /* convert output */
- for (i=0; events[i].type != EDG_WLL_EVENT_UNDEF; i++) {
- edg_wll_Event *ev = (edg_wll_Event *) malloc(sizeof *ev);
- memcpy(ev,events+i,sizeof *ev);
- Event e(ev);
-
- eventList.push_back(e);
- }
-
- if (result) {
- edg_wll_SetError(context, result, errstr);
- check_result(result, context,"edg_wll_QueryEvents");
- }
-
- free(events);
- delete[] job_rec;
- delete[] event_rec;
-
- } catch(Exception &e) {
- if(job_rec) delete[] job_rec;
- if(event_rec) delete[] event_rec;
- if(events) free(events);
- if(errstr) free(errstr);
-
- STACK_ADD;
- throw;
- }
-}
-
-
-const std::vector<Event>
-ServerConnection::queryEvents(const std::vector<QueryRecord>& job_cond,
- const std::vector<QueryRecord>& event_cond) const
-{
- std::vector<Event> eventList;
-
- queryEvents(job_cond, event_cond,eventList);
- return eventList;
-}
-
-const std::list<Event>
-ServerConnection::queryEventsList(const std::vector<QueryRecord>& job_cond,
- const std::vector<QueryRecord>& event_cond) const
-{
- std::vector<Event> events;
-
- queryEvents(job_cond, event_cond, events);
- return std::list<Event>(events.begin(),events.end());
-}
-
-std::string
-ServerConnection::queryEventsAggregate(const std::vector<QueryRecord>& job_cond,
- const std::vector<QueryRecord>& event_cond,
- enum AggOp const op,
- std::string const attr) const
-{
- STACK_ADD;
- throw Exception(EXCEPTION_MANDATORY, 0, "method not implemented");
- return ""; // gcc warning;
-}
-
-
-void
-ServerConnection::queryEvents(const std::vector<std::vector<QueryRecord> >& job_cond,
- const std::vector<std::vector<QueryRecord> >& event_cond,
- std::vector<Event>& eventList) const
-{
- edg_wll_QueryRec **job_rec = NULL, **event_rec = NULL;
- edg_wll_Event *events = NULL;
- unsigned i;
-
- /* convert input */
- try {
- job_rec = convertQueryVectorExt(job_cond);
- event_rec = convertQueryVectorExt(event_cond);
-
- /* do the query */
-
- check_result(edg_wll_QueryEventsExt(context,
- (const edg_wll_QueryRec**)job_rec,
- (const edg_wll_QueryRec**)event_rec,
- &events),
- context,
- "edg_wll_QueryEvents");
-
- /* convert output */
- for (i=0; events[i].type != EDG_WLL_EVENT_UNDEF; i++) {
- edg_wll_Event *ev = (edg_wll_Event *) malloc(sizeof *ev);
- memcpy(ev,events+i,sizeof *ev);
- Event e(ev);
-
- eventList.push_back(e);
- }
-
- free(events);
-
- for(i = 0 ; job_rec[i]; i++) delete[] job_rec[i];
- for(i = 0 ; event_rec[i]; i++) delete[] event_rec[i];
- delete[] job_rec;
- delete[] event_rec;
-
- } catch(Exception &e) {
-
- if(job_rec) {
- for(i = 0 ; job_rec[i]; i++) delete[] job_rec[i];
- delete[] job_rec;
- }
- if(event_rec) {
- for(i = 0 ; event_rec[i]; i++) delete[] event_rec[i];
- delete[] event_rec;
- }
- if(events) free(events);
-
- STACK_ADD;
- throw;
- }
-}
-
-
-const std::vector<Event>
-ServerConnection::queryEvents(const std::vector<std::vector<QueryRecord> >& job_cond,
- const std::vector<std::vector<QueryRecord> >& event_cond) const
-{
- std::vector<Event> eventList;
-
- queryEvents(job_cond, event_cond,eventList);
- return eventList;
-}
-
-
-void ServerConnection::queryJobs(const std::vector<QueryRecord>& query,
- std::vector<glite::wmsutils::jobid::JobId> & ids) const
-{
- edg_wll_QueryRec *cond = NULL;
- edg_wlc_JobId *jobs, *j;
- int result, qresults_param;
- char *errstr = NULL;
-
- try {
- cond = convertQueryVector(query);
-
- result = edg_wll_QueryJobs(context, cond, 0, &jobs, NULL);
- if (result == E2BIG) {
- edg_wll_Error(context, NULL, &errstr);
- check_result(edg_wll_GetParam(context,
- EDG_WLL_PARAM_QUERY_RESULTS, &qresults_param),
- context,
- "edg_wll_GetParam(EDG_WLL_PARAM_QUERY_RESULTS)");
- if (qresults_param != EDG_WLL_QUERYRES_LIMITED) {
- edg_wll_SetError(context, result, errstr);
- check_result(result, context,"edg_wll_QueryJobs");
- }
- } else {
- check_result(result, context,"edg_wll_QueryJobs");
- }
-
- for(j = jobs; *j; j++)
- ids.push_back(glite::wmsutils::jobid::JobId(*j));
-
- if (result) {
- edg_wll_SetError(context, result, errstr);
- check_result(result, context,"edg_wll_QueryJobs");
- }
-
- free(jobs);
- freeQueryRecVector(cond);
- delete[] cond;
-
- } catch (Exception &e) {
- if(cond) {
- freeQueryRecVector(cond);
- delete[] cond;
- }
- if (errstr) free(errstr);
-
- STACK_ADD;
- throw;
- }
-}
-
-
-const std::vector<glite::wmsutils::jobid::JobId>
-ServerConnection::queryJobs(const std::vector<QueryRecord>& query) const
-{
- std::vector<glite::wmsutils::jobid::JobId> jobList;
-
- queryJobs(query, jobList);
- return jobList;
-}
-
-
-void
-ServerConnection::queryJobs(const std::vector<std::vector<QueryRecord> >& query,
- std::vector<glite::wmsutils::jobid::JobId>& ids) const
-{
- edg_wll_QueryRec **cond = NULL;
- edg_wlc_JobId *jobs, *j;
- int result, qresults_param;
- char *errstr = NULL;
-
- try {
- cond = convertQueryVectorExt(query);
-
- result = edg_wll_QueryJobsExt(context, (const edg_wll_QueryRec**)cond,
- 0, &jobs, NULL);
- if (result == E2BIG) {
- edg_wll_Error(context, NULL, &errstr);
- check_result(edg_wll_GetParam(context,
- EDG_WLL_PARAM_QUERY_RESULTS, &qresults_param),
- context,
- "edg_wll_GetParam(EDG_WLL_PARAM_QUERY_RESULTS)");
- if (qresults_param != EDG_WLL_QUERYRES_LIMITED) {
- edg_wll_SetError(context, result, errstr);
- check_result(result, context,"edg_wll_QueryJobsExt");
- }
- } else {
- check_result(result, context,"edg_wll_QueryJobsExt");
- }
-
- for(j = jobs; *j; j++)
- ids.push_back(glite::wmsutils::jobid::JobId(*j));
-
- if (result) {
- edg_wll_SetError(context, result, errstr);
- check_result(result, context,"edg_wll_QueryJobsExt");
- }
-
- free(jobs);
- {
- unsigned i;
-
- for(i = 0; cond[i]; i++) {
- freeQueryRecVector(cond[i]);
- delete[] cond[i];
- }
- delete[] cond;
- }
-
- } catch (Exception &e) {
- unsigned i;
- if(cond) {
- for(i = 0; cond[i]; i++) {
- freeQueryRecVector(cond[i]);
- delete[] cond[i];
- }
- delete[] cond;
- }
- if (errstr) free(errstr);
-
- STACK_ADD;
- throw;
- }
-}
-
-
-const
-std::vector<glite::wmsutils::jobid::JobId>
-ServerConnection::queryJobs(const std::vector<std::vector<QueryRecord> >& query) const
-{
- std::vector<glite::wmsutils::jobid::JobId> jobList;
-
- queryJobs(query, jobList);
- return jobList;
-}
-
-
-void
-ServerConnection::queryJobStates(const std::vector<QueryRecord>& query,
- int flags,
- std::vector<JobStatus> & states) const
-{
- edg_wll_QueryRec *cond = NULL;
- edg_wll_JobStat *jobs, *j;
- int result, qresults_param;
- char *errstr = NULL;
-
- try {
- cond = convertQueryVector(query);
-
- result = edg_wll_QueryJobs(context, cond, flags, NULL, &jobs);
- if (result == E2BIG) {
- edg_wll_Error(context, NULL, &errstr);
- check_result(edg_wll_GetParam(context,
- EDG_WLL_PARAM_QUERY_RESULTS, &qresults_param),
- context,
- "edg_wll_GetParam(EDG_WLL_PARAM_QUERY_RESULTS)");
- if (qresults_param != EDG_WLL_QUERYRES_LIMITED) {
- edg_wll_SetError(context, result, errstr);
- check_result(result, context,"edg_wll_QueryJobs");
- }
- } else {
- check_result(result, context,"edg_wll_QueryJobs");
- }
-
- for(j = jobs; j->state != EDG_WLL_JOB_UNDEF; j++) {
- edg_wll_JobStat *jsep = new edg_wll_JobStat;
- if (jsep != NULL) {
- memcpy(jsep, j, sizeof(*j));
- states.push_back(JobStatus(*jsep));
- }
- }
-
- if (result) {
- edg_wll_SetError(context, result, errstr);
- check_result(result, context,"edg_wll_QueryJobs");
- }
-
- delete jobs;
-
- freeQueryRecVector(cond);
- delete[] cond;
-
- } catch (Exception &e) {
- if(cond) {
- freeQueryRecVector(cond);
- delete[] cond;
- }
- if (errstr) free(errstr);
-
- STACK_ADD;
- throw;
- }
-}
-
-
-const std::vector<JobStatus>
-ServerConnection::queryJobStates(const std::vector<QueryRecord>& query,
- int flags) const
-{
- std::vector<JobStatus> states;
-
- queryJobStates(query, flags, states);
- return(states);
-}
-
-const std::list<JobStatus>
-ServerConnection::queryJobStatesList(const std::vector<QueryRecord>& query,
- int flags) const
-{
- std::vector<JobStatus> states;
-
- queryJobStates(query, flags, states);
- return std::list<JobStatus>(states.begin(),states.end());
-}
-
-
-void
-ServerConnection::queryJobStates(const std::vector<std::vector<QueryRecord> >& query,
- int flags,
- std::vector<JobStatus> & states) const
-{
- edg_wll_QueryRec **cond = NULL;
- edg_wll_JobStat *jobs, *j;
- int result, qresults_param;
- char *errstr = NULL;
-
- try {
- cond = convertQueryVectorExt(query);
-
- result = edg_wll_QueryJobsExt(context, (const edg_wll_QueryRec**)cond,
- flags, NULL, &jobs);
- if (result == E2BIG) {
- edg_wll_Error(context, NULL, &errstr);
- check_result(edg_wll_GetParam(context,
- EDG_WLL_PARAM_QUERY_RESULTS, &qresults_param),
- context,
- "edg_wll_GetParam(EDG_WLL_PARAM_QUERY_RESULTS)");
- if (qresults_param != EDG_WLL_QUERYRES_LIMITED) {
- edg_wll_SetError(context, result, errstr);
- check_result(result, context,"edg_wll_QueryJobsExt");
- }
- } else {
- check_result(result, context,"edg_wll_QueryJobsExt");
- }
-
- for(j = jobs; j->state != EDG_WLL_JOB_UNDEF; j++) {
- edg_wll_JobStat *jsep = new edg_wll_JobStat;
- if (jsep != NULL) {
- memcpy(jsep, j, sizeof(*j));
- states.push_back(JobStatus(*jsep));
- }
- }
-
- if (result) {
- edg_wll_SetError(context, result, errstr);
- check_result(result, context,"edg_wll_QueryJobsExt");
- }
-
- delete jobs;
-
- {
- unsigned i;
-
- for(i = 0; cond[i]; i++) {
- freeQueryRecVector(cond[i]);
- delete[] cond[i];
- }
- delete[] cond;
- }
-
-
- } catch (Exception &e) {
- unsigned i;
- if(cond) {
- for(i = 0; cond[i]; i++) {
- freeQueryRecVector(cond[i]);
- delete[] cond[i];
- }
- delete[] cond;
- }
- if (errstr) free(errstr);
-
- STACK_ADD;
- throw;
- }
-}
-
-
-const std::vector<JobStatus>
-ServerConnection::queryJobStates(const std::vector<std::vector<QueryRecord> >& query,
- int flags) const
-{
- std::vector<JobStatus> states;
-
- queryJobStates(query, flags, states);
- return(states);
-}
-
-
-void ServerConnection::userJobs(std::vector<glite::wmsutils::jobid::JobId> & ids) const
-{
- edg_wlc_JobId *jobs, *j;
- int result, qresults_param;
- char *errstr = NULL;
-
- try {
- result = edg_wll_UserJobs(context, &jobs, NULL);
- if (result == E2BIG) {
- edg_wll_Error(context, NULL, &errstr);
- check_result(edg_wll_GetParam(context,
- EDG_WLL_PARAM_QUERY_RESULTS, &qresults_param),
- context,
- "edg_wll_GetParam(EDG_WLL_PARAM_QUERY_RESULTS)");
- if (qresults_param != EDG_WLL_QUERYRES_LIMITED) {
- edg_wll_SetError(context, result, errstr);
- check_result(result, context,"edg_wll_UserJobs");
- }
- } else {
- check_result(result, context,"edg_wll_UserJobs");
- }
-
- for(j = jobs; *j; j++)
- ids.push_back(glite::wmsutils::jobid::JobId(*j));
-
- if (result) {
- edg_wll_SetError(context, result, errstr);
- check_result(result, context,"edg_wll_QueryJobsExt");
- }
-
- free(jobs);
-
- } catch (Exception &e) {
- if (errstr) free(errstr);
-
- STACK_ADD;
- throw;
- }
-}
-
-
-const std::vector<glite::wmsutils::jobid::JobId>
-ServerConnection::userJobs() const
-{
- std::vector<glite::wmsutils::jobid::JobId> jobList;
-
- userJobs(jobList);
- return jobList;
-}
-
-
-void
-ServerConnection::userJobStates(std::vector<JobStatus> & states) const
-{
- edg_wll_JobStat *jobs, *j;
- int result, qresults_param;
- char *errstr = NULL;
-
- try {
- result = edg_wll_UserJobs(context, NULL, &jobs);
- if (result == E2BIG) {
- edg_wll_Error(context, NULL, &errstr);
- check_result(edg_wll_GetParam(context,
- EDG_WLL_PARAM_QUERY_RESULTS, &qresults_param),
- context,
- "edg_wll_GetParam(EDG_WLL_PARAM_QUERY_RESULTS)");
- if (qresults_param != EDG_WLL_QUERYRES_LIMITED) {
- edg_wll_SetError(context, result, errstr);
- check_result(result, context,"edg_wll_UserJobs");
- }
- } else {
- check_result(result, context,"edg_wll_UserJobs");
- }
-
- for(j = jobs; j->state != EDG_WLL_JOB_UNDEF; j++) {
- edg_wll_JobStat *jsep = new edg_wll_JobStat;
- if (jsep != NULL) {
- memcpy(jsep, j, sizeof(*j));
- states.push_back(JobStatus(*jsep));
- }
- }
-
- if (result) {
- edg_wll_SetError(context, result, errstr);
- check_result(result, context,"edg_wll_QueryJobsExt");
- }
-
- delete jobs;
-
- } catch (Exception &e) {
- if (errstr) free(errstr);
-
- STACK_ADD;
- throw;
- }
-}
-
-
-const std::vector<JobStatus>
-ServerConnection::userJobStates() const
-{
- std::vector<JobStatus> states;
-
- userJobStates(states);
- return(states);
-}
-
-
-edg_wll_Context
-ServerConnection::getContext(void) const
-{
- return(context);
-}
-
-
-void ServerConnection::setParam(edg_wll_ContextParam par, int val)
-{
- check_result(edg_wll_SetParamInt(context,par,val),
- context,
- "edg_wll_SetParamInt()");
-}
-
-void ServerConnection::setParam(edg_wll_ContextParam par, const std::string &val)
-{
- check_result(edg_wll_SetParamString(context,par,val.c_str()),
- context,
- "edg_wll_SetParamString()");
-}
-
-void ServerConnection::setParam(edg_wll_ContextParam par, const struct timeval & val)
-{
- check_result(edg_wll_SetParamTime(context,par,&val),
- context,
- "edg_wll_SetParamTime()");
-}
-
-int ServerConnection::getParamInt(edg_wll_ContextParam par) const
-{
- int ret;
- check_result(edg_wll_GetParam(context,par,&ret),
- context,
- "edg_wll_GetParam()");
- return ret;
-}
-
-std::string ServerConnection::getParamString(edg_wll_ContextParam par) const
-{
- char *ret;
- std::string out;
-
- check_result(edg_wll_GetParam(context,par,&ret),
- context,
- "edg_wll_GetParam()");
-
- out = ret;
- free(ret);
- return out;
-}
-
-struct timeval ServerConnection::getParamTime(edg_wll_ContextParam par) const
-{
- struct timeval ret;
- check_result(edg_wll_GetParam(context,par,&ret),
- context,
- "edg_wll_GetParam()");
- return ret;
-}
-
-EWL_END_NAMESPACE;
+++ /dev/null
-/*
-@@@AUTO
-*/
-
-@@@LANG: C
-
-#include "args.h"
-#include "glite/lb/events.h"
-
-#include <stdio.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/utsname.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-
-typedef struct {
- int argc;
- char** argv;
- const char* help;
- int idx;
- edg_wll_Args list[1000];
- int last;
-} opt_ctx_t;
-
-/* lists of accepted tags */
-@@@{
- gen "static const char * const eventJobCommon\[] = {";
- selectType $event '_common_';
- for (getFieldsOrdered $event) {
- my $f = selectField $event $_;
- my $fn = $f->{name};
- gen "\"$fn\", ";
- }
- gen "NULL };\n";
-@@@}
-@@@{
- for my $t (sort { $event->{order}->{$a} <=> $event->{order}->{$b} }
- $event->getTypes) {
- gen "static const char * const event$t\[] = {";
- selectType $event $t;
- for (getFieldsOrdered $event) {
- my $f = selectField $event $_;
- my $fn = $f->{name};
- gen "\"$fn\", "
- }
- gen "NULL };\n";
- }
-@@@}
-
-static const char * const * const eventTags[] = {
- eventJobCommon,
-@@@{
- for my $t (sort { $event->{order}->{$a} <=> $event->{order}->{$b} }
- $event->getTypes) {
- gen "\tevent$t,\n";
- }
- gen "\tNULL\n};\n";
-@@@}
-
-static int read_bool(const edg_wll_Args* o, char* arg, char* par)
-{
- int b = 1;
- int rs = 0;
-
- if (par)
- {
- if (!strcasecmp(par, "off") || !strcmp(par, "0")
- || !strcasecmp(par, "false"))
- {
- b = 0;
- rs = 1;
- }
- else if (!strcasecmp(par, "on") || !strcmp(par, "1")
- || !strcasecmp(par, "true"))
- {
- rs = 1;
- }
- }
-
- if (o->value)
- *(int*)o->value = b;
- return rs;
-}
-
-static void read_float(const edg_wll_Args* o, char* arg, char* par)
-{
- float d;
- if (!par)
- {
- printf("Option: %s - missing float value\n", arg);
- exit(1);
- }
- d = strtof(par,NULL);
- if (o->min != o->max)
- {
- if (d < o->min && d > o->max)
- {
- printf("Option: %s - value: %f out of range <%d, %d>",
- arg, d, o->min, o->max);
- exit(1);
- }
- }
- if (o->value)
- *(float*)o->value = d;
-}
-
-static void read_double(const edg_wll_Args* o, char* arg, char* par)
-{
- double d;
- if (!par)
- {
- printf("Option: %s - missing double value\n", arg);
- exit(1);
- }
- d = strtod(par,NULL);
- if (o->min != o->max)
- {
- if (d < o->min && d > o->max)
- {
- printf("Option: %s - value: %f out of range <%d, %d>",
- arg, d, o->min, o->max);
- exit(1);
- }
- }
- if (o->value)
- *(double*)o->value = d;
-}
-
-static void read_string(const edg_wll_Args* o, char* arg, char* par)
-{
- if (!par)
- {
- printf("Option: %s - missing string value\n", arg);
- exit(1);
- }
- if (o->value)
- {
- if (strstr(arg, "-file"))
- {
- struct stat buf;
- int fd = open(par, O_RDONLY);
- if (fd >= 0)
- {
- char* b;
- fstat(fd, &buf);
- b = (char*) malloc(buf.st_size);
- if (b)
- {
- int p = 0;
- printf("Opened & reading %s %lld\n",
- par, (long long)buf.st_size);
- while (p < buf.st_size)
- {
- int r = read(fd, b + p, buf.st_size);
- if (r < 0)
- break;
- p += r;
- }
-
- *(char**)o->value = b;
- }
- close(fd);
- }
- else
- fprintf(stderr, "can't open file: \"%s\" (%s)\n", par, strerror(errno));
-
- }
- else
- *(char**)o->value = strdup(par);
- }
-}
-
-static void read_int(const edg_wll_Args* o, char* arg, char* par)
-{
- int v = 0;
- if (!par)
- {
- printf("Option: %s - missing integer value\n", arg);
- exit(1);
- }
- sscanf(par, "%i", &v);
- if (o->min != o->max)
- {
- if (v < o->min && v > o->max)
- {
- printf("Option: %s - value: %d out of range <%d, %d>",
- arg, v, o->min, o->max);
- exit(1);
- }
- }
- if (o->value)
- *(int*)o->value = v;
-}
-
-static void read_uint16(const edg_wll_Args* o, char* arg, char* par)
-{
- int v = 0;
- if (!par)
- {
- printf("Option: %s - missing integer value\n", arg);
- exit(1);
- }
- sscanf(par, "%i", &v);
- if (o->min != o->max)
- {
- if (v < o->min && v > o->max)
- {
- printf("Option: %s - value: %d out of range <%d, %d>",
- arg, v, o->min, o->max);
- exit(1);
- }
- }
- if (o->value)
- *(u_int16_t*)o->value = v;
-}
-
-static void read_event(const edg_wll_Args* o, char* arg, char* par)
-{
- edg_wll_EventCode ec = edg_wll_StringToEvent(par);
- if (ec == EDG_WLL_EVENT_UNDEF)
- {
- if (strcmp(par, "help") == 0)
- {
- // list type
- int i;
- printf("Available events: extra options\n");
- for (i = EDG_WLL_EVENT_UNDEF + 1; i < EDG_WLL_EVENT__LAST; i++)
- {
- char* e = edg_wll_EventToString(i);
- if (e)
- {
- int j = 0;
- printf(" %s: ", e);
- while (eventTags[i][j])
- printf("%s ", eventTags[i][j++]);
- fputc('\n', stdout);
-
- free(e);
- }
- }
- }
- else
- fprintf(stderr,"ERROR %s unknown event: %s\n", arg, par);
- exit(1);
- }
- if (o->value)
- *(edg_wll_EventCode*)o->value = ec;
-
-}
-
-static void read_source(const edg_wll_Args* o, char* arg, char* par)
-{
- edg_wll_Source s = edg_wll_StringToSource(par);
- if (s == EDG_WLL_SOURCE_NONE)
- {
- if (strcmp(par, "help") == 0)
- {
- // list type
- int i;
- printf("Valid sources:\n");
- for (i = EDG_WLL_SOURCE_NONE + 1; i < EDG_WLL_SOURCE__LAST; i++)
- {
- char* e = edg_wll_SourceToString(i);
- if (e)
- {
- printf(" %s\n", e);
- free(e);
- }
- }
- }
- else
- fprintf(stderr,"ERROR %s unknown source: %s\n", arg, par);
- exit(1);
- }
- if (o->value)
- *(edg_wll_Source*)o->value = s;
-}
-
-static void show_help(const edg_wll_Args* o, int prefix)
-{
- unsigned max = 0;
- char** l = malloc(sizeof(char*) * 1000);
- int li = 0;
- unsigned i = 0;
-
- for (i = 0; o[i].type != EDG_WLL_ARGS_NONE; i++)
- {
- char b[80];
- unsigned len;
- if (o[i].type == EDG_WLL_ARGS_HELP)
- sprintf(b, " -h --help");
- else
- sprintf(b, " %c%s %s%s",
- (o[i].oshort && prefix) ? '-' : ' ',
- o[i].oshort ? o[i].oshort : " ",
- (o[i].olong && prefix) ? "--" : "",
- o[i].olong ? o[i].olong : ""
- //opt[i].options ? opt[i].options : "",
- //o[i].help ? o[i].help : ""
- );
- l[li] = strdup(b);
- li++;
- len = strlen(b);
- if (max < len)
- max = len;
- }
- for (i = 0; o[i].type != EDG_WLL_ARGS_NONE; i++)
- {
- if (!o[i].oshort && !o[i].olong
- && o[i].type != EDG_WLL_ARGS_HELP
- && o[i].type != EDG_WLL_ARGS_OPTIONS)
- continue;
-
- if (o[i].type != EDG_WLL_ARGS_OPTIONS)
- {
- unsigned s;
- fputs(l[i], stdout);
- for (s = strlen(l[i]); s <= max; s++)
- fputc(' ', stdout);
- if (o[i].type == EDG_WLL_ARGS_HELP)
- fputs("this help message", stdout);
- }
-
- if (o[i].value)
- {
- switch (o[i].type)
- {
- case EDG_WLL_ARGS_INT:
- if (o[i].help)
- printf(o[i].help, *(int*)o[i].value,
- o[i].min, o[i].max);
- break;
- case EDG_WLL_ARGS_STRING:
- case EDG_WLL_ARGS_SELECTSTRING:
- if (o[i].help)
- printf(o[i].help, *(const char**)o[i].value);
- break;
- case EDG_WLL_ARGS_OPTIONS:
- show_help((const edg_wll_Args*)o[i].value, prefix);
- continue;
- default:
- if (o[i].help)
- fputs(o[i].help, stdout);
- break;
- }
- }
- else if (o[i].help)
- fputs(o[i].help, stdout);
-
- fputs("\n", stdout);
- }
- while (--li>=0) free(l[li]);
- free(l);
-}
-#if 0
-static void parse_suboptions(const Option* o, const char* oname, char* pars, const char* r)
-{
- avm::vector<char*> arr;
- split(arr, pars);
-
- if (!arr.size() || strcmp(arr[0], "help") == 0)
- {
- printf("Available options for '%s' (optA=x:optB=...)\n", oname);
- show_help(o, false);
- exit(0);
- }
- for (unsigned i = 0; i < arr.size(); i++)
- {
- char* par = strchr(arr[i], '=');
- if (par)
- {
- *par = 0;
- par++;
- }
-
- for (unsigned j = 0; o[j].type != Args::Option::NONE; j++)
- {
- if ((o[j].oshort && strcmp(o[j].oshort, arr[i]) == 0)
- || (o[j].olong && strcmp(o[j].olong, arr[i]) == 0))
- {
- switch(o[j].type)
- {
- case Args::Option::BOOL:
- read_bool(&o[j], arr[i], par, r);
- break;
- case Args::Option::FLOAT:
- read_float(&o[j], arr[i], par, r);
- break;
- case Args::Option::DOUBLE:
- read_double(&o[j], arr[i], par, r);
- break;
- case Args::Option::INT:
- read_int(&o[j], arr[i], par, r);
- break;
- default:
- ;
- }
- }
- }
- }
-}
-#endif
-
-static int findOpt(opt_ctx_t* ctx, int olong)
-{
- char* arg = ctx->argv[ctx->idx] + olong + 1;
- char* par = strchr(arg, '=');
- const edg_wll_Args* o = NULL;
- const edg_wll_Args* ol[200];
- int olb = 0;
- int ole = 0;
-
- char* argnofile = strdup(arg);
- char* nofile = strstr(argnofile, "-file"); // should be the ending
- if (nofile && (nofile - argnofile) > 2)
- nofile[0] = 0;
-
- olong++;
- if (par)
- {
- *par = 0;
- par++;
- }
- else if ((ctx->idx + 1) < ctx->argc)
- {
- par = ctx->argv[++ctx->idx];
- }
-
- ol[ole++] = ctx->list;
- while (ole > olb)
- {
- o = ol[olb++];
- for (; o->type != EDG_WLL_ARGS_NONE; o++)
- {
- //printf("OPTION %d '%s' %d '%s' '%s'\n", o->type, arg, olong, o->oshort, o->olong);
- if (o->type == EDG_WLL_ARGS_HELP
- && (strcasecmp(arg, "h") == 0
- || strcmp(arg, "?") == 0
- || strcasecmp(arg, "help") == 0))
- break;
- if (o->type == EDG_WLL_ARGS_OPTIONS)
- {
- ol[ole++] = o->value;
- continue;
- }
-
- if (olong < 2)
- {
- if (o->oshort &&
- (strcmp(arg, o->oshort) == 0
- || strcmp(argnofile, o->oshort) == 0))
- break;
- }
- else if (o->olong && (strcmp(arg, o->olong) == 0
- || strcmp(argnofile, o->olong) == 0))
- break;
- }
- if (o->type != EDG_WLL_ARGS_NONE)
- break;
- }
-
- switch (o->type)
- {
- case EDG_WLL_ARGS_NONE:
- return -1;
- case EDG_WLL_ARGS_BOOL:
- if (!read_bool(o, arg, par))
- ctx->idx--; // no argument given
- break;
- case EDG_WLL_ARGS_FLOAT:
- read_float(o, arg, par);
- break;
- case EDG_WLL_ARGS_DOUBLE:
- read_double(o, arg, par);
- break;
- case EDG_WLL_ARGS_STRING:
- read_string(o, arg, par);
- break;
- case EDG_WLL_ARGS_INT:
- read_int(o, arg, par);
- break;
- case EDG_WLL_ARGS_UINT16:
- read_uint16(o, arg, par);
- break;
- case EDG_WLL_ARGS_EVENT:
- read_event(o, arg, par);
- break;
- case EDG_WLL_ARGS_SOURCE:
- read_source(o, arg, par);
- break;
- case EDG_WLL_ARGS_HELP:
- printf("\nUsage: %s %s\n\n", ctx->argv[0], ctx->help);
- show_help(ctx->list, 1);
- exit(0);
- //case EDG_WLL_ARGS_SUBOPTIONS:
- //parse_suboptions((const edg_wll_Args*)o->value, arg, par, regname);
- default:
- printf("FIXME: unhandle option type %d\n", o->type);
- break;
- }
-
- if (argnofile)
- free(argnofile);
-
- return 0;
-}
-
-static void addOptions(opt_ctx_t* ctx, const edg_wll_Args* options)
-{
- const edg_wll_Args* o = options;
-
- while (o->type != EDG_WLL_ARGS_NONE)
- {
- ctx->list[ctx->last++] = *o;
- o++;
- }
-}
-
-void edg_wll_ParseArgs(int* argc, char** argv, const edg_wll_Args* options,
- const char* help)
-{
- int sidx = 1;
- opt_ctx_t ctx;
-
- ctx.argc = *argc;
- ctx.argv = argv;
- ctx.help = help;
- ctx.last = 0;
-
- addOptions(&ctx, options);
-
- for (ctx.idx = 1; ctx.idx < ctx.argc; ctx.idx++)
- {
- if (argv[ctx.idx][0] == '-')
- {
- int olong = (argv[ctx.idx][1] == '-');
- if (olong && argv[ctx.idx][2] == 0)
- break; // end of options
- //printf("ARG %d %s\n", ctx.idx, argv[ctx.idx]);
- if (findOpt(&ctx, olong) == 0)
- continue;
- }
- else if (sidx != ctx.idx)
- {
- fprintf(stderr,"SIDX %d %d\n", sidx, ctx.idx);
- argv[sidx] = argv[ctx.idx];
- }
- sidx++;
- }
-
- while (ctx.idx < *argc && sidx != ctx.idx)
- {
- argv[sidx++] = argv[ctx.idx++];
- }
-
- *argc = sidx;
-}
+++ /dev/null
-#ifndef __EDG_WORKLOAD_LOGGING_CLIENT_ARGS_H__
-
-typedef enum {
- EDG_WLL_ARGS_NONE = 0,
- EDG_WLL_ARGS_BOOL,
- EDG_WLL_ARGS_INT,
- EDG_WLL_ARGS_UINT16,
- EDG_WLL_ARGS_FLOAT,
- EDG_WLL_ARGS_DOUBLE,
- EDG_WLL_ARGS_STRING,
- EDG_WLL_ARGS_HELP,
- EDG_WLL_ARGS_JOBID,
- EDG_WLL_ARGS_NOTIFID,
- EDG_WLL_ARGS_SOURCE,
- EDG_WLL_ARGS_EVENT,
- EDG_WLL_ARGS_OPTIONS,
- EDG_WLL_ARGS_SUBOPTIONS,
- EDG_WLL_ARGS_SELECTSTRING,
-} edg_wll_ArgsCode;
-
-typedef struct {
- edg_wll_ArgsCode type;
- const char* oshort;
- const char* olong;
- const char* help;
- void* value;
- int min;
- int max;
-} edg_wll_Args;
-
-void edg_wll_ParseArgs(int* argc, char** argv, const edg_wll_Args* parray,
- const char* help);
-
-#endif /* __EDG_WORKLOAD_LOGGING_CLIENT_ARGS_H__ */
+++ /dev/null
-#ident "$Header$"
-
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <assert.h>
-
-#include "glite/security/glite_gss.h"
-#include "glite/lb/consumer.h"
-#include "glite/lb/context-int.h"
-#include "glite/lb/mini_http.h"
-#include "glite/lb/connpool.h"
-
-#include "connection.h"
-
-
-int CloseConnection(edg_wll_Context ctx, int* conn_index)
-// XXX: should change the parameter conn_index to int (parameter is IN only)
-{
- /* close connection and free its structures */
- OM_uint32 min_stat;
- int cIndex,ret = 0;
-
- cIndex = *conn_index;
-
- assert(ctx->connections->connOpened);
-
- if (ctx->connections->connPool[cIndex].gss.sock)
- ret = edg_wll_gss_close(&ctx->connections->connPool[cIndex].gss, &ctx->p_tmp_timeout);
- if (ctx->connections->connPool[cIndex].gsiCred != GSS_C_NO_CREDENTIAL)
- gss_release_cred(&min_stat, &ctx->connections->connPool[cIndex].gsiCred);
- free(ctx->connections->connPool[cIndex].peerName);
- free(ctx->connections->connPool[cIndex].buf);
-
- memset(ctx->connections->connPool + cIndex, 0, sizeof(edg_wll_ConnPool));
-
- ctx->connections->connOpened--;
-
-// XXX: not needed *conn_index = cIndex;
-
- return ret;
-}
-
-
-
-int ConnectionIndex(edg_wll_Context ctx, const char *name, int port)
-{
- int i;
-
- for (i=0; i<ctx->connections->poolSize;i++) {
- if ((ctx->connections->connPool[i].peerName != NULL) &&
- !strcmp(name, ctx->connections->connPool[i].peerName) &&
- (port == ctx->connections->connPool[i].peerPort)) {
-
- /* TryLock (next line) is in fact used only
- to check the mutex status */
- switch (edg_wll_connectionTryLock(ctx, i)) {
- case 0:
- /* Connection was not locked but now it is. Since we do not
- really know wheter we are interested in that connection, we
- are simply unlocking it now. */
- edg_wll_connectionUnlock(ctx, i);
- return i;
-
- case EBUSY:
- /* Connection locked. Do not consider it */
- // try to find another free connection
- break;
- default:
- /* Some obscure error occured. Need inspection */
- perror("ConnectionIndex() - locking problem \n");
- assert(0);
- }
- }
- }
-
- return -1;
-}
-
-
-
-int AddConnection(edg_wll_Context ctx, char *name, int port)
-{
- int i,index = -1;
-
- for (i = 0; i < ctx->connections->poolSize; i++) {
- if (ctx->connections->connPool[i].peerName == NULL) {
- if (!edg_wll_connectionTryLock(ctx, i)) {
- index = i; // This connection is free and was not locked. We may lock it and use it.
- break;
- }
- }
- }
-
- if (index < 0) return -1;
-
- free(ctx->connections->connPool[index].peerName); // should be empty; just to be sure
- ctx->connections->connPool[index].peerName = strdup(name);
- ctx->connections->connPool[index].peerPort = port;
- ctx->connections->connPool[index].gsiCred = GSS_C_NO_CREDENTIAL; // initial value
- ctx->connections->connOpened++;
-
- return index;
-}
-
-
-
-int ReleaseConnection(edg_wll_Context ctx, char *name, int port)
-{
- int i, index = 0, foundConnToDrop = 0;
- long min;
-
-
- edg_wll_ResetError(ctx);
- if (ctx->connections->connOpened == 0) return 0; /* nothing to release */
-
- if (name) {
- if ((index = ConnectionIndex(ctx, name, port)) >= 0)
- CloseConnection(ctx, &index);
- }
- else { /* free the oldest (unlocked) connection */
- for (i=0; i<ctx->connections->poolSize; i++) {
- assert(ctx->connections->connPool[i].peerName); // Full pool expected - accept non-NULL values only
- if (!edg_wll_connectionTryLock(ctx, i)) {
- edg_wll_connectionUnlock(ctx, i); // Connection unlocked. Consider releasing it
- if (foundConnToDrop) { // This is not the first unlocked connection
- if (ctx->connections->connPool[i].lastUsed.tv_sec < min) {
- min = ctx->connections->connPool[i].lastUsed.tv_sec;
- index = i;
- foundConnToDrop++;
- }
- }
- else { // This is the first unlocked connection we have found.
- foundConnToDrop++;
- index = i;
- min = ctx->connections->connPool[i].lastUsed.tv_sec;
- }
- }
- }
- if (!foundConnToDrop) return edg_wll_SetError(ctx,EAGAIN,"all connections in the connection pool are locked");
- CloseConnection(ctx, &index);
- }
- return edg_wll_Error(ctx,NULL,NULL);
-}
-
-
-
-int edg_wll_close(edg_wll_Context ctx, int* connToUse)
-{
- edg_wll_ResetError(ctx);
- if (*connToUse == -1) return 0;
-
- CloseConnection(ctx, connToUse);
-
- edg_wll_connectionUnlock(ctx, *connToUse); /* Forgetting the conn. Unlocking is safe. */
-
- *connToUse = -1;
- return edg_wll_Error(ctx,NULL,NULL);
-}
-
-
-
-int edg_wll_close_proxy(edg_wll_Context ctx)
-{
- edg_wll_plain_close(&ctx->connProxy->conn);
-
- return edg_wll_ResetError(ctx);
-}
-
-
-
-int edg_wll_open(edg_wll_Context ctx, int* connToUse)
-{
- int index;
- edg_wll_GssStatus gss_stat;
-
-
- edg_wll_ResetError(ctx);
-
- edg_wll_poolLock(); /* We are going to search the pool, it has better be locked */
-
- if ( (index = ConnectionIndex(ctx, ctx->srvName, ctx->srvPort)) == -1 ) {
- /* no such open connection in pool */
- if (ctx->connections->connOpened == ctx->connections->poolSize)
- if(ReleaseConnection(ctx, NULL, 0)) goto end;
-
- index = AddConnection(ctx, ctx->srvName, ctx->srvPort);
- if (index < 0) {
- edg_wll_SetError(ctx,EAGAIN,"connection pool size exceeded");
- goto end;
- }
-
- #ifdef EDG_WLL_CONNPOOL_DEBUG
- printf("Connection to %s:%d opened as No. %d in the pool\n",ctx->srvName,ctx->srvPort,index);
- #endif
-
- }
- /* else - there is cached open connection, reuse it */
- #ifdef EDG_WLL_CONNPOOL_DEBUG
- else printf("Connection to %s:%d exists (No. %d in the pool) - reusing\n",ctx->srvName,ctx->srvPort,index);
- #endif
-
- *connToUse = index;
-
- /* XXX support anonymous connections, perhaps add a flag to the connPool
- * struct specifying whether or not this connection shall be authenticated
- * to prevent from repeated calls to edg_wll_gss_acquire_cred_gsi() */
- if (!ctx->connections->connPool[index].gsiCred &&
- edg_wll_gss_acquire_cred_gsi(
- ctx->p_proxy_filename ? ctx->p_proxy_filename : ctx->p_cert_filename,
- ctx->p_proxy_filename ? ctx->p_proxy_filename : ctx->p_key_filename,
- &ctx->connections->connPool[index].gsiCred, NULL, &gss_stat)) {
- edg_wll_SetErrorGss(ctx, "failed to load GSI credentials", &gss_stat);
- goto err;
- }
-
- if (ctx->connections->connPool[index].gss.context == GSS_C_NO_CONTEXT) {
- switch (edg_wll_gss_connect(ctx->connections->connPool[index].gsiCred,
- ctx->connections->connPool[index].peerName, ctx->connections->connPool[index].peerPort,
- &ctx->p_tmp_timeout,&ctx->connections->connPool[index].gss,
- &gss_stat)) {
-
- case EDG_WLL_GSS_OK:
- goto ok;
- case EDG_WLL_GSS_ERROR_ERRNO:
- edg_wll_SetError(ctx,errno,"edg_wll_gss_connect()");
- break;
- case EDG_WLL_GSS_ERROR_GSS:
- edg_wll_SetErrorGss(ctx, "failed to authenticate to server", &gss_stat);
- break;
- case EDG_WLL_GSS_ERROR_HERRNO:
- { const char *msg1;
- char *msg2;
- msg1 = hstrerror(errno);
- asprintf(&msg2, "edg_wll_gss_connect(): %s", msg1);
- edg_wll_SetError(ctx,EDG_WLL_ERROR_DNS, msg2);
- free(msg2);
- }
- break;
- case EDG_WLL_GSS_ERROR_EOF:
- edg_wll_SetError(ctx,ECONNREFUSED,"edg_wll_gss_connect():"
- " server closed the connection, probably due to overload");
- break;
- case EDG_WLL_GSS_ERROR_TIMEOUT:
- edg_wll_SetError(ctx,ETIMEDOUT,"edg_wll_gss_connect()");
- break;
- }
- }
- else goto ok;
-
-err:
- /* some error occured; close created connection
- * and free all fields in connPool[index] */
- if (index >= 0) CloseConnection(ctx, &index);
- *connToUse = -1;
-ok:
-
- if (*connToUse>-1) edg_wll_connectionTryLock(ctx, *connToUse); /* Just to be sure we have not forgotten to lock it */
-
-end:
-
- edg_wll_poolUnlock(); /* One way or the other, there are no more pool-wide operations */
-
-// xxxxx
-
- return edg_wll_Error(ctx,NULL,NULL);
-}
-
-
-
-int edg_wll_open_proxy(edg_wll_Context ctx)
-{
- struct sockaddr_un saddr;
- int flags;
- int err;
- char *ed = NULL;
- int retries = 0;
-
- edg_wll_ResetError(ctx);
-
- edg_wll_ResetError(ctx);
-
- if (ctx->connProxy->conn.sock > -1) {
- // XXX: test path socket here?
- return edg_wll_ResetError(ctx);
- }
- ctx->connProxy->conn.sock = socket(PF_UNIX, SOCK_STREAM, 0);
- if (ctx->connProxy->conn.sock < 0) {
- edg_wll_SetError(ctx, errno, "socket() error");
- goto err;
- }
-
- memset(&saddr, 0, sizeof(saddr));
- saddr.sun_family = AF_UNIX;
- if (!ctx->p_lbproxy_serve_sock) {
- edg_wll_SetError(ctx, EINVAL, "Proxy socket path not set!");
- goto err;
- }
-
- if (strlen(ctx->p_lbproxy_serve_sock) > 108) { // UNIX_PATH_MAX (def. in linux/un.h)
- // but not defined in sys/un.h
- edg_wll_SetError(ctx, EINVAL, "proxy_filename too long!");
- goto err;
- }
- strcpy(saddr.sun_path, ctx->p_lbproxy_serve_sock);
-
- if ((flags = fcntl(ctx->connProxy->conn.sock, F_GETFL, 0)) < 0 ||
- fcntl(ctx->connProxy->conn.sock, F_SETFL, flags | O_NONBLOCK) < 0) {
- edg_wll_SetError(ctx, errno, "fcntl()");
- goto err;
- }
-
- while ((err = connect(ctx->connProxy->conn.sock, (struct sockaddr *)&saddr, sizeof(saddr))) < 0 &&
- errno == EAGAIN &&
- ctx->p_tmp_timeout.tv_sec >= 0 && ctx->p_tmp_timeout.tv_usec >= 0 &&
- !(ctx->p_tmp_timeout.tv_sec == 0 && ctx->p_tmp_timeout.tv_usec == 0)
- )
- {
- struct timespec ns = { 0, PROXY_CONNECT_RETRY * 1000000 /* 10 ms */ },rem;
-
- nanosleep(&ns,&rem);
-
- ctx->p_tmp_timeout.tv_usec -= ns.tv_nsec/1000;
- ctx->p_tmp_timeout.tv_usec += rem.tv_nsec/1000;
-
- ctx->p_tmp_timeout.tv_sec -= ns.tv_sec;
- ctx->p_tmp_timeout.tv_sec += rem.tv_sec;
-
- if (ctx->p_tmp_timeout.tv_usec < 0) {
- ctx->p_tmp_timeout.tv_usec += 1000000;
- ctx->p_tmp_timeout.tv_sec--;
- }
- retries++;
- }
-
- /* printf("retries %d\n",retries); */
-
- if (err) {
- if (errno == EAGAIN) edg_wll_SetError(ctx,ETIMEDOUT, "edg_wll_open_proxy()");
- else edg_wll_SetError(ctx, errno, "connect()");
- goto err;
- }
-
- return 0;
-
-err:
- /* some error occured; close created connection */
-
- err = edg_wll_Error(ctx,NULL,&ed);
- edg_wll_close_proxy(ctx);
- edg_wll_SetError(ctx,err,ed);
- free(ed);
-
- return err;
-}
-
-
-
-/* transform HTTP error code to ours */
-int http_check_status(
- edg_wll_Context ctx,
- char *response)
-
-{
- int code = HTTP_INTERNAL,len = 0;
-
- edg_wll_ResetError(ctx);
- sscanf(response,"HTTP/%*f %n%d",&len,&code);
- switch (code) {
- case HTTP_OK:
- break;
- /* soft errors - some useful data may be returned too */
- case HTTP_UNAUTH: /* EPERM */
- case HTTP_NOTFOUND: /* ENOENT */
- case HTTP_NOTIMPL: /* ENOSYS */
- case HTTP_UNAVAIL: /* EAGAIN */
- case HTTP_INVALID: /* EINVAL */
- break;
- case EDG_WLL_GSS_ERROR_HERRNO:
- { const char *msg1;
- char *msg2;
- msg1 = hstrerror(errno);
- asprintf(&msg2, "edg_wll_gss_connect(): %s", msg1);
- edg_wll_SetError(ctx,EDG_WLL_ERROR_DNS, msg2);
- free(msg2);
- }
- break;
- case HTTP_NOTALLOWED:
- edg_wll_SetError(ctx, ENXIO, "Method Not Allowed");
- break;
- case HTTP_UNSUPPORTED:
- edg_wll_SetError(ctx, ENOTSUP, "Protocol versions incompatible");
- break;
- case HTTP_INTERNAL:
- /* fall through */
- default:
- edg_wll_SetError(ctx,EDG_WLL_ERROR_SERVER_RESPONSE,response+len);
- }
- return edg_wll_Error(ctx,NULL,NULL);
-}
-
-
-
-int edg_wll_http_send_recv(
- edg_wll_Context ctx,
- char *request,
- const char * const *req_head,
- char *req_body,
- char **response,
- char ***resp_head,
- char **resp_body)
-{
- int ec;
- char *ed = NULL;
- int connToUse = -1; //Index of the connection to use. Used to be a context member.
-
- if (edg_wll_open(ctx,&connToUse)) return edg_wll_Error(ctx,NULL,NULL);
-
- switch (edg_wll_http_send(ctx,request,req_head,req_body,&ctx->connections->connPool[connToUse])) {
- case ENOTCONN:
- edg_wll_close(ctx,&connToUse);
- if (edg_wll_open(ctx,&connToUse)
- || edg_wll_http_send(ctx,request,req_head,req_body,&ctx->connections->connPool[connToUse]))
- goto err;
- /* fallthrough */
- case 0: break;
- default: goto err;
- }
-
- switch (edg_wll_http_recv(ctx,response,resp_head,resp_body,&ctx->connections->connPool[connToUse])) {
- case ENOTCONN:
- edg_wll_close(ctx,&connToUse);
- if (edg_wll_open(ctx,&connToUse)
- || edg_wll_http_send(ctx,request,req_head,req_body,&ctx->connections->connPool[connToUse])
- || edg_wll_http_recv(ctx,response,resp_head,resp_body,&ctx->connections->connPool[connToUse]))
- goto err;
- /* fallthrough */
- case 0: break;
- default: goto err;
- }
-
- assert(connToUse >= 0);
- gettimeofday(&ctx->connections->connPool[connToUse].lastUsed, NULL);
-
- edg_wll_connectionUnlock(ctx, connToUse);
-
- return 0;
-
-err:
- ec = edg_wll_Error(ctx,NULL,&ed);
- edg_wll_close(ctx,&connToUse);
- edg_wll_SetError(ctx,ec,ed);
- free(ed);
- return ec;
-}
-
-
-
-int edg_wll_http_send_recv_proxy(
- edg_wll_Context ctx,
- char *request,
- const char * const *req_head,
- char *req_body,
- char **response,
- char ***resp_head,
- char **resp_body)
-{
- if (edg_wll_open_proxy(ctx)) return edg_wll_Error(ctx,NULL,NULL);
-
- switch (edg_wll_http_send_proxy(ctx,request,req_head,req_body)) {
- case ENOTCONN:
- edg_wll_close_proxy(ctx);
- if (edg_wll_open_proxy(ctx)
- || edg_wll_http_send_proxy(ctx,request,req_head,req_body))
- return edg_wll_Error(ctx,NULL,NULL);
- /* fallthrough */
- case 0: break;
- default: return edg_wll_Error(ctx,NULL,NULL);
- }
-
- if (edg_wll_http_recv_proxy(ctx,response,resp_head,resp_body) == ENOTCONN) {
- edg_wll_close_proxy(ctx);
- (void) (edg_wll_open_proxy(ctx)
- || edg_wll_http_send_proxy(ctx,request,req_head,req_body)
- || edg_wll_http_recv_proxy(ctx,response,resp_head,resp_body));
- }
-
- return edg_wll_Error(ctx,NULL,NULL);
-}
+++ /dev/null
-#ifndef __EDG_WORKLOAD_LOGGING_CLIENT_CONNECTION_H__
-#define __EDG_WORKLOAD_LOGGING_CLIENT_CONNECTION_H__
-
-#ident "$Header$"
-
-int edg_wll_close(edg_wll_Context ctx,int *);
-int edg_wll_open(edg_wll_Context ctx,int *);
-int edg_wll_http_send_recv(edg_wll_Context, char *, const char * const *, char *, char **, char ***, char **);
-
-int edg_wll_close_proxy(edg_wll_Context ctx);
-int edg_wll_open_proxy(edg_wll_Context ctx);
-int edg_wll_http_send_recv_proxy(edg_wll_Context, char *, const char * const *, char *, char **, char ***, char **);
-
-int http_check_status(edg_wll_Context, char *);
-
-int ConnectionIndex(edg_wll_Context ctx, const char *name, int port);
-int AddConnection(edg_wll_Context ctx, char *name, int port);
-int ReleaseConnection(edg_wll_Context ctx, char *name, int port);
-int CloseConnection(edg_wll_Context ctx, int* conn_index);
-
-#define PROXY_CONNECT_RETRY 10 /* ms */
-
-
-#endif /* __EDG_WORKLOAD_LOGGING_CLIENT_CONNECTION_H__ */
+++ /dev/null
-#ident "$Header$"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <assert.h>
-
-#include <expat.h>
-
-#include "globus_config.h"
-
-#include "glite/lb/consumer.h"
-#include "glite/lb/context-int.h"
-#include "glite/lb/mini_http.h"
-#include "glite/lb/xml_parse.h"
-#include "glite/lb/xml_conversions.h"
-
-#include "connection.h"
-
-static const char* const request_headers[] = {
- "Cache-Control: no-cache",
- "Accept: application/x-dglb",
- "User-Agent: edg_wll_Api/" PROTO_VERSION "/" COMP_PROTO,
- "Content-Type: application/x-dglb",
- NULL
-};
-
-int set_server_name_and_port(edg_wll_Context, const edg_wll_QueryRec **);
-
-int edg_wll_QueryEventsExt(
- edg_wll_Context ctx,
- const edg_wll_QueryRec **job_conditions,
- const edg_wll_QueryRec **event_conditions,
- edg_wll_Event **eventsOut)
-{
- char *response = NULL,
- *message = NULL,
- *send_mess = NULL;
-
- edg_wll_ResetError(ctx);
-
- if ( edg_wll_QueryEventsRequestToXML(ctx, job_conditions, event_conditions, &send_mess) != 0 )
- {
- edg_wll_SetError(ctx , (edg_wll_ErrorCode) EINVAL, "Invalid query record.");
- goto err;
- }
-
- ctx->p_tmp_timeout = ctx->p_query_timeout;
-
- if (ctx->isProxy) {
- ctx->isProxy = 0;
- if (edg_wll_http_send_recv_proxy(ctx, "POST /queryEvents HTTP/1.1",
- request_headers,send_mess, &response,NULL,&message))
- goto err;
- }
- else {
- if (set_server_name_and_port(ctx,job_conditions))
- goto err; // XXX is it fatal??
-
- if (edg_wll_http_send_recv(ctx, "POST /queryEvents HTTP/1.1",
- request_headers,send_mess, &response,NULL,&message))
- goto err;
- }
-
- if (http_check_status(ctx,response))
- goto err;
-
- edg_wll_ParseQueryEvents(ctx,message,eventsOut);
-
-err:
- free(response);
- free(message);
- free(send_mess);
- return edg_wll_Error(ctx,NULL,NULL);
-}
-
-int edg_wll_QueryEvents(
- edg_wll_Context ctx,
- const edg_wll_QueryRec *job_conditions,
- const edg_wll_QueryRec *event_conditions,
- edg_wll_Event **eventsOut)
-{
- edg_wll_QueryRec **jconds = NULL,
- **econds = NULL;
- int i,
- njconds, neconds,
- ret;
-
- if ( job_conditions )
- {
- for ( njconds = 0; job_conditions[njconds].attr != EDG_WLL_QUERY_ATTR_UNDEF ; njconds++ )
- ;
- jconds = (edg_wll_QueryRec **) calloc(njconds+1, sizeof(edg_wll_QueryRec *));
- for ( i = 0; i < njconds; i++ )
- {
- jconds[i] = (edg_wll_QueryRec *) calloc(2, sizeof(edg_wll_QueryRec));
- jconds[i][0] = job_conditions[i];
- }
- }
-
- if ( event_conditions )
- {
- for ( neconds = 0; event_conditions[neconds].attr != EDG_WLL_QUERY_ATTR_UNDEF ; neconds++ )
- ;
- econds = (edg_wll_QueryRec **) calloc(neconds+1, sizeof(edg_wll_QueryRec *));
- for ( i = 0; i < neconds; i++ )
- {
- econds[i] = (edg_wll_QueryRec *) calloc(2, sizeof(edg_wll_QueryRec));
- econds[i][0] = event_conditions[i];
- }
- }
-
- if ( econds && jconds )
- ret = edg_wll_QueryEventsExt(ctx, (const edg_wll_QueryRec **) jconds,
- (const edg_wll_QueryRec **) econds, eventsOut);
- if ( econds && !jconds )
- ret = edg_wll_QueryEventsExt(ctx, NULL, (const edg_wll_QueryRec **) econds, eventsOut);
- if ( !econds && jconds )
- ret = edg_wll_QueryEventsExt(ctx, (const edg_wll_QueryRec **) jconds, NULL, eventsOut);
- if ( !econds && !jconds )
- ret = edg_wll_QueryEventsExt(ctx, NULL, NULL, eventsOut);
-
- if ( jconds )
- {
- for ( i = 0; i < njconds ; i++ )
- free(jconds[i]);
- free(jconds);
- }
- if ( econds )
- {
- for ( i = 0; i < neconds ; i++ )
- free(econds[i]);
- free(econds);
- }
-
- return ret;
-}
-
-
-int edg_wll_QueryJobsExt(
- edg_wll_Context ctx,
- const edg_wll_QueryRec ** conditions,
- int flags,
- edg_wlc_JobId ** jobsOut,
- edg_wll_JobStat ** statesOut)
-{
- char *response = NULL, *message = NULL, *send_mess = NULL;
-
- edg_wll_ResetError(ctx);
-
- if (!jobsOut) flags |= EDG_WLL_STAT_NO_JOBS;
- if (!statesOut) {flags = 0; flags |= EDG_WLL_STAT_NO_STATES;}
- if (edg_wll_QueryJobsRequestToXML(ctx, conditions, flags, &send_mess) != 0) {
- edg_wll_SetError(ctx , (edg_wll_ErrorCode) EINVAL, "Invalid query record.");
- goto err;
- }
-
- ctx->p_tmp_timeout = ctx->p_query_timeout;
-
- if (ctx->isProxy){
- ctx->isProxy = 0;
- if (edg_wll_http_send_recv_proxy(ctx, "POST /queryJobs HTTP/1.1",
- request_headers,send_mess,&response,NULL,&message))
- goto err;
- }
- else {
- if (set_server_name_and_port(ctx, conditions))
- goto err;
-
- if (edg_wll_http_send_recv(ctx, "POST /queryJobs HTTP/1.1",
- request_headers,send_mess,&response,NULL,&message))
- goto err;
- }
-
- if (http_check_status(ctx,response))
- goto err;
-
- edg_wll_ParseQueryJobs(ctx,message,jobsOut,statesOut);
-
-err:
- free(response);
- free(message);
- free(send_mess);
-
- return edg_wll_Error(ctx,NULL,NULL);
-}
-
-int edg_wll_QueryJobs(
- edg_wll_Context ctx,
- const edg_wll_QueryRec * conditions,
- int flags,
- edg_wlc_JobId ** jobsOut,
- edg_wll_JobStat ** statesOut)
-{
- edg_wll_QueryRec **conds;
- int i, nconds, ret;
-
- if ( !conditions )
- return edg_wll_QueryJobsExt(ctx, NULL, flags, jobsOut, statesOut);
-
- for ( nconds = 0; conditions[nconds].attr != EDG_WLL_QUERY_ATTR_UNDEF ; nconds++ )
- ;
- conds = (edg_wll_QueryRec **) malloc((nconds+1) * sizeof(edg_wll_QueryRec *));
- conds[nconds] = NULL;
- for ( i = 0; i < nconds ; i++ )
- {
- conds[i] = (edg_wll_QueryRec *) malloc(2 * sizeof(edg_wll_QueryRec));
- conds[i][0] = conditions[i];
- conds[i][1].attr = EDG_WLL_QUERY_ATTR_UNDEF;
- }
-
- ret = edg_wll_QueryJobsExt(ctx, (const edg_wll_QueryRec **) conds, flags, jobsOut, statesOut);
-
- for ( i = 0; i < nconds ; i++ )
- free(conds[i]);
- free(conds);
-
-
- return ret;
-}
-
-
-
-int edg_wll_GetIndexedAttrs(
- edg_wll_Context ctx,
- edg_wll_QueryRec ***attrs)
-{
- char *response = NULL, *send_mess = NULL, *message = NULL;
-
- edg_wll_ResetError(ctx);
-
- edg_wll_IndexedAttrsRequestToXML(ctx, &send_mess);
-
- if (set_server_name_and_port(ctx, NULL))
- goto err;
-
- ctx->p_tmp_timeout = ctx->p_query_timeout;
-
- if (edg_wll_http_send_recv(ctx, "POST /indexedAttrs HTTP/1.1",request_headers, send_mess,
- &response,NULL,&message))
- goto err;
-
- if (http_check_status(ctx,response))
- goto err;
-
- edg_wll_ParseIndexedAttrs(ctx,message,attrs);
-
-err:
- free(response);
- free(message);
-
- return edg_wll_Error(ctx,NULL,NULL);
-}
-
-
-/*
- * wrappers around edg_wll_Query()
- */
-
-int edg_wll_UserJobs(
- edg_wll_Context ctx,
- edg_wlc_JobId **jobsOut,
- edg_wll_JobStat **statesOut)
-{
- edg_wll_QueryRec j[2];
-
- memset(j,0,sizeof j);
-
- j[0].attr = EDG_WLL_QUERY_ATTR_OWNER;
- j[0].op = EDG_WLL_QUERY_OP_EQUAL;
- j[0].value.c = ctx->peerName;
-
- return edg_wll_QueryJobs(ctx,j,0,jobsOut,statesOut);
-}
-
-int edg_wll_JobLog(
- edg_wll_Context ctx,
- edg_wlc_JobId job,
- edg_wll_Event **eventsOut)
-{
- edg_wll_QueryRec j[2], e[2];
-
- memset(j,0,sizeof j);
- memset(e,0,sizeof e);
-
- j[0].attr = EDG_WLL_QUERY_ATTR_JOBID;
- j[0].op = EDG_WLL_QUERY_OP_EQUAL;
- j[0].value.j = job;
-
- e[0].attr = EDG_WLL_QUERY_ATTR_LEVEL;
- e[0].op = EDG_WLL_QUERY_OP_LESS;
- e[0].value.i = ctx->p_level + 1;
-
- return edg_wll_QueryEvents(ctx,j,e,eventsOut);
-}
-
-int edg_wll_JobStatus(
- edg_wll_Context ctx,
- edg_wlc_JobId job,
- int flags,
- edg_wll_JobStat *stat)
-{
- edg_wll_QueryRec j[2];
- edg_wll_JobStat *statesOut = NULL;
- int ret;
-
- memset(j,0,sizeof j);
-
- j[0].attr = EDG_WLL_QUERY_ATTR_JOBID;
- j[0].op = EDG_WLL_QUERY_OP_EQUAL;
- j[0].value.j = job;
- j[1].attr = EDG_WLL_QUERY_ATTR_UNDEF;
-
- ret = edg_wll_QueryJobs(ctx,j,flags,NULL,&statesOut);
-
- if (ret) return ret;
-
- if (statesOut) {
- if (statesOut[0].state == EDG_WLL_JOB_UNDEF) {
- memcpy(stat, statesOut, sizeof(edg_wll_JobStat));
- free(statesOut);
- ret = edg_wll_SetError(ctx , (edg_wll_ErrorCode) ENOENT, "Query returned no result.");
- }
- else {
- /* check wheter there is only one field in status reply */
- assert(statesOut[1].state == EDG_WLL_JOB_UNDEF);
- /* copy only 1st status */
- memcpy(stat, statesOut, sizeof(edg_wll_JobStat));
- /* release only array of states, keep all links unfreed for the previous copy */
- free(statesOut);
- }
- }
-
- return ret;
-}
-
-
-
-int edg_wll_QueryListener(edg_wll_Context ctx, edg_wlc_JobId job, const char *name, char** host, uint16_t *port) {
-
- int i;
- edg_wll_Event *events = NULL;
- int errCode = 0;
- edg_wll_QueryRec jr[2],er[2];
- int found = 0;
-
- memset(jr,0,sizeof jr);
- memset(er,0,sizeof er);
- jr[0].attr = EDG_WLL_QUERY_ATTR_JOBID;
- jr[0].op = EDG_WLL_QUERY_OP_EQUAL;
- jr[0].value.j = job;
-
- er[0].attr = EDG_WLL_QUERY_ATTR_EVENT_TYPE;
- er[0].op = EDG_WLL_QUERY_OP_EQUAL;
- er[0].value.i = EDG_WLL_EVENT_LISTENER;
-
- if (edg_wll_QueryEvents(ctx, jr, er, &events)) {
- return edg_wll_Error(ctx, NULL, NULL);
- }
-
- for (i=0; events[i].type != EDG_WLL_EVENT_UNDEF; i++) {
- if (!strcmp(name, events[i].listener.svc_name)) {
- found = 1;
- if (host != NULL)
- *host = strdup(events[i].listener.svc_host);
- if (port != NULL)
- *port = events[i].listener.svc_port;
- }
- edg_wll_FreeEvent(&events[i]);
- }
- free(events);
-
- if (!found)
- errCode = ENOENT;
-
- return edg_wll_SetError(ctx, errCode, NULL);
-}
-
-
-int set_server_name_and_port(edg_wll_Context ctx, const edg_wll_QueryRec **job_conditions)
-{
- int i = 0, j,
- found = 0,
- error = 0;
- int srvPort = 0,
- srvPortTmp;
- char *srvName = NULL,
- *srvNameTmp;
-
-
- if ( job_conditions ) for ( j = 0; job_conditions[j]; j++ )
- for ( i = 0; (job_conditions[j][i].attr != EDG_WLL_QUERY_ATTR_UNDEF); i++ )
- if ( job_conditions[j][i].attr == EDG_WLL_QUERY_ATTR_JOBID)
- {
- edg_wlc_JobIdGetServerParts(job_conditions[j][i].value.j,&srvNameTmp,&srvPortTmp);
- if ( found )
- {
- if ( strcmp(srvName, srvNameTmp) || (srvPort != srvPortTmp) )
- {
- free(srvNameTmp); free(srvName);
- return edg_wll_SetError(ctx, EINVAL, "Two different servers specifieed in one query");
- }
- free(srvNameTmp);
- }
- else
- {
- srvName = srvNameTmp;
- srvPort = srvPortTmp;
- found = 1;
- }
- }
-
- if ( found && !ctx->p_query_server_override)
- {
- if (!ctx->srvName)
- {
- ctx->srvName = strdup(srvName);
- ctx->srvPort = srvPort;
- free(srvName);
- }
- else if (strcmp(srvName, ctx->srvName) || (srvPort != ctx->srvPort))
- {
- free(ctx->srvName);
- ctx->srvName = strdup(srvName);
- ctx->srvPort = srvPort;
- free(srvName);
- }
- }
- else if ( !ctx->srvName || !ctx->srvPort )
- {
- if (!ctx->p_query_server)
- return(edg_wll_SetError(ctx, (edg_wll_ErrorCode) EINVAL, "Hostname of server to query is not set"));
- else ctx->srvName = strdup(ctx->p_query_server);
- if (!ctx->p_query_server_port)
- return(edg_wll_SetError(ctx, (edg_wll_ErrorCode) EINVAL, "Port of server to query is not set"));
- else ctx->srvPort = ctx->p_query_server_port;
- }
-
- return(error);
-}
-
-int edg_wll_QuerySequenceCodeProxy(edg_wll_Context ctx, edg_wlc_JobId jobId, char **code)
-{
- int error = 0;
- char *response = NULL,
- *message = NULL,
- *send_mess = NULL;
-
-
- ctx->isProxy = 1;
- edg_wll_ResetError(ctx);
-
- if ( edg_wll_QuerySequenceCodeToXML(ctx, jobId, &send_mess) != 0 )
- {
- edg_wll_SetError(ctx , (edg_wll_ErrorCode) EINVAL, "Invalid query record.");
- goto err;
- }
-
- ctx->p_tmp_timeout = ctx->p_query_timeout;
-
- error = edg_wll_http_send_recv_proxy(ctx, "POST /querySequenceCode HTTP/1.1",
- request_headers, send_mess, &response, NULL, &message);
- if ( error != 0 )
- goto err;
-
- if (http_check_status(ctx,response))
- goto err;
-
- edg_wll_ParseQuerySequenceCodeResult(ctx,message,code);
-
-err:
- free(response);
- free(message);
- free(send_mess);
-
- return edg_wll_Error(ctx,NULL,NULL);
-}
-
-
-/******************************************************************
- * Proxy wrappers
- */
-
-
-int edg_wll_QueryEventsExtProxy(
- edg_wll_Context ctx,
- const edg_wll_QueryRec **job_conditions,
- const edg_wll_QueryRec **event_conditions,
- edg_wll_Event **eventsOut)
-{
- ctx->isProxy = 1;
-
- return edg_wll_QueryEventsExt(ctx, job_conditions, event_conditions, eventsOut);
-}
-
-
-
-int edg_wll_QueryEventsProxy(
- edg_wll_Context ctx,
- const edg_wll_QueryRec *job_conditions,
- const edg_wll_QueryRec *event_conditions,
- edg_wll_Event **eventsOut)
-{
- ctx->isProxy = 1;
-
- return edg_wll_QueryEvents(ctx, job_conditions, event_conditions, eventsOut);
-}
-
-
-
-int edg_wll_QueryJobsExtProxy(
- edg_wll_Context ctx,
- const edg_wll_QueryRec ** conditions,
- int flags,
- edg_wlc_JobId ** jobsOut,
- edg_wll_JobStat ** statesOut)
-{
- ctx->isProxy = 1;
-
- return edg_wll_QueryJobsExt(ctx, conditions, flags, jobsOut, statesOut);
-}
-
-
-
-int edg_wll_QueryJobsProxy(
- edg_wll_Context ctx,
- const edg_wll_QueryRec * conditions,
- int flags,
- edg_wlc_JobId ** jobsOut,
- edg_wll_JobStat ** statesOut)
-{
- ctx->isProxy = 1;
-
- return edg_wll_QueryJobs(ctx, conditions, flags, jobsOut, statesOut);
-}
-
-
-int edg_wll_UserJobsProxy(
- edg_wll_Context ctx,
- edg_wlc_JobId **jobsOut,
- edg_wll_JobStat **statesOut)
-{
- ctx->isProxy = 1;
- if ( ctx->p_user_lbproxy ) ctx->peerName = strdup(ctx->p_user_lbproxy);
-
- return edg_wll_UserJobs(ctx, jobsOut, statesOut);
-}
-
-int edg_wll_JobLogProxy(
- edg_wll_Context ctx,
- edg_wlc_JobId job,
- edg_wll_Event **eventsOut)
-{
- ctx->isProxy = 1;
-
- return edg_wll_JobLog(ctx, job, eventsOut);
-}
-
-int edg_wll_JobStatusProxy(
- edg_wll_Context ctx,
- edg_wlc_JobId job,
- int flags,
- edg_wll_JobStat *stat)
-{
- ctx->isProxy = 1;
-
- return edg_wll_JobStatus(ctx, job, flags, stat);
-}
-
-
-
-int edg_wll_QueryListenerProxy(
- edg_wll_Context ctx,
- edg_wlc_JobId job,
- const char *name,
- char** host,
- uint16_t *port)
-{
- ctx->isProxy = 1;
-
- return edg_wll_QueryListener(ctx, job, name, host, port);
-}
+++ /dev/null
-#ident "$Header$"
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <getopt.h>
-#include <string.h>
-#include <time.h>
-#include <errno.h>
-
-#include <globus_common.h>
-
-#define CLIENT_SBIN_PROG
-
-#include "glite/lb/consumer.h"
-#include "glite/lb/context-int.h"
-#include "glite/lb/dump.h"
-#include "glite/lb/ulm_parse.h"
-#include "glite/lb/xml_parse.h"
-#include "glite/lb/mini_http.h"
-
-
-#define dprintf(x) { if (debug) printf x; }
-
-static const char rcsid[] = "@(#)$Id$";
-
-static int debug=0;
-
-static void printerr(edg_wll_Context ctx);
-
-static struct option opts[] = {
- { "from", required_argument, NULL, 'f'},
- { "to", required_argument, NULL, 't'},
- { "help", no_argument, NULL, 'h' },
- { "version", no_argument, NULL, 'v' },
- { "debug", no_argument, NULL, 'd' },
- { "server", required_argument, NULL, 'm' },
- { NULL, no_argument, NULL, 0 }
-};
-
-static void usage(char *me)
-{
- fprintf(stderr,"usage: %s [option]\n"
- " -f, --from YYYYMMDDHHmmss beginning of the time interval for events to be dumped\n"
- " -t, --to YYYYMMDDHHmmss end of the time interval for events to be dumped\n"
- " -h, --help display this help\n"
- " -v, --version display version\n"
- " -d, --debug diagnostic output\n"
- " -m, --server L&B server machine name\n",
- me);
-}
-
-int main(int argc,char *argv[])
-{
- edg_wll_DumpRequest *request;
- edg_wll_DumpResult *result;
- char *server = NULL;
- char date[ULM_DATE_STRING_LENGTH+1];
-
- char *me;
- int opt;
- edg_wll_Context ctx;
-
- /* initialize request to server defaults */
- request = (edg_wll_DumpRequest *) calloc(1,sizeof(edg_wll_DumpRequest));
- request->from = EDG_WLL_DUMP_LAST_END;
- request->to = EDG_WLL_DUMP_NOW;
-
- /* initialize result */
- result = (edg_wll_DumpResult *) calloc(1,sizeof(edg_wll_DumpResult));
-
- me = strrchr(argv[0],'/');
- if (me) me++; else me=argv[0];
-
- /* get arguments */
- while ((opt = getopt_long(argc,argv,"f:t:m:dvh",opts,NULL)) != EOF) {
-
- switch (opt) {
-
- case 'f': request->from = (time_t) edg_wll_ULMDateToDouble(optarg); break;
- case 't': request->to = (time_t) edg_wll_ULMDateToDouble(optarg); break;
- case 'm': server = optarg; break;
- case 'd': debug = 1; break;
- case 'v': fprintf(stdout,"%s:\t%s\n",me,rcsid); exit(0);
- case 'h':
- case '?': usage(me); return 1;
- }
- }
-
- /* Initialize Globus common module */
- dprintf(("Initializing Globus common module..."));
- if (globus_module_activate(GLOBUS_COMMON_MODULE) != GLOBUS_SUCCESS) {
- dprintf(("no.\n"));
- fprintf(stderr,"Unable to initialize Globus common module\n");
- } else {
- dprintf(("yes.\n"));
- }
-
- /* check request */
- if (debug) {
- printf("Dump request:\n");
- if (request->from < 0) {
- printf("- from: %ld.\n",(long) request->from);
- } else {
- if (edg_wll_ULMTimevalToDate(request->from,0,date) != 0) {
- fprintf(stderr,"Error parsing 'from' argument.\n");
- goto main_end;
- }
- printf("- from: %ld (i.e. %s).\n",(long) request->from,date);
- }
- if (request->to < 0) {
- printf("- to: %ld.\n",(long) request->to);
- } else {
- if (edg_wll_ULMTimevalToDate(request->to,0,date) != 0) {
- fprintf(stderr,"Error parsing 'to' argument.\n");
- goto main_end;
- }
- printf("- to: %ld (i.e. %s).\n",(long) request->to,date);
- }
- }
-
- /* initialize context */
- edg_wll_InitContext(&ctx);
- if ( server )
- {
- char *p = strchr(server, ':');
- if ( p )
- {
- edg_wll_SetParam(ctx, EDG_WLL_PARAM_QUERY_SERVER_PORT, atoi(p+1));
- *p = 0;
- }
- edg_wll_SetParam(ctx, EDG_WLL_PARAM_QUERY_SERVER, server);
- }
-
- /* that is the DumpEvents */
- dprintf(("Running the edg_wll_DumpEvents...\n"));
- if (edg_wll_DumpEvents(ctx, request, result) != 0) {
- fprintf(stderr,"Error running the edg_wll_DumpEvents().\n");
- printerr(ctx);
- switch ( edg_wll_Error(ctx, NULL, NULL) )
- {
- case ENOENT:
- case EPERM:
- case EINVAL:
- break;
- default:
- goto main_end;
- }
- }
-
- /* examine the result */
- dprintf(("Examining the result of edg_wll_DumpEvents...\n"));
- printf("Dump result:\n");
- if (result->server_file) {
- printf("- The jobs were dumped to the file '%s' at the server.\n",result->server_file);
- } else {
- printf("- The jobs were not dumped.\n");
- }
- if (edg_wll_ULMTimevalToDate(result->from,0,date) != 0) {
- fprintf(stderr,"Error parsing 'from' argument.\n");
- goto main_end;
- }
- printf("- from: %ld (i.e. %s).\n",(long) result->from,date);
- if (edg_wll_ULMTimevalToDate(result->to,0,date) != 0) {
- fprintf(stderr,"Error parsing 'to' argument.\n");
- goto main_end;
- }
- printf("- to: %ld (i.e. %s).\n",(long) result->to,date);
-
-main_end:
- dprintf(("End.\n"));
- if (request) free(request);
- if (result) free(result);
- edg_wll_FreeContext(ctx);
- return 0;
-}
-
-
-static void printerr(edg_wll_Context ctx)
-{
- char *errt,*errd;
-
- edg_wll_Error(ctx,&errt,&errd);
- fprintf(stderr,"%s (%s)\n",errt,errd);
-}
-
-
-static const char* const request_headers[] = {
- "Cache-Control: no-cache",
- "Accept: application/x-dglb",
- "User-Agent: edg_wll_Api/" PROTO_VERSION "/" COMP_PROTO,
- "Content-Type: application/x-dglb",
- NULL
-};
-
-int edg_wll_DumpEvents(
- edg_wll_Context ctx,
- const edg_wll_DumpRequest *request,
- edg_wll_DumpResult *result)
-{
- int error;
- char *send_mess,
- *response = NULL,
- *recv_mess = NULL;
-
- edg_wll_DumpRequestToXML(ctx, request, &send_mess);
-
- ctx->p_tmp_timeout = ctx->p_query_timeout;
- if (ctx->p_tmp_timeout.tv_sec < 600) ctx->p_tmp_timeout.tv_sec = 600;
-
- if (set_server_name_and_port(ctx, NULL))
- goto edg_wll_dumpevents_end;
-
- error = edg_wll_http_send_recv(ctx,
- "POST /dumpRequest HTTP/1.1", request_headers, send_mess,
- &response, NULL, &recv_mess);
- if ( error != 0 )
- goto edg_wll_dumpevents_end;
-
- if (http_check_status(ctx, response, &recv_mess))
- goto edg_wll_dumpevents_end;
-
- edg_wll_ParseDumpResult(ctx, recv_mess, result);
-
-edg_wll_dumpevents_end:
- if (response) free(response);
- if (recv_mess) free(recv_mess);
- if (send_mess) free(send_mess);
- return edg_wll_Error(ctx,NULL,NULL);
-}
+++ /dev/null
-#! /bin/bash
-
-#
-# script for exporing jobs from bkserver which should be periodically run
-# together with running jp-importer
-#
-# it uses configuration from enviroment ==> may require a configuration wrapper
-#
-
-#autodetect the prefix
-PREFIX=${GLITE_LOCATION:-`dirname $0`/..}
-
-if [ -n "$GLITE_HOST_CERT" -a -n "$GLITE_HOST_KEY" ] ;then
- creds="-c '$GLITE_HOST_CERT' -k '$GLITE_HOST_KEY'"
- X509_USER_CERT="$GLITE_HOST_CERT"
- X509_USER_KEY="$GLITE_HOST_KEY"
-fi
-if test -z "$creds"; then
- if su - $GLITE_USER -c "test -r /etc/grid-security/hostkey.pem -a -r /etc/grid-security/hostcert.pem"; then
- echo "$0: WARNING: /etc/grid-security/hostkey.pem readable by $GLITE_USER"
- creds="-c /etc/grid-security/hostcert.pem -k /etc/grid-security/hostkey.pem"
- X509_USER_CERT=/etc/grid-security/hostcert.pem
- X509_USER_KEY=/etc/grid-security/hostkey.pem
- fi
-fi
-
-
-[ -z "$creds" ] && echo $0: WARNING: No credentials specified. Using default lookup which is dangerous. >&2
-
-
-
-# dump directory of bkserver
-GLITE_LB_EXPORT_PURGEDIR=${GLITE_LB_EXPORT_PURGEDIR:-/tmp/purge}
-GLITE_LB_EXPORT_DUMPDIR=${GLITE_LB_EXPORT_DUMPDIR:-/tmp/dump}
-GLITE_LB_EXPORT_PURGEDIR_KEEP=${GLITE_LB_EXPORT_PURGEDIR_KEEP:-""}
-GLITE_LB_EXPORT_DUMPDIR_KEEP=${GLITE_LB_EXPORT_DUMPDIR_KEEP:-""}
-# maildir dump directory for jp importer
-GLITE_LB_EXPORT_JPDUMP_MAILDIR=${GLITE_LB_EXPORT_JPDUMP_MAILDIR:-/tmp/jpdump}
-# directory with exported data (file per job)
-GLITE_LB_EXPORT_JOBSDIR=${GLITE_LB_EXPORT_JOBSDIR:-/tmp/lbexport}
-# purge args (timeouts)
-GLITE_LB_EXPORT_PURGE_ARGS=${GLITE_LB_EXPORT_PURGE_ARGS:---cleared 2d --aborted 2w --cancelled 2w --other 60d}
-# Book Keeping Server
-GLITE_LB_SERVER_PORT=${GLITE_LB_SERVER_PORT:-9000}
-GLITE_LB_EXPORT_BKSERVER=${GLITE_LB_EXPORT_BKSERVER:-localhost:$GLITE_LB_SERVER_PORT}
-GLITE_LB_PURGE_ENABLED=${GLITE_LB_PURGE_ENABLED:-true}
-GLITE_LB_EXPORT_ENABLED=${GLITE_LB_EXPORT_ENABLED:-true}
-
-[ -d $GLITE_LB_EXPORT_JPDUMP_MAILDIR ] || mkdir -p $GLITE_LB_EXPORT_JPDUMP_MAILDIR
-[ -d $GLITE_LB_EXPORT_DUMPDIR ] || mkdir -p $GLITE_LB_EXPORT_DUMPDIR
-[ -d $GLITE_LB_EXPORT_PURGEDIR ] || mkdir -p $GLITE_LB_EXPORT_PURGEDIR
-[ -d $GLITE_LB_EXPORT_DUMPDIR_KEEP ] || mkdir -p $GLITE_LB_EXPORT_DUMPDIR_KEEP
-[ -d $GLITE_LB_EXPORT_PURGEDIR_KEEP ] || mkdir -p $GLITE_LB_EXPORT_PURGEDIR_KEEP
-[ -d $GLITE_LB_EXPORT_JOBSDIR ] || mkdir -p $GLITE_LB_EXPORT_JOBSDIR
-
-if [ x"$GLITE_LB_PURGE_ENABLED" = x"true" ]; then
- X509_USER_CERT="$X509_USER_CERT" X509_USER_KEY="$X509_USER_KEY" $PREFIX/sbin/glite-lb-purge $GLITE_LB_EXPORT_PURGE_ARGS -l -m $GLITE_LB_EXPORT_BKSERVER -s
-fi
-
-if [ x"$GLITE_LB_EXPORT_ENABLED" = x"true" ]; then
- list=`ls $GLITE_LB_EXPORT_PURGEDIR/* 2>/dev/null`
- for file in $list; do
- if [ -s $file ]; then
- $PREFIX/sbin/glite-lb-lb_dump_exporter -d $file -s $GLITE_LB_EXPORT_JOBSDIR -m $GLITE_LB_EXPORT_JPDUMP_MAILDIR
- if [ -n "$GLITE_LB_EXPORT_PURGEDIR_KEEP" ]; then
- mv $file $GLITE_LB_EXPORT_PURGEDIR_KEEP
- else
- rm $file
- fi
- else
- rm $file
- fi
- done
-
- if [ -n "$GLITE_LB_EXPORT_DUMPDIR_KEEP" ]; then
- ls $GLITE_LB_EXPORT_DUMPDIR | xargs -i'{}' cp $GLITE_LB_EXPORT_DUMPDIR/'{}' $GLITE_LB_EXPORT_DUMPDIR_KEEP;
- else
- ls $GLITE_LB_EXPORT_DUMPDIR | xargs -i'{}' rm -f $GLITE_LB_EXPORT_DUMPDIR/'{}'
- fi
-fi
+++ /dev/null
-#include <stdio.h>
-#include <stdlib.h>
-#include <getopt.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <time.h>
-#include <limits.h>
-#include <sys/time.h>
-
-
-#include "glite/lb/context.h"
-#include "glite/lb/events.h"
-#include "glite/lb/events_parse.h"
-#include "glite/lb/lb_maildir.h"
-
-
-#define DUMP_FILE_STORE_PREFIX "/tmp"
-#define LB_MAILDIR_PATH "/tmp/dumpinfo_lbmd"
-
-#define KEYNAME_JOBID "jobid "
-#define KEYNAME_FILE "file "
-#define KEYNAME_JPPS "jpps "
-
-typedef struct _buffer_t {
- char *str;
- char *eol;
- int sz;
- int use;
-} buffer_t;
-
-typedef struct _dump_storage_t {
- char *job;
- char *fname;
- int fhnd;
-} dump_storage_t;
-
-static const char *optstr = "d:s:j:m:h";
-
-static struct option opts[] = {
- { "help", 0, NULL, 'h'},
- { "dump", 0, NULL, 'd'},
- { "store", 0, NULL, 's'},
- { "jpps", 0, NULL, 'j'},
- { "lbmaildir", 0, NULL, 'm'},
- { NULL, 0, NULL, 0}
-};
-
-void usage(char *me)
-{
- fprintf(stderr, "usage: %s [option]\n"
- "\t-h, --help Shows this screen.\n"
- "\t-d, --dump <file> Dump file location.\n"
- "\t-s, --store <prefix> New dump files storage.\n"
- "\t-j, --jpps <host:port> Target JPPS.\n"
- "\t-m, --lbmaildir <path> LB maildir path.\n"
- , me);
-}
-
-
-static int read_line(int, buffer_t *, char **);
-static dump_storage_t *dump_storage_find(dump_storage_t *, char *);
-static dump_storage_t *dump_storage_add(dump_storage_t **, char *, char *, int);
-static void dump_storage_free(dump_storage_t *);
-
-
-int main(int argc, char **argv)
-{
- edg_wll_Context ctx;
- edg_wll_Event *ev = NULL;
- dump_storage_t *dstorage = NULL,
- *st;
- buffer_t buf;
- char *store_pref = DUMP_FILE_STORE_PREFIX,
- *lb_maildir = LB_MAILDIR_PATH,
- *jpps = NULL,
- *name,
- *fname,
- *ln;
- int fhnd,
- opt, ret,
- msg_format_sz;
-
-
- name = strrchr(argv[0], '/');
- if ( name ) name++; else name = argv[0];
-
- fname = NULL;
- while ( (opt = getopt_long(argc, argv, optstr, opts, NULL)) != EOF )
- switch ( opt ) {
- case 'd': fname = optarg; break;
- case 's': store_pref = optarg; break;
- case 'j': jpps = optarg; break;
- case 'm': lb_maildir = optarg; break;
- case 'h': usage(name); return 0;
- case '?': usage(name); return 1;
- }
-
- msg_format_sz = sizeof(KEYNAME_JOBID) + 1 +
- sizeof(KEYNAME_FILE) + 1 +
- (jpps? sizeof(KEYNAME_JPPS) + 1: 0);
-
- if ( fname ) {
- if ( (fhnd = open(fname, O_RDONLY)) < 0 ) {
- perror("Opening input file");
- exit(1);
- }
- } else fhnd = 0;
-
- if ( edg_wll_MaildirInit(lb_maildir) ) {
- perror(lbm_errdesc);
- exit(1);
- }
-
-
-#ifndef cleanup
-# define cleanup(r) { ret = (r); goto cleanup_lbl; }
-#endif
-
- ret = 0;
- memset(&buf, 0, sizeof(buf));
- edg_wll_InitContext(&ctx);
- while ( 1 ) {
- int rl_ret,
- written,
- lnsz, ct;
- char *jobid,
- *unique;
-
- if ( (rl_ret = read_line(fhnd, &buf, &ln)) < 0 ) {
- perror("reading input file");
- cleanup(1);
- }
- if ( !ln ) break;
-
- if (*ln == 0) continue;
-
- if ( edg_wll_ParseEvent(ctx, ln, &ev) != 0 ) {
- cleanup(1);
- }
- if ( !(jobid = edg_wlc_JobIdUnparse(ev->any.jobId)) ) {
- perror("Can't unparse jobid from event");
- cleanup(1);
- }
- if ( !(unique = edg_wlc_JobIdGetUnique(ev->any.jobId)) ) {
- perror("Can't unparse jobid from event");
- cleanup(1);
- }
-
- if ( !(st = dump_storage_find(dstorage, jobid)) ) {
- int fd, i;
- char fname[PATH_MAX];
- struct timeval tv;
-
- i = 0;
- while ( 1 ) {
- if ( ++i > 10 ) {
- errno = ECANCELED;
- perror("Can't create dump file - max tries limit reached ");
- cleanup(1);
- }
- gettimeofday(&tv, NULL);
- snprintf(fname, PATH_MAX, "%s/%s.%ld_%ld", store_pref, unique, tv.tv_sec, tv.tv_usec);
- if ( (fd = open(fname, O_CREAT|O_EXCL|O_RDWR, 00640)) < 0 ) {
- if ( errno == EEXIST ) { usleep(1000); continue; }
- perror(fname);
- cleanup(1);
- }
- break;
- }
-
- if ( !(st = dump_storage_add(&dstorage, jobid, fname, fd)) ) {
- perror("Can't record dump informations");
- cleanup(1);
- }
- }
- free(jobid);
- free(unique);
-
- lnsz = strlen(ln);
- ln[lnsz++] = '\n';
- written = 0;
- while ( written < lnsz ) {
- if ( (ct = write(st->fhnd, ln+written, lnsz-written)) < 0 ) {
- if ( errno == EINTR ) { errno = 0; continue; }
- perror(fname);
- cleanup(1);
- }
- written += lnsz;
- }
-
-
- if ( !rl_ret ) break;
- edg_wll_FreeEvent(ev); ev = NULL;
- }
-
- /* store info in lb_maildir */
- for ( st = dstorage; st && st->job; st++ ) {
- char *msg;
- if ( !(msg = malloc(msg_format_sz + strlen(st->fname) + strlen(st->job))) ) {
- perror("allocating message");
- cleanup(1);
- }
- if ( jpps )
- /* XXX: used to be 5x %s here, God knows why ... */
- sprintf(msg, "%s%s\n%s%s%s%s",
- KEYNAME_JOBID, st->job, KEYNAME_FILE, st->fname, KEYNAME_JPPS, jpps);
- else
- sprintf(msg, "%s%s\n%s%s",
- KEYNAME_JOBID, st->job, KEYNAME_FILE, st->fname);
- if ( edg_wll_MaildirStoreMsg(lb_maildir, "localhost", msg) < 0 ) {
- perror(lbm_errdesc);
- exit(1);
- }
- free(msg);
- }
-
-cleanup_lbl:
- edg_wll_FreeContext(ctx);
- if ( ev ) edg_wll_FreeEvent(ev);
- for ( st = dstorage; st && st->job; st++ ) if ( st->fhnd > 0 ) close(st->fhnd);
- dump_storage_free(dstorage);
- close(fhnd);
- free(buf.str);
-
- return (ret);
-}
-
-
-static dump_storage_t *dump_storage_find(dump_storage_t *st, char *job)
-{
- while ( st && st->job ) {
- if ( !strcmp(job, st->job) ) break;
- st++;
- }
- if ( st && st->job ) return st;
- return NULL;
-}
-
-static dump_storage_t *dump_storage_add(dump_storage_t **st, char *job, char *fname, int fhnd)
-{
- dump_storage_t *tmp;
- int ct;
-
- for ( ct = 0, tmp = *st; tmp && tmp->job; ct++, tmp++ ) ;
- if ( ct ) tmp = realloc(*st, (ct+2)*sizeof(*tmp));
- else tmp = calloc(2, sizeof(*tmp));
- if ( !tmp ) return NULL;
-
- *st = tmp;
- while ( tmp && tmp->job ) tmp++;
-
- if ( !(tmp->job = strdup(job)) ) return NULL;
- if ( !(tmp->fname = strdup(fname)) ) { free(tmp->job); return NULL; }
- tmp->fhnd = fhnd;
- (tmp+1)->job = NULL;
-
- return tmp;
-}
-
-static void dump_storage_free(dump_storage_t *st)
-{
- dump_storage_t *tmp;
- for ( tmp = st; tmp && tmp->job; tmp++ ) {
- free(tmp->job);
- free(tmp->fname);
- }
- free(st);
-}
-
-/* Reads line from file and returns pointer to that.
- * Returned string is not mem allocated. It only points to the buffer!
- *
- * Buffer must be given - it is handled (allocated etc.) fully in the
- * function. It has to be freed outside.
- *
- * returns: -1 on error
- * 0 eof ('ln' could points to the last line in file)
- * 1 line successfuly read
- */
-static int read_line(int fhnd, buffer_t *buf, char **ln)
-{
- int ct, toread;
-
-
- if ( buf->eol ) {
- int tmp = buf->eol - buf->str + 1;
-
- if ( tmp < buf->use ) {
- char *aux;
- if ( (aux = memchr(buf->eol+1, '\n', buf->use-tmp)) ) {
- *ln = buf->eol+1;
- *aux = 0;
- buf->eol = aux;
- return 1;
- }
- }
- memmove(buf->str, buf->eol+1, buf->use - tmp);
- buf->eol = NULL;
- buf->use -= tmp;
- }
-
- do {
- if ( buf->use == buf->sz ) {
- char *tmp = realloc(buf->str, buf->sz+BUFSIZ);
- if ( !tmp ) return -1;
- buf->str = tmp;
- buf->sz += BUFSIZ;
- }
-
- toread = buf->sz - buf->use;
- if ( (ct = read(fhnd, buf->str+buf->use, toread)) < 0 ) {
- if ( errno == EINTR ) continue;
- return -1;
- }
- if ( ct == 0 ) break;
- buf->eol = memchr(buf->str+buf->use, '\n', ct);
- buf->use += ct;
- } while ( ct == toread && !buf->eol );
-
- *ln = buf->use? buf->str: NULL;
- if ( buf->eol ) {
- *buf->eol = 0;
- return 1;
- }
-
- return 0;
-}
+++ /dev/null
-#ident "$Header$"
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <getopt.h>
-#include <string.h>
-#include <time.h>
-#include <errno.h>
-
-#include <globus_common.h>
-
-#define CLIENT_SBIN_PROG
-
-#include "glite/lb/consumer.h"
-#include "glite/lb/context-int.h"
-#include "glite/lb/load.h"
-#include "glite/lb/ulm_parse.h"
-#include "glite/lb/xml_parse.h"
-#include "glite/lb/mini_http.h"
-
-#define dprintf(x) { if (debug) printf x; }
-
-static const char rcsid[] = "@(#)$Id$";
-
-static int debug=0;
-
-static void printerr(edg_wll_Context ctx);
-
-static struct option opts[] = {
- { "file", required_argument, NULL, 'f'},
- { "help", no_argument, NULL, 'h' },
- { "version", no_argument, NULL, 'v' },
- { "debug", no_argument, NULL, 'd' },
- { "server", required_argument, NULL, 'm' },
- { NULL, no_argument, NULL, 0 }
-};
-
-static void usage(char *me)
-{
- fprintf(stderr,"usage: %s [option]\n"
- " -m, --server L&B server machine name\n"
- " -f, --file filename file with dumped data to be loaded\n"
- " -h, --help display this help\n"
- " -v, --version display version\n"
- " -d, --debug diagnostic output\n",
- me);
-}
-
-int main(int argc,char *argv[])
-{
- edg_wll_LoadRequest *request;
- edg_wll_LoadResult *result;
- char *server = NULL;
- char date[ULM_DATE_STRING_LENGTH+1];
-
- char *me;
- int opt;
- edg_wll_Context ctx;
-
- /* initialize request to server defaults */
- request = (edg_wll_LoadRequest *) calloc(1,sizeof(edg_wll_LoadRequest));
- request->server_file = NULL;
-
- /* initialize result */
- result = (edg_wll_LoadResult *) calloc(1,sizeof(edg_wll_LoadResult));
-
- me = strrchr(argv[0],'/');
- if (me) me++; else me=argv[0];
-
- /* get arguments */
- while ((opt = getopt_long(argc,argv,"f:t:m:dvh",opts,NULL)) != EOF) {
-
- switch (opt) {
-
- case 'f': request->server_file = optarg; break;
- case 'm': server = optarg; break;
- case 'd': debug = 1; break;
- case 'v': fprintf(stdout,"%s:\t%s\n",me,rcsid); exit(0);
- case 'h':
- case '?': usage(me); return 1;
- }
- }
-
- /* Initialize Globus common module */
- dprintf(("Initializing Globus common module..."));
- if (globus_module_activate(GLOBUS_COMMON_MODULE) != GLOBUS_SUCCESS) {
- dprintf(("no.\n"));
- fprintf(stderr,"Unable to initialize Globus common module\n");
- } else {
- dprintf(("yes.\n"));
- }
-
- /* initialize context */
- edg_wll_InitContext(&ctx);
- if ( server )
- {
- char *p = strchr(server, ':');
- if ( p )
- {
- edg_wll_SetParam(ctx, EDG_WLL_PARAM_QUERY_SERVER_PORT, atoi(p+1));
- *p = 0;
- }
- edg_wll_SetParam(ctx, EDG_WLL_PARAM_QUERY_SERVER, server);
- }
-
- /* check request */
- if (debug) {
- printf("Load request:\n");
- if (request->server_file) {
- printf("- server_file: %s.\n",request->server_file);
- } else {
- printf("- server_file: not specified.\n");
- }
- }
-
- /* that is the LoadEvents */
- dprintf(("Running the edg_wll_LoadEvents...\n"));
- if (edg_wll_LoadEvents(ctx, request, result) != 0) {
- fprintf(stderr,"Error running the edg_wll_LoadEvents().\n");
- printerr(ctx);
- if ( !result->server_file )
- goto main_end;
- }
-
- /* examine the result */
- dprintf(("Examining the result of edg_wll_LoadEvents...\n"));
- printf("Load result:\n");
- if (result->server_file)
- printf("- Unloaded events were stored into the server file '%s'.\n", result->server_file);
- if (edg_wll_ULMTimevalToDate(result->from,0,date) != 0) {
- fprintf(stderr,"Error parsing 'from' argument.\n");
- goto main_end;
- }
- printf("- from: %ld (i.e. %s).\n",result->from,date);
- if (edg_wll_ULMTimevalToDate(result->to,0,date) != 0) {
- fprintf(stderr,"Error parsing 'to' argument.\n");
- goto main_end;
- }
- printf("- to: %ld (i.e. %s).\n",result->to,date);
-
-main_end:
- dprintf(("End.\n"));
- if (request) free(request);
- if (result)
- {
- if (result->server_file)
- free(result->server_file);
- free(result);
- }
- edg_wll_FreeContext(ctx);
- return 0;
-}
-
-
-static void printerr(edg_wll_Context ctx)
-{
- char *errt,*errd;
-
- edg_wll_Error(ctx,&errt,&errd);
- fprintf(stderr,"%s (%s)\n",errt,errd);
-}
-
-
-static const char* const request_headers[] = {
- "Cache-Control: no-cache",
- "Accept: application/x-dglb",
- "User-Agent: edg_wll_Api/" PROTO_VERSION "/" COMP_PROTO,
- "Content-Type: application/x-dglb",
- NULL
-};
-
-int edg_wll_LoadEvents(
- edg_wll_Context ctx,
- const edg_wll_LoadRequest *request,
- edg_wll_LoadResult *result)
-{
- int error;
- char *send_mess,
- *response = NULL,
- *recv_mess = NULL;
-
- edg_wll_LoadRequestToXML(ctx, request, &send_mess);
-
- ctx->p_tmp_timeout = ctx->p_query_timeout;
- if (ctx->p_tmp_timeout.tv_sec < 600) ctx->p_tmp_timeout.tv_sec = 600;
-
- if (set_server_name_and_port(ctx, NULL))
- goto edg_wll_loadevents_end;
-
- error = edg_wll_http_send_recv(ctx,
- "POST /loadRequest HTTP/1.1", request_headers, send_mess,
- &response, NULL, &recv_mess);
- if ( error != 0 )
- goto edg_wll_loadevents_end;
-
- if (http_check_status(ctx, response, &recv_mess))
- goto edg_wll_loadevents_end;
-
- edg_wll_ParseLoadResult(ctx, recv_mess, result);
-
-edg_wll_loadevents_end:
- if (response) free(response);
- if (recv_mess) free(recv_mess);
- if (send_mess) free(send_mess);
- return edg_wll_Error(ctx,NULL,NULL);
-}
+++ /dev/null
-#ident "$Header$"
-
-@@@LANG: C
-/*
-@@@AUTO
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-#include <math.h> // log
-#include <ctype.h> // isspace
-
-#include <globus_common.h>
-
-#include "glite/security/glite_gss.h"
-#include "glite/wmsutils/jobid/cjobid.h"
-#include "glite/lb/notifid.h"
-#include "glite/lb/producer.h"
-#include "glite/lb/events.h"
-
-#include "args.h"
-
- //" %s -p -l 100000 -j https://localhost/First_JobIV?localhost:7771 -s UserInterface -e jobAbort DG.JOB.ABORT.REASON=\"oops\"\n\n",
-
-// undefine to disable support for -l option
-#define ENABLE_REASON_LENGTH
-
-int main(int argc, char *argv[])
-{
- char /* *fmt,*fname = NULL,*/ *fmt_arg=NULL;
- char *server = NULL, *code = NULL;
- char *ff = NULL, *jobid_s = NULL;
- char *src_instance = NULL;
- int err = 0/*,i,done = 0,fmtlen*/;
- int pri = 0, noinc = 0;
- int use_lbproxy = 0;
- char *lbproxy_user = NULL;
- char *lbproxy_store_sock = NULL;
- int deb = 0;
-#ifdef ENABLE_REASON_LENGTH
- int elength = 0;
-#endif
- edg_wll_Context ctx;
- edg_wll_Source src;
- edg_wll_EventCode event = EDG_WLL_EVENT_UNDEF;
- edg_wlc_JobId jobid = 0;
- int (*logev)(edg_wll_Context context,
- edg_wll_EventCode event,
- char *fmt, ...);
-
- /* all possible variables */
-@@@{
- my %vars = ();
- for my $t (sort { $event->{order}->{$a} <=> $event->{order}->{$b} }
- $event->getTypes) {
- selectType $event $t;
- for ($event->getFieldsOrdered) {
- my $f = selectField $event $_;
- my $fn = $f->getName;
- my $type = {
- "type" => $f->getType,
- "defval" => $f->getDefaultNullValue
- };
-
- $type = { type=>'char *',defval=>'NULL' } if $f->{codes};
-
- $vars{$fn} = $type;
- }
- }
- foreach $name ( sort keys %vars ) {
- gen qq{\t$vars{$name}->{"type"} $name = $vars{$name}->{"defval"};\n};
- }
-@@@}
-
- /* all possible arguments */
- edg_wll_Args parray[] = {
- { EDG_WLL_ARGS_EVENT, "e", "event", "select event type (see -e help)", &event },
- { EDG_WLL_ARGS_BOOL, "p", "priority", "send as priority event", &pri },
- { EDG_WLL_ARGS_BOOL, "x", "lbproxy", "send directly to L&B Proxy (not locallogger)", &use_lbproxy },
- { EDG_WLL_ARGS_STRING, "S", "lbproxy-store-sock", "L&B Proxy store socket path", &lbproxy_store_sock },
- { EDG_WLL_ARGS_STRING, "U", "lbproxy-user-dn", "User certificate DN L&B Proxy store socket path", &lbproxy_user },
-
- { EDG_WLL_ARGS_STRING, "m", "machine", 0, &server },
- { EDG_WLL_ARGS_SOURCE, "s", "source", "event source (see -s help)", &src },
- { EDG_WLL_ARGS_STRING, "i", "source-instance", "event source instance", &src_instance },
- { EDG_WLL_ARGS_STRING, "j", "jobid", "JobId", &jobid_s },
- { EDG_WLL_ARGS_STRING, "c", "sequence", "event sequence code", &code },
- { EDG_WLL_ARGS_BOOL, "d", "debug mode", "enable debug mode", &deb },
-#ifdef ENABLE_REASON_LENGTH
- { EDG_WLL_ARGS_INT, "l", "reason-length", "extend 'reason' string to length (debug only)", &elength, 0, 1000000000 },
- { EDG_WLL_ARGS_BOOL, "I", "dont-increment", "don't increment initial seqence code", &noinc },
-#endif
-@@@{
- my %typetab = (
- "char *", "EDG_WLL_ARGS_STRING",
- "int", "EDG_WLL_ARGS_INT",
- "double", "EDG_WLL_ARGS_DOUBLE",
- "edg_wlc_JobId", "EDG_WLL_ARGS_JOBID",
- "edg_wll_NotifId", "EDG_WLL_ARGS_NOTIFID",
- "edg_wll_Source", "EDG_WLL_ARGS_SOURCE",
- "uint16_t", "EDG_WLL_ARGS_UINT16"
- );
- my %vars = ();
- for my $t (sort { $event->{order}->{$a} <=> $event->{order}->{$b} }
- $event->getTypes) {
- selectType $event $t;
- for ($event->getFieldsOrdered) {
- my $f = selectField $event $_;
- my $ft = $f->{codes} ? 'char *' : $f->getType;
- my $fn = $f->getName;
- my $fc = $f->getComment;
- $namehelp = { "type" => $ft, "help" => $fc };
-# gen qq{ $fn $ft $fc \n};
- $vars{$fn} = $namehelp;
- }
- }
- foreach $name ( sort keys %vars ) {
-# gen qq{ $vars{$name} $name \n };
- gen qq{\t \{ $typetab{$vars{$name}->{"type"}}, 0, "$name", "$vars{$name}->{"help"}", &$name \},\n};
- }
-
-@@@}
- { EDG_WLL_ARGS_HELP },
- { EDG_WLL_ARGS_NONE },
- };
- edg_wll_ParseArgs(&argc, argv, parray,
- "Usage: %s [-d] [-p] [[-x] [-S sock] [-U user_dn]] [-l eventlen] [-j dg_jobid]"
- "[-s source_id] -e event [key=value ...]");
-
-
- edg_wll_InitContext(&ctx);
-
- /* log the event - priority/normal/proxy */
- logev = (pri) ? edg_wll_LogEventSync : edg_wll_LogEvent;
- logev = (use_lbproxy) ? edg_wll_LogEventProxy : logev;
-
- /* if no job given - generate some */
- if (jobid_s == 0) {
- const char* s;
- if (!server) {
- s = "localhost";
- err = 1; // result fail if used normaly
- } else
- s = server;
- edg_wlc_JobIdCreate(s, 0, &jobid);
- jobid_s = edg_wlc_JobIdUnparse(jobid);
- fprintf(stderr, "JobId not given: created %s (server: %s)\n",jobid_s, s);
- }
- else if ((errno = edg_wlc_JobIdParse(jobid_s,&jobid))) {
- perror(jobid_s);
- exit(1);
- }
-
- if (event == EDG_WLL_EVENT_UNDEF) {
- fprintf(stderr,"%s: unknown or unspecified event\n",argv[0]);
- exit(1);
- }
- edg_wll_SetParam(ctx, EDG_WLL_PARAM_SOURCE, src);
- if (src_instance) edg_wll_SetParam(ctx, EDG_WLL_PARAM_INSTANCE, src_instance);
- edg_wll_SetParam(ctx, EDG_WLL_PARAM_LEVEL,
- (deb) ? EDG_WLL_LEVEL_DEBUG : EDG_WLL_LEVEL_SYSTEM);
-
- if ( use_lbproxy ) {
- if ( !lbproxy_user ) {
- gss_cred_id_t gss_cred = GSS_C_NO_CREDENTIAL;
- edg_wll_GssStatus gss_stat;
- OM_uint32 min_stat;
- if ( edg_wll_gss_acquire_cred_gsi(NULL, NULL, &gss_cred, &lbproxy_user, &gss_stat) )
- lbproxy_user = "anonymous";
- if ( gss_cred != GSS_C_NO_CREDENTIAL ) gss_release_cred(&min_stat, &gss_cred);
- }
- if ( lbproxy_store_sock )
- edg_wll_SetParam(ctx, EDG_WLL_PARAM_LBPROXY_STORE_SOCK, lbproxy_store_sock);
- if (edg_wll_SetLoggingJobProxy(ctx,jobid,code,lbproxy_user,EDG_WLL_SEQ_NORMAL)) {
- char *et,*ed;
- edg_wll_Error(ctx,&et,&ed);
- fprintf(stderr,"SetLoggingJobProxy(%s,%s,%s): %s (%s)\n",jobid_s,code,lbproxy_user,et,ed);
- exit(1);
- }
- } else {
- if (edg_wll_SetLoggingJob(ctx,jobid,code,EDG_WLL_SEQ_NORMAL)) {
- char *et,*ed;
- edg_wll_Error(ctx,&et,&ed);
- fprintf(stderr,"SetLoggingJob(%s,%s): %s (%s)\n",jobid_s,code,et,ed);
- exit(1);
- }
- }
-
- if (noinc) edg_wll_SetSequenceCode(ctx,code,EDG_WLL_SEQ_NORMAL);
-
-#ifdef ENABLE_REASON_LENGTH
- if (elength > 200000000) {
- fprintf(stderr,"%s: usupported reason message length: %d\n", argv[0], elength);
- } else if (elength > 0) {
- int d;
- int i = 0;
- reason = realloc(reason, elength + 1);
- reason[elength] = 0;
- while (i < (elength)) {
- if ((i % 20) == 0 && (i + 14) < elength)
- i += sprintf(reason + i, "%d", i);
- reason[i++] = '.';
- }
- // amount of decimal digits + "end="
- d = (int)ceil(log(i)/log(10)) + 5;
- if (i > d)
- sprintf(reason + i - (int)(d), "end=%d",i);
- reason[i] = 0;
- }
-#endif
-#if 0
- if (fname) {
- FILE *f = fopen(fname,"r");
- long s;
- size_t r;
-
- fmt = "%s FILE.CONTENT=\"%|Us\" ";
-
- if (!f) { perror(fname); return 1; }
- fseek(f,0L,SEEK_END);
- s = ftell(f); rewind(f);
- ff = (char *) malloc(s+1); if (!ff) { perror(NULL); return 0; }
- r = fread(ff,1,s,f);
- printf("%s: read %d\n",fname,r);
- ff[s] = 0;
- fclose(f);
- }
- else
- fmt = "%s ";
-#endif
-
- //err = edg_wll_LogEvent(ctx, event, fmt, fmt_arg, ff);
-
- switch (event)
- {
-@@@{
-$indent = "\t";
- for my $t (sort { $event->{order}->{$a} <=> $event->{order}->{$b} }
- $event->getTypes) {
-
- my $tu = uc $t;
- gen $indent."case EDG_WLL_EVENT_$tu :\n";
-
- selectType $event $t;
- my $argl = "";
- for ($event->getFieldsOrdered) {
- my $f = selectField $event $_;
- my $fn = $f->getName;
- my $ft;
-
-# gen { $fn $f->{codes} };
- if ($f->{codes}) {
-# $ft = "enum edg_wll\_$t" . ucfirst $fn;
- $ft = "char *";
- } else {
- $ft = $f->getType;
- }
-
- $fn = $f->getType()."ToString($fn)" if $ULMasString{$f->{type}};
-
- $argl = $argl . ", ";
- $argl = $argl . $fn;
- }
-gen qq{\t //edg_wll_Log$t();
-\t err |= logev(ctx, EDG_WLL_EVENT_$tu, EDG_WLL_FORMAT_${tu}$argl);
-\t break;
-};
- }
-@@@}
- default:
- fprintf(stderr, "unknown event\n");
- }
-
- edg_wlc_JobIdFree(jobid);
- if (jobid_s) free(jobid_s); // add all strings
-
- if (err) {
- char *et,*ed;
-
- edg_wll_Error(ctx,&et,&ed);
- fprintf(stderr,"%s: edg_wll_LogEvent*(): %s (%s)\n",
- argv[0],et,ed);
- free(et); free(ed);
- }
-
- code = edg_wll_GetSequenceCode(ctx);
- puts(code);
- free(code);
-
- edg_wll_FreeContext(ctx);
-
- if (ff) free(ff);
- if (fmt_arg) free(fmt_arg);
-#ifdef ENABLE_REASON_LENGTH
- if (reason) free(reason);
-#endif
-
- return err;
-}
+++ /dev/null
-#ident "$Header$"
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-#include <poll.h>
-
-#include "glite/security/glite_gss.h"
-#include "glite/lb/notification.h"
-#include "glite/lb/events.h"
-#include "glite/lb/log_proto.h"
-#include "glite/lb/mini_http.h"
-#include "glite/lb/context-int.h"
-#include "glite/lb/xml_parse.h"
-#include "glite/lb/events_parse.h"
-#include "glite/lb/il_msg.h"
-#include "glite/lb/escape.h"
-
-#include "connection.h"
-
-#define CON_QUEUE 10 /* listen() queue limit */
-
-/* XXX: moving all request_headers to one file would be nice
- */
-static const char* const request_headers[] = {
- "Cache-Control: no-cache",
- "Accept: application/x-dglb",
- "User-Agent: edg_wll_Api/" PROTO_VERSION "/" COMP_PROTO,
- "Content-Type: application/x-dglb",
- NULL
-};
-
-
-
-
-/* Decrement timeout
- */
-static int decrement_timeout(struct timeval *timeout, struct timeval before, struct timeval after)
-{
- if (!timeout)
- return(0); // wait indefinitely
-
- (*timeout).tv_sec = (*timeout).tv_sec - (after.tv_sec - before.tv_sec);
- (*timeout).tv_usec = (*timeout).tv_usec - (after.tv_usec - before.tv_usec);
- while ( (*timeout).tv_usec < 0) {
- (*timeout).tv_sec--;
- (*timeout).tv_usec += 1000000;
- }
- if ( ((*timeout).tv_sec < 0) || (((*timeout).tv_sec == 0) && ((*timeout).tv_usec == 0)) ) return(1);
- else return(0);
-}
-
-
-
-/* Split address to name & port
- */
-static void get_name_and_port(const char *address, char **name, int *port)
-{
- char *n = NULL, *p;
-
- n = strdup(address);
- p = strchr(n, ':');
- if (p)
- {
- *port = atoi(p+1);
- *p = 0;
- }
- *name = strdup(n);
- free(n);
-}
-
-
-static int my_bind(edg_wll_Context ctx, const char *name, int port, int *fd)
-{
- struct sockaddr_in a;
- socklen_t alen = sizeof(a);
- int sock;
-
- sock = socket(PF_INET,SOCK_STREAM,0);
- if (sock<0)
- return edg_wll_SetError(ctx, errno, "socket() failed");
-
- a.sin_family = AF_INET;
- a.sin_port = htons(port);
- a.sin_addr.s_addr = name? inet_addr(name): htonl(INADDR_ANY);
-
-// setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one));
- if (bind(sock,(struct sockaddr *)&a,alen))
- return edg_wll_SetError(ctx, errno, "bind() failed");
-
-
- if (listen(sock,CON_QUEUE))
- return edg_wll_SetError(ctx, errno, "listen() failed");
-
- *fd = sock;
-
- return edg_wll_Error(ctx,NULL,NULL);
-}
-
-
-
-static int set_server_name_and_port(edg_wll_Context ctx)
-{
-
- if (!ctx->p_notif_server)
- return(edg_wll_SetError(ctx, (edg_wll_ErrorCode) EINVAL,
- "Hostname of server to notif is not set"));
- else {
- free(ctx->srvName);
- ctx->srvName = strdup(ctx->p_notif_server);
- }
- if (!ctx->p_notif_server_port)
- return(edg_wll_SetError(ctx, (edg_wll_ErrorCode) EINVAL,
- "Port of server to notif is not set"));
- else ctx->srvPort = ctx->p_notif_server_port;
-
- return edg_wll_Error(ctx,NULL,NULL);
-}
-
-
-
-static int get_client_address(
- edg_wll_Context ctx,
- int fd,
- const char *address_override,
- char **address)
-
-{
- struct sockaddr_in a;
- socklen_t alen = sizeof(a);
- struct hostent *he;
- char *name = NULL;
- int port = 0;
-
-
- if (address_override) {
- struct in_addr in;
-
- get_name_and_port(address_override, &name, &port);
-
- if ( (he = gethostbyname((const char *) name)) == NULL) {
- edg_wll_SetError(ctx, errno, "gethostbyname() failed");
- goto err;
- }
-
- free(name);
-
- memmove(&in.s_addr, he->h_addr_list[0], sizeof(in.s_addr));
- name = strdup(inet_ntoa(in));
-
- if ( (he = gethostbyname((const char *) name)) == NULL) {
- edg_wll_SetError(ctx, errno, "gethostbyname() failed");
- goto err;
- }
-
- /* Test whether open sockket represents the same address as address_override
- * if not, close ctx->notifSock and bind to new socket corresponding to
- * address_override
- */
- if (ctx->notifSock >= 0) {
- if (getsockname(ctx->notifSock, (struct sockaddr *) &a, &alen))
- return edg_wll_SetError(ctx, errno, "getsockname() failed");
-
- if ( (strcmp(inet_ntoa(a.sin_addr), name)) || (ntohs(a.sin_port) != port) ) {
-
- if (close(ctx->notifSock)) {
- edg_wll_SetError(ctx, errno, "close() failed");
- goto err;
- }
- ctx->notifSock = -1;
-
- if (my_bind(ctx, name, port, &(ctx->notifSock)))
- goto err;
- }
- }
- else { // create new socket
- if (my_bind(ctx, name, port, &(ctx->notifSock)))
- goto err;
- }
-
- *address = strdup(address_override);
- }
- else { // address_override == NULL
-
- if (fd == -1) {
- if (ctx->notifSock == -1)
- // create new socket
- if (my_bind(ctx, NULL, 0, &(ctx->notifSock)))
- goto err;
- // else: resue socket
- }
- else
- // used supplied socket
- ctx->notifSock = fd;
-
- if (getsockname(ctx->notifSock,(struct sockaddr *) &a, &alen))
- return edg_wll_SetError(ctx, errno, "getsockname() failed");
-
- if (a.sin_addr.s_addr == INADDR_ANY)
- asprintf(address,"0.0.0.0:%d", ntohs(a.sin_port));
- else
- asprintf(address,"%s:%d", inet_ntoa(a.sin_addr), ntohs(a.sin_port));
- }
-
-err:
- free(name);
-
- return edg_wll_Error(ctx,NULL,NULL);
-}
-
-
-
-int edg_wll_NotifNew(
- edg_wll_Context ctx,
- edg_wll_QueryRec const * const *conditions,
- int fd,
- const char *address_override,
- edg_wll_NotifId *id_out,
- time_t *valid)
-{
- edg_wll_NotifId notifId = NULL;
- char *address = NULL, *send_mess = NULL,
- *recv_mess = NULL, *response = NULL;
- int ret;
-
-
- edg_wll_ResetError(ctx);
-
- if ( (ret = set_server_name_and_port(ctx)) )
- goto err;
-
- if ( (ret = edg_wll_NotifIdCreate(ctx->srvName,ctx->srvPort,¬ifId)) )
- goto err;
-
- if ( (ret = get_client_address(ctx, fd, address_override, &address)) )
- goto err;
-
- if ( (ret = edg_wll_NotifRequestToXML(ctx, "New", notifId, address,
- EDG_WLL_NOTIF_NOOP, conditions, &send_mess)) )
- goto err;
-
- ctx->p_tmp_timeout = ctx->p_notif_timeout;
-
- if ( (ret = edg_wll_http_send_recv(ctx, "POST /notifRequest HTTP/1.1",
- request_headers,send_mess,
- &response,NULL,&recv_mess)) )
- goto err;
-
- if ( (ret = http_check_status(ctx,response)) )
- goto err;
-
- ret = edg_wll_ParseNotifResult(ctx, recv_mess, valid);
-
-
-err:
- if (ret != 0) {
- if (notifId) edg_wll_NotifIdFree(notifId);
- *id_out = NULL;
- *valid = -1;
- }
- else
- *id_out = notifId;
-
- free(address);
- free(recv_mess);
- free(send_mess);
- free(response);
- return edg_wll_Error(ctx,NULL,NULL);
-}
-
-
-
-int edg_wll_NotifBind(
- edg_wll_Context ctx,
- const edg_wll_NotifId id,
- int fd,
- const char *address_override,
- time_t *valid)
-{
- char *address = NULL, *send_mess = NULL,
- *recv_mess = NULL, *response = NULL;
-
-
- edg_wll_ResetError(ctx);
-
-
- // if a local listening socket active, close it
- if (ctx->notifSock >= 0) {
- if (close(ctx->notifSock))
- return edg_wll_SetError(ctx, errno, "close() failed");
- else
- ctx->notifSock = -1;
- }
-
- if (set_server_name_and_port(ctx))
- goto err;
-
- if (get_client_address(ctx, fd, address_override, &address))
- goto err;
-
- if (edg_wll_NotifRequestToXML(ctx, "Bind", id, address,
- EDG_WLL_NOTIF_NOOP, NULL, &send_mess))
- goto err;
-
- ctx->p_tmp_timeout = ctx->p_notif_timeout;
-
- if (edg_wll_http_send_recv(ctx, "POST /notifRequest HTTP/1.1",
- request_headers,send_mess,
- &response,NULL,&recv_mess))
- goto err;
-
- if (http_check_status(ctx,response))
- goto err;
-
- edg_wll_ParseNotifResult(ctx, recv_mess, valid);
-
-err:
- free(address);
- free(recv_mess);
- free(send_mess);
- free(response);
- return edg_wll_Error(ctx,NULL,NULL);
-}
-
-
-
-int edg_wll_NotifChange(
- edg_wll_Context ctx,
- const edg_wll_NotifId id,
- edg_wll_QueryRec const * const * conditions,
- edg_wll_NotifChangeOp op)
-{
- char *send_mess = NULL, *recv_mess = NULL, *response = NULL;
- time_t not_used;
-
-
- edg_wll_ResetError(ctx);
-
-
- if (set_server_name_and_port(ctx))
- goto err;
-
- if (edg_wll_NotifRequestToXML(ctx, "Change", id, NULL,
- op, conditions, &send_mess))
- goto err;
-
- ctx->p_tmp_timeout = ctx->p_notif_timeout;
-
- if (edg_wll_http_send_recv(ctx, "POST /notifRequest HTTP/1.1",
- request_headers,send_mess,
- &response,NULL,&recv_mess))
- goto err;
-
- if (http_check_status(ctx,response))
- goto err;
-
- edg_wll_ParseNotifResult(ctx, recv_mess, ¬_used);
-
-err:
- free(recv_mess);
- free(send_mess);
- free(response);
- return edg_wll_Error(ctx,NULL,NULL);
-}
-
-
-
-int edg_wll_NotifRefresh(
- edg_wll_Context ctx,
- const edg_wll_NotifId id,
- time_t *valid)
-{
- char *send_mess = NULL, *recv_mess = NULL, *response = NULL;
-
-
- edg_wll_ResetError(ctx);
-
-
- if (set_server_name_and_port(ctx))
- goto err;
-
- if (edg_wll_NotifRequestToXML(ctx, "Refresh", id, NULL,
- EDG_WLL_NOTIF_NOOP, NULL, &send_mess))
- goto err;
-
- ctx->p_tmp_timeout = ctx->p_notif_timeout;
-
- if (edg_wll_http_send_recv(ctx, "POST /notifRequest HTTP/1.1",
- request_headers,send_mess,
- &response,NULL,&recv_mess))
- goto err;
-
- if (http_check_status(ctx,response))
- goto err;
-
- edg_wll_ParseNotifResult(ctx, recv_mess, valid);
-
-err:
- free(recv_mess);
- free(send_mess);
- free(response);
- return edg_wll_Error(ctx,NULL,NULL);
-}
-
-
-
-int edg_wll_NotifDrop(
- edg_wll_Context ctx,
- edg_wll_NotifId *id)
-{
- char *send_mess = NULL, *recv_mess = NULL, *response = NULL;
- time_t not_used;
-
-
- edg_wll_ResetError(ctx);
-
-
- if (set_server_name_and_port(ctx))
- goto err;
-
- if (edg_wll_NotifRequestToXML(ctx, "Drop", id, NULL,
- EDG_WLL_NOTIF_NOOP, NULL, &send_mess))
- goto err;
-
- ctx->p_tmp_timeout = ctx->p_notif_timeout;
-
- if (edg_wll_http_send_recv(ctx, "POST /notifRequest HTTP/1.1",
- request_headers,send_mess,
- &response,NULL,&recv_mess))
- goto err;
-
- if (http_check_status(ctx,response))
- goto err;
-
- edg_wll_ParseNotifResult(ctx, recv_mess, ¬_used);
-
-err:
- free(recv_mess);
- free(send_mess);
- free(response);
- return edg_wll_Error(ctx,NULL,NULL);
-}
-
-
-
-static int gss_reader(void *user_data, char *buffer, int max_len)
-{
- edg_wll_GssStatus gss_code;
- edg_wll_Context tmp_ctx = (edg_wll_Context)user_data;
- int ret, len;
-
- ret = edg_wll_gss_read_full(&tmp_ctx->connPoolNotif[0].gss,
- buffer, max_len,
- &tmp_ctx->p_tmp_timeout,
- &len, &gss_code);
- if(ret < 0)
- switch(ret) {
- case EDG_WLL_GSS_ERROR_TIMEOUT:
- edg_wll_SetError(tmp_ctx, ETIMEDOUT, "read message");
- break;
- case EDG_WLL_GSS_ERROR_EOF:
- edg_wll_SetError(tmp_ctx, ENOTCONN, NULL);
- break;
- default:
- edg_wll_SetError(tmp_ctx, EDG_WLL_ERROR_GSS, "read message");
- break;
- }
-
- return(ret);
-}
-
-
-static int recv_notif(edg_wll_Context ctx)
-{
- int len;
-
- if (ctx->connPoolNotif[0].buf) {
- free(ctx->connPoolNotif[0].buf);
- ctx->connPoolNotif[0].buf = NULL;
- }
- ctx->connPoolNotif[0].bufUse = 0;
- ctx->connPoolNotif[0].bufSize = 0;
-
- len = read_il_data(ctx, &ctx->connPoolNotif[0].buf, gss_reader);
- if(len < 0)
- return(len);
-
- ctx->connPoolNotif[0].bufSize = len+1;
- ctx->connPoolNotif[0].bufUse = len+1;
-
-
- return edg_wll_Error(ctx,NULL,NULL);
-}
-
-
-
-static int send_reply(const edg_wll_Context ctx)
-{
- int ret, len, err_code, err_code_min = 0;
- char *buf, *err_msg = NULL;
- size_t total;
- edg_wll_GssStatus gss_code;
-
-
- err_code = edg_wll_Error(ctx,NULL,&err_msg);
-
- if (!err_msg) err_msg=strdup("OK");
-
- len = encode_il_reply(&buf, err_code, err_code_min, err_msg);
- if(len < 0) {
- edg_wll_SetError(ctx,E2BIG,"create_reply()");
- goto err;
- }
-
- ret = edg_wll_gss_write_full(&ctx->connPoolNotif[0].gss,
- buf,len,&ctx->p_tmp_timeout,&total, &gss_code);
- if (ret < 0) {
- edg_wll_SetError(ctx,
- ret == EDG_WLL_GSS_ERROR_TIMEOUT ?
- ETIMEDOUT : EDG_WLL_ERROR_GSS,
- "write reply");
- goto err;
- }
-
-err:
- if(buf) free(buf);
- free(err_msg);
- return edg_wll_Error(ctx,NULL,NULL);
-}
-
-
-
-
-int edg_wll_NotifReceive(
- edg_wll_Context ctx,
- int fd,
- const struct timeval *timeout,
- edg_wll_JobStat *state_out,
- edg_wll_NotifId *id_out)
-
-/* pullup from INFN, support multiple messages from interlogger */
-#if 0
-{
- fd_set fds;
- struct sockaddr_in a;
- int recv_sock, alen;
- edg_wll_Event *event = NULL;
- struct timeval start_time,check_time,tv;
- char *p = NULL, *ucs = NULL,
- *event_char = NULL, *jobstat_char = NULL;
- int ret;
- edg_wll_GssStatus gss_code;
-
-
- edg_wll_ResetError(ctx);
-
- /* start timer */
- gettimeofday(&start_time,0);
-
- if (fd == -1) {
- if (ctx->notifSock == -1) {
- edg_wll_SetError(ctx, EINVAL, "No client socket opened.");
- goto err;
- }
- else {
- fd = ctx->notifSock;
- }
- }
-
- FD_ZERO(&fds);
- FD_SET(fd,&fds);
-
- tv.tv_sec = timeout->tv_sec;
- tv.tv_usec = timeout->tv_usec;
-
- switch(select(fd+1, &fds, NULL, NULL, &tv)) {
- case -1:
- edg_wll_SetError(ctx, errno, "select() failed");
- goto err;
- case 0:
- edg_wll_SetError(ctx, ETIMEDOUT, "select() timeouted");
- goto err;
- default:
- break;
- }
-
-/* check time */
- gettimeofday(&check_time,0);
- if (decrement_timeout(&tv, start_time, check_time)) {
- edg_wll_SetError(ctx, ETIMEDOUT, "edg_wll_NotifReceive()");
- goto err;
- }
-
- start_time = check_time;
-
- alen=sizeof(a);
- recv_sock = accept(fd,&a,&alen);
- if (recv_sock <0) {
- edg_wll_SetError(ctx, errno, "accept() failed");
- goto err;
- }
-
- ret = edg_wll_gss_accept(ctx->connPool[ctx->connToUse].gsiCred, recv_sock,
- &tv, &ctx->connPool[ctx->connToUse].gss, &gss_code);
-
- if (ret) {
- edg_wll_SetError(ctx, errno, "GSS authentication failed.");
- goto err;
- }
-
-/* check time */
- gettimeofday(&check_time,0);
- if (decrement_timeout(&tv, start_time, check_time)) {
- edg_wll_SetError(ctx, ETIMEDOUT, "edg_wll_NotifReceive()");
- goto err;
- }
-
- start_time = check_time;
-
-
- ctx->p_tmp_timeout = tv;
-
- if (recv_notif(ctx)) {
- /* error set in recv_notif() */
- goto err;
- }
-
- if (send_reply(ctx)) {
- /* error set in send_reply() */
- goto err;
- }
-
- p = ctx->connPool[ctx->connToUse].buf;
- p = get_string(p, &ucs);
- if (p == NULL) return edg_wll_SetError(ctx,EDG_WLL_IL_PROTO,"reading UCS");
- free(ucs);
-
- p = get_string(p, &event_char);
- if (p == NULL) {
- free(ucs);
- return edg_wll_SetError(ctx,EDG_WLL_IL_PROTO,"reading event string");;
- }
-
- /****************************************************************/
- /* end of notif-interlogger message exchange */
- /****************************************************************/
-
- /* check time */
- gettimeofday(&check_time,0);
- if (decrement_timeout(&tv, start_time, check_time)) {
- edg_wll_SetError(ctx, ETIMEDOUT, "edg_wll_NotifReceive()");
- goto err;
- }
- start_time = check_time;
-
- event = edg_wll_InitEvent(EDG_WLL_EVENT_NOTIFICATION);
- if (edg_wll_ParseNotifEvent(ctx, event_char, &event)) {
- goto err;
- }
-
- jobstat_char = edg_wll_UnescapeXML((const char *) event->notification.jobstat);
- if (jobstat_char == NULL) {
- edg_wll_SetError(ctx, EINVAL, "edg_wll_UnescapeXML()");
- goto err;
- }
-
- /* fill in return values
- */
- if ( edg_wll_ParseJobStat(ctx, jobstat_char,
- strlen(jobstat_char), state_out)) {
- goto err;
- }
-
- if ( id_out ) {
- *id_out = event->notification.notifId;
- event->notification.notifId = NULL;
- }
-
-
-err:
- if (event) {
- edg_wll_FreeEvent(event);
- // XXX - konzultovat s honikem; podle meho by to free
- // mel delat uz edg_wll_FreeEvent
- //free(event);
- }
-
- free(ctx->connPool[ctx->connToUse].buf);
- ctx->connPool[ctx->connToUse].buf = NULL;
- ctx->connPool[ctx->connToUse].bufUse = 0;
- ctx->connPool[ctx->connToUse].bufSize = 0;
-
- free(event_char);
- free(jobstat_char);
-
- // XXX
- // konzultovat s Danem
- /* Dan: ??? */
- edg_wll_gss_close(&ctx->connPool[ctx->connToUse].gss, NULL);
-
- return edg_wll_Error(ctx,NULL,NULL);
-}
-#endif
-/* NotifReceive */
-{
- struct pollfd pollfds[1];
- struct sockaddr_in a;
- int recv_sock, alen;
- edg_wll_Event *event = NULL;
- struct timeval start_time,check_time,tv;
- char *event_char = NULL, *jobstat_char = NULL;
- edg_wll_GssStatus gss_code;
-
-
- edg_wll_ResetError(ctx);
-
- /* start timer */
- gettimeofday(&start_time,0);
-
- if (fd == -1) {
- if (ctx->notifSock == -1) {
- edg_wll_SetError(ctx, EINVAL, "No client socket opened.");
- goto err;
- }
- else {
- fd = ctx->notifSock;
- }
- }
-
- pollfds[0].fd = fd;
- pollfds[0].events = POLLIN;
- tv.tv_sec = timeout->tv_sec;
- tv.tv_usec = timeout->tv_usec;
-
-
-select:
- /* XXX - index 0 is used because of absence of connection management */
- /* to use it, support in client/connection.c needed */
- /* it is better to separate it from ctx->connPool, which is used */
- /* for outgouing messages to server */
- /* In future it should be in context, so one could use: */
- /* ctx->connPoolNotif[ctx->connPoolNotifToUse] */
- /* notif_send() & notif_receive() should then migrate to */
- /* client/connection.c and use connPool management f-cions */
-
- if (ctx->connPoolNotif[0].gss.context == GSS_C_NO_CONTEXT)
- {
- int ret;
- switch(poll(pollfds, 1, tv.tv_sec*1000+tv.tv_usec/1000)) {
- case -1:
- edg_wll_SetError(ctx, errno, "edg_wll_NotifReceive: poll() failed");
- goto err;
- case 0:
- edg_wll_SetError(ctx, ETIMEDOUT, "edg_wll_NotifReceive: poll() timed out");
- goto err;
- default:
- if (!(pollfds[0].revents & POLLIN)) {
- edg_wll_SetError(ctx, errno, "edg_wll_NotifReceive: error on filedescriptor");
- goto err;
- }
- break;
- }
-
- /* check time */
- gettimeofday(&check_time,0);
- if (decrement_timeout(&tv, start_time, check_time)) {
- edg_wll_SetError(ctx, ETIMEDOUT, "edg_wll_NotifReceive()");
- goto err;
- }
- start_time = check_time;
-
- alen=sizeof(a);
- recv_sock = accept(fd,(struct sockaddr *)&a,&alen);
- if (recv_sock <0) {
- edg_wll_SetError(ctx, errno, "accept() failed");
- goto err;
- }
-
- ret = edg_wll_gss_accept(ctx->connPoolNotif[0].gsiCred, recv_sock,
- &tv, &ctx->connPoolNotif[0].gss,&gss_code);
- if (ret) {
- edg_wll_SetError(ctx, errno, "GSS authentication failed.");
- goto err;
- }
-
- /* check time */
- gettimeofday(&check_time,0);
- if (decrement_timeout(&tv, start_time, check_time)) {
- edg_wll_SetError(ctx, ETIMEDOUT, "edg_wll_NotifReceive()");
- goto err;
- }
- start_time = check_time;
- }
-
-
- ctx->p_tmp_timeout = tv;
-
- /****************************************************************/
- /* Communication with notif-interlogger */
- /****************************************************************/
-
- if (recv_notif(ctx)) {
- if (ctx->errCode == ENOTCONN) {
- /* other side (interlogger-notif) probably closed connection */
- edg_wll_ResetError(ctx);
-
- edg_wll_gss_close(&ctx->connPoolNotif[0].gss,NULL);
- // buffer is freed in recv_notif()
-
- goto select;
- }
- else {
- goto err; /* error set in recv_notif() */
- }
- }
-
- if (send_reply(ctx)) {
- goto err; /* error set in send_reply() */
- }
-
- {
- il_octet_string_t ev;
-
- if(decode_il_msg(&ev, ctx->connPoolNotif[0].buf) < 0)
- return edg_wll_SetError(ctx, EDG_WLL_IL_PROTO, "decoding event string");
- event_char = ev.data;
- }
- /****************************************************************/
- /* end of notif-interlogger message exchange */
- /****************************************************************/
-
- /* check time */
- gettimeofday(&check_time,0);
- if (decrement_timeout(&tv, start_time, check_time)) {
- edg_wll_SetError(ctx, ETIMEDOUT, "edg_wll_NotifReceive()");
- goto err;
- }
- start_time = check_time;
-
- event = edg_wll_InitEvent(EDG_WLL_EVENT_NOTIFICATION);
- if (edg_wll_ParseNotifEvent(ctx, event_char, &event)) {
- goto err;
- }
-
- jobstat_char = edg_wll_UnescapeXML((const char *) event->notification.jobstat);
- if (jobstat_char == NULL) {
- edg_wll_SetError(ctx, EINVAL, "edg_wll_UnescapeXML()");
- goto err;
- }
-
- /* fill in return values
- */
- if ( edg_wll_ParseJobStat(ctx, jobstat_char,
- strlen(jobstat_char), state_out)) {
- goto err;
- }
-
- if (id_out) {
- *id_out = event->notification.notifId;
- event->notification.notifId = NULL;
- }
-
-err:
- if (event) {
- edg_wll_FreeEvent(event);
- // XXX - konzultovat s honikem; podle meho by to free
- // mel delat uz edg_wll_FreeEvent
- //free(event);
- }
-
- free(ctx->connPoolNotif[0].buf);
- ctx->connPoolNotif[0].buf = NULL;
- ctx->connPoolNotif[0].bufUse = 0;
- ctx->connPoolNotif[0].bufSize = 0;
-
- free(event_char);
- free(jobstat_char);
-
- return edg_wll_Error(ctx,NULL,NULL);
-}
-
-
-int edg_wll_NotifGetFd(
- edg_wll_Context ctx)
-{
- if (ctx->notifSock == -1) {
- edg_wll_SetError(ctx, EBADF, "Client socket is not opened.");
- return -1;
- }
-
- return ctx->notifSock;
-}
-
-
-int edg_wll_NotifCloseFd(
- edg_wll_Context ctx)
-{
- int err;
-
- if (ctx->notifSock >= 0) {
- if (ctx->connPoolNotif[0].gss.context != GSS_C_NO_CONTEXT) {
- edg_wll_gss_close(&ctx->connPoolNotif[0].gss, NULL);
- }
- err = close(ctx->notifSock);
- ctx->notifSock = -1;
-
- if (err)
- return edg_wll_SetError(ctx, errno, "close() failed");
- }
-
- return edg_wll_Error(ctx,NULL,NULL);
-}
+++ /dev/null
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/time.h>
-
-#include "glite/wmsutils/jobid/cjobid.h"
-#include "glite/lb/producer.h"
-#include "glite/lb/events.h"
-
-#define PROXY_SERVER "localhost:9000"
-
-#define tv_sub(a,b) {\
- (a).tv_usec -= (b).tv_usec;\
- (a).tv_sec -= (b).tv_sec;\
- if ((a).tv_usec < 0) {\
- (a).tv_sec--;\
- (a).tv_usec += 1000000;\
- }\
-}
-
-#define dprintf(x) { if (verbose) printf x; }
-
-
-extern char *optarg;
-extern int opterr,optind;
-
-static void usage(char *me)
-{
- fprintf(stderr,"usage: %s [-m bkserver] [-x scenario] [-n num_subjobs [-S]] [-l jdl_file] [-N num_repeat]\n"
- " -m <bkserver> address:port of bkserver\n"
- " -x <scenario> use LBProxy\n"
- " 1 use one call (RegisterJobProxyOnly - register only with lbproxy) \n"
- " 2 use one call (RegisterJobProxyOld - sequence registration) \n"
- " 3 use one call (RegisterJobProxy - dual registration) \n"
- " 0 (or anything else) do not register to lbproxy at all\n"
- " -n <num_subjobs> number of subjobs of DAG\n"
- " -S register subjobs\n"
- " -l <jdl_file> file with JDL\n"
- " -N <num_repeat> repeat whole registration N-times\n"
- " -v verbose output\n",
- me);
-}
-
-int main(int argc, char *argv[])
-{
- char *server = NULL,*jdl = NULL;
- int lbproxy = 0, N = 1, verbose = 0;
- int done = 0,num_subjobs = 0,reg_subjobs = 0, i, j;
- edg_wll_Context ctx;
- edg_wlc_JobId *jobids,*subjobs;
- struct timeval start, stop;
-
-
- edg_wll_InitContext(&ctx);
- opterr = 0;
-
- do {
- switch (getopt(argc,argv,"x:m:n:Sl:N:v")) {
- case 'x': lbproxy = optarg ? atoi(optarg):1; break;
- case 'm': server = strdup(optarg); break;
- case 'n': num_subjobs = atoi(optarg); break;
- case 'S': if (num_subjobs>0) { reg_subjobs = 1; break; }
- case 'l': jdl = (char *) strdup(optarg); break;
- case 'N': N = atoi(optarg); break;
- case 'v': verbose = 1; break;
- case '?': usage(argv[0]); exit(EINVAL);
- case -1: done = 1; break;
- }
- } while (!done);
-
- if ((lbproxy > 3) || (lbproxy < 0)) lbproxy = 1;
-
- if (!server && !lbproxy) {
- fprintf(stderr,"%s: either -m server or -x has to be specified\n",argv[0]);
- exit(1);
- }
-
- /* prepare set of N jobid before starting timer */
- jobids = (edg_wlc_JobId *) malloc(N * sizeof(edg_wlc_JobId));
- dprintf(("generating jobids..."));
- {
- char *name=server?server:strdup(PROXY_SERVER);
- char *p = strchr(name,':');
- int port;
-
- if (p) { *p=0; port = atoi(p+1); }
- else port = 0;
- for (i=0; i<N; i++)
- edg_wlc_JobIdCreate(name,port,&(jobids[i]));
- }
- dprintf(("done.\n"));
-
- /* probably not useful now, but can be handy with register subjobs */
- if (jdl) {
- int f = open(jdl,O_RDONLY,0);
- off_t l,p,c;
-
- if (f<0) { perror(jdl); exit(1); }
- l = lseek(f,0,SEEK_END);
- lseek(f,0,SEEK_SET);
-
- jdl = malloc(l+1);
-
- for (p=0; p < l && (c = read(f,jdl+p,l-p)) > 0; p += c);
- if (c<0) {
- perror("read()");
- exit (1);
- }
- jdl[p] = 0;
- }
-
- edg_wll_SetParam(ctx,EDG_WLL_PARAM_SOURCE,edg_wll_StringToSource("Application"));
-
- /* start measurement */
- gettimeofday(&start, NULL);
-
- for (i=0; i<N; i++) {
- switch (lbproxy) {
- case 0: /* register to bkserver only */
- if (edg_wll_RegisterJobSync(ctx,jobids[i],
- num_subjobs?EDG_WLL_REGJOB_DAG:EDG_WLL_REGJOB_SIMPLE,
- jdl ? jdl : "blabla", "NNNSSSS",
- num_subjobs,NULL,&subjobs))
- {
- char *et,*ed;
- edg_wll_Error(ctx,&et,&ed);
- fprintf(stderr,"edg_wll_RegisterJobSync(): %s (%s)\n",et,ed);
- exit(1);
- }
- break;
- case 1: /* register to lbproxy only */
- if (edg_wll_RegisterJobProxyOnly(ctx,jobids[i],
- num_subjobs?EDG_WLL_REGJOB_DAG:EDG_WLL_REGJOB_SIMPLE,
- jdl ? jdl : "blabla", "NNNSSSS",
- num_subjobs,NULL,&subjobs))
- {
- char *et,*ed;
- edg_wll_Error(ctx,&et,&ed);
- fprintf(stderr,"edg_wll_RegisterJobProxyOnly(): %s (%s)\n",et,ed);
- exit(1);
- }
- break;
- case 2: /* old (not dual) registration */
- if (edg_wll_RegisterJobProxyOld(ctx,jobids[i],
- num_subjobs?EDG_WLL_REGJOB_DAG:EDG_WLL_REGJOB_SIMPLE,
- jdl ? jdl : "blabla", "NNNSSSS",
- num_subjobs,NULL,&subjobs))
- {
- char *et,*ed;
- edg_wll_Error(ctx,&et,&ed);
- fprintf(stderr,"edg_wll_RegisterJobProxyOld(): %s (%s)\n",et,ed);
- exit(1);
- }
- break;
- case 3: /* dual registration */
- if (edg_wll_RegisterJobProxy(ctx,jobids[i],
- num_subjobs?EDG_WLL_REGJOB_DAG:EDG_WLL_REGJOB_SIMPLE,
- jdl ? jdl : "blabla", "NNNSSSS",
- num_subjobs,NULL,&subjobs))
- {
- char *et,*ed;
- edg_wll_Error(ctx,&et,&ed);
- fprintf(stderr,"edg_wll_RegisterJobProxy(): %s (%s)\n",et,ed);
- exit(1);
- }
- break;
- }
-
- if (reg_subjobs) {
- char ** jdls = (char**) malloc(num_subjobs*sizeof(char*));
-
- for (j=0; subjobs[j]; j++) {
- asprintf(jdls+j, "JDL of subjob #%d\n", j+1);
- }
-
- if (lbproxy) {
- if (edg_wll_RegisterSubjobsProxy(ctx, jobids[i], (const char **) jdls, NULL, subjobs)) {
- char *et,*ed;
- edg_wll_Error(ctx,&et,&ed);
- fprintf(stderr,"edg_wll_RegisterSubjobsProxy: %s (%s)\n", et, ed);
- exit(1);
- }
- } else {
- if (edg_wll_RegisterSubjobs(ctx, jobids[i], (const char **) jdls, NULL, subjobs)) {
- char *et,*ed;
- edg_wll_Error(ctx,&et,&ed);
- fprintf(stderr,"edg_wll_RegisterSubjobs: %s (%s)\n", et, ed);
- exit(1);
- }
- }
-
- for (j=0; subjobs[j]; j++) free(jdls[j]);
- }
- }
-
- /* stop measurement */
- gettimeofday(&stop, NULL);
-
- {
- float sum;
-
- tv_sub(stop,start);
- sum=stop.tv_sec + (float) stop.tv_usec/1000000;
- dprintf(("Test duration (seconds) "));
- printf("%6.6f\n", sum);
- }
-
- for (i=0; i<N; i++)
- edg_wlc_JobIdFree(jobids[i]);
- free(jobids);
-
- edg_wll_FreeContext(ctx);
-
- return 0;
-}
+++ /dev/null
-#!/bin/bash
-
-
-test_glite_location()
-{
- GLITE_LOCATION_VAR=${GLITE_LOCATION_VAR:-/tmp}
-
- [ -n "$GLITE_LB_PROXY_SOCK_PREFIX" ] && \
- export GLITE_WMS_LBPROXY_STORE_SOCK=$GLITE_LB_PROXY_SOCK_PREFIX\store.sock
-
- if [ -z "$GLITE_LOCATION" ];
- then
- echo "GLITE_LOCATION not set! Exiting.";
- exit 1;
- fi
-}
-
-test_credentials()
-{
- [ -n "$GLITE_HOST_CERT" -a -n "$GLITE_HOST_KEY" ] &&
- creds="-c $GLITE_HOST_CERT -k $GLITE_HOST_KEY"
-
- if test -z "$creds"; then
- if [ -r /etc/grid-security/hostkey.pem -a -r /etc/grid-security/hostcert.pem ]; then
- creds="-c /etc/grid-security/hostcert.pem -k /etc/grid-security/hostkey.pem -C /etc/grid-security/certificates"
- fi
- fi
- [ -z "$creds" ] && \
- echo WARNING: No credentials specified. Using default lookup which is dangerous. >&2
-}
-
-my_echo()
-{
- echo $1 1>&2
-}
-
-
-start_bkserver()
-{
- # production version - usable only when starting as root
- # $GLITE_LOCATION/etc/init.d/glite-lb-bkserverd start
-
- # workaround
- [ -n "$GLITE_LB_SERVER_PIDFILE" ] && pidfile=$GLITE_LB_SERVER_PIDFILE ||
- pidfile=$GLITE_LOCATION_VAR/glite-lb-bkserverd.pid
-
- [ -z "$GLITE_LB_EXPORT_JPREG_MAILDIR" ] && \
- GLITE_LB_EXPORT_JPREG_MAILDIR=/tmp/jpreg
- maildir="--jpreg-dir $GLITE_LB_EXPORT_JPREG_MAILDIR"
- [ -d "$GLITE_LB_EXPORT_JPREG_MAILDIR" ] || \
- mkdir -p "$GLITE_LB_EXPORT_JPREG_MAILDIR"
-
- [ -n "$GLITE_LB_SERVER_PORT" ] && port="-p $GLITE_LB_SERVER_PORT"
- [ -n "$GLITE_LB_SERVER_WPORT" ] && wport="-w $GLITE_LB_SERVER_WPORT"
- [ -n "$GLITE_LB_SERVER_TRANSACTION" ] && trans="-b $GLITE_LB_SERVER_TRANSACTION"
-
- if [ -n "$1" ]; then
- sink="--perf-sink $1"
- else
- sink=""
- fi
-
- echo -n "Starting glite-lb-bkserver ..."
- $GLITE_LOCATION/bin/glite-lb-bkserverd \
- $creds -i $pidfile $port $wport $maildir $sink $trans\
- --purge-prefix /tmp/purge_new --dump-prefix /tmp/dump_new -s 1\
- && echo " done" || echo " FAILED"
- echo
-}
-
-
-stop_bkserver()
-{
- echo
- if [ -f $pidfile ]; then
- pid=`cat $pidfile`
- kill $pid
- echo -n Stopping glite-lb-bkserverd \($pid\) ...
- try=0
- while ps p $pid >/dev/null 2>&1; do
- sleep 1;
- kill $pid 2>/dev/null
- try=`expr $try + 1`
- if [ $try = 19 ]; then
- echo "bkserver jammed - sending kill -9"
- kill -9 $pid 2>/dev/null
- fi
- if [ $try = 20 ]; then
- echo " giving up after $try retries"
- return 1
- fi
- done
- echo " done"
- rm -f $pidfile
- rm -rf $GLITE_LB_EXPORT_JPREG_MAILDIR
- else
- echo $pidfile does not exist - glite-lb-bkserverd not running? >&2
- return 1
- fi
-
-}
-
-
-start_proxy()
-{
- [ -n "$GLITE_LB_PROXY_PIDFILE" ] && proxy_pidfile=$GLITE_LB_PROXY_PIDFILE ||
- proxy_pidfile=$GLITE_LOCATION_VAR/glite-lb-proxy.pid
-
- [ -n "$GLITE_LB_PROXY_SOCK_PREFIX" ] && proxy_sock_prefix="-p $GLITE_LB_PROXY_SOCK_PREFIX" ||
- proxy_sock_prefix=""
-
- [ -n "$1" ] && sink="-K $1" || sink_mode=
-
- echo -n Starting glite-lb-proxy ...
- $GLITE_LOCATION/bin/glite-lb-proxy \
- -i $proxy_pidfile $proxy_sock_prefix $sink \
- && echo " done" || echo " FAILED"
- echo
-}
-
-stop_proxy()
-{
- echo
- if [ -f $proxy_pidfile ]; then
- pid=`cat $proxy_pidfile`
- kill $pid
- echo -n Stopping glite-lb-proxy \($pid\) ...
- try=0
- while ps p $pid >/dev/null 2>&1; do
- sleep 1;
- kill $pid 2>/dev/null
- try=`expr $try + 1`
- if [ $try = 20 ]; then
- echo " giving up after $try retries"
- return 1
- fi
- done
- echo " done"
- rm -f $proxy_pidfile
- rm -rf $GLITE_LB_EXPORT_JPREG_MAILDIR
- else
- echo $proxy_pidfile does not exist - glite-lb-proxy not running? >&2
- return 1
- fi
-}
-
-start_il()
-{
- [ -n "$GLITE_LB_IL_SOCK" ] && il_sock="-s $GLITE_LB_PROXY_SOCK" ||
- il_sock=""
-
- [ -n "$GLITE_LB_IL_PREFIX" ] && il_prefix="-f $GLITE_LB_IL_PREFIX" ||
- il_prefix=""
-
- echo -n Starting glite-lb-interlogger ...
- $GLITE_LOCATION/bin/glite-lb-interlogd \
- $creds $il_sock $il_prefix \
- && echo " done" || echo " FAILED"
- echo
-
-}
-
-stop_il()
-{
- killall glite-lb-interlogger
-}
-
-
-# - Test types -
-#
-# i) normally procesed by server & proxy
-# ii) server replies immedia success
-# iii) proxy replies immediate succes
-# a) current implementation
-# b) connection pool
-# c) parallel communication
-
-test_ai()
-{
- dest=
- [ -z "$1" ] && echo "test_ai() - wrong params" && return
- [ "$1" = "proxy" ] && dest="-x"
- [ "$1" = "server" ] && dest="-m $BKSERVER_HOST"
- [ -z "$dest" ] && echo "test_ai() - wrong params" && return
-
- my_echo "================================================================"
- my_echo "Testing LB $1 with sink_mode ${sink_mode[$2]}"
-
- # single registration
- #
- my_echo "-n single registration ..."
- ai_sr_lb=`$GLITE_LOCATION/sbin/glite-lb-perftest_jobreg $dest`
- mega_actions_per_day=`echo "scale=6; 86400/$ai_sr_lb/1000000" | bc`
- my_echo ". $ai_sr_lb seconds ($mega_actions_per_day GU)"
-
- # average single registration (100 samples)
- #
- my_echo "-n average single registration (100 samples) ..."
- ai_100sr_lb=`$GLITE_LOCATION/sbin/glite-lb-perftest_jobreg $dest -N 100`
- ai_avg_sr_lb=`echo "scale=6; $ai_100sr_lb/100" |bc`
- mega_actions_per_day=`echo "scale=6; 86400/$ai_avg_sr_lb/1000000" | bc`
- my_echo ". $ai_avg_sr_lb seconds ($mega_actions_per_day GU)"
-
- # 1000 nodes DAG registration
- #
- my_echo "-n 1000 nodes DAG registration ..."
- ai_dag1000_lb=`$GLITE_LOCATION/sbin/glite-lb-perftest_jobreg $dest -n 1000`
- mega_actions_per_day=`echo "scale=6; 86400/$ai_dag1000_lb/1000000*1001" | bc`
- my_echo ". $ai_dag1000_lb seconds ($mega_actions_per_day GU)"
-
- # 5000 nodes DAG registration
- #
- my_echo "-n 5000 nodes DAG registration ..."
- ai_dag5000_lb=`$GLITE_LOCATION/sbin/glite-lb-perftest_jobreg $dest -n 5000`
- mega_actions_per_day=`echo "scale=6; 86400/$ai_dag5000_lb/1000000*5001" | bc`
- my_echo ". $ai_dag5000_lb seconds ($mega_actions_per_day GU)"
-
- # 10000 nodes DAG registration
- #
- my_echo "-n 10000 nodes DAG registration ..."
- ai_dag10000_lb=`$GLITE_LOCATION/sbin/glite-lb-perftest_jobreg $dest -n 10000`
- mega_actions_per_day=`echo "scale=6; 86400/$ai_dag10000_lb/1000000*10001" | bc`
- my_echo ". $ai_dag10000_lb seconds ($mega_actions_per_day GU)"
-
-}
-
-quick_test()
-{
- dest=
- [ -z "$1" ] && echo "test_ai() - wrong params" && return
- [ "$1" = "proxy" ] && dest="-x"
- [ "$1" = "server" ] && dest="-m $BKSERVER_HOST"
- [ -z "$dest" ] && echo "test_ai() - wrong params" && return
-
-
- # 1000 nodes DAG registration
- #
- my_echo "-n 1000 nodes DAG registration ..."
- ai_dag1000_lb=`$GLITE_LOCATION/sbin/glite-lb-perftest_jobreg $dest -n 1000`
- mega_actions_per_day=`echo "scale=6; 86400/$ai_dag1000_lb/1000000*1001" | bc`
- my_echo ". $ai_dag1000_lb seconds ($mega_actions_per_day GU)"
-
-}
-
-proxy_test()
-{
- my_echo "----------------------------------------------------------------"
- my_echo "Scenarios:"
- my_echo "0) registration only to bkserver (edg_wll_RegisterJobSync)"
- my_echo "1) registration only to lbproxy (edg_wll_RegisterJobProxyOnly)"
- my_echo "2) old (not dual) registration (edg_wll_RegisterJobProxyOld)"
- my_echo "3) dual registration (edg_wll_RegisterJobProxy)"
- my_echo ""
-
- if [ -n "$1" ]; then
- repeat="-N $1"
- repeated="repeated $1 times"
- scale=$1
- else
- repeat=""
- repeated=""
- scale=1
- fi
-
- # single registration
- #
- for i in 0 1 2 3; do
- dest="-m $BKSERVER_HOST -x $i"
- my_echo "-n single registration $repeated (scenario $i)..."
- ai_sr_lb=`$GLITE_LOCATION/sbin/glite-lb-perftest_jobreg $dest $repeat`
- mega_actions_per_day=`echo "scale=6; 86400/$ai_sr_lb/1000000*$scale" | bc`
- my_echo ". $ai_sr_lb seconds ($mega_actions_per_day GU)"
- sleep 3
- sync
- sleep 3
- done
-
- # 1 node DAG registration
- #
- for i in 0 1 2 3; do
- dest="-m $BKSERVER_HOST -x $i"
- my_echo "-n 1 node DAG registration $repeated (scenario $i)..."
- ai_dag1_lb=`$GLITE_LOCATION/sbin/glite-lb-perftest_jobreg $dest $repeat -n 1`
- mega_actions_per_day=`echo "scale=6; 86400/$ai_dag1_lb/1000000*2*$scale" | bc`
- my_echo ". $ai_dag1_lb seconds ($mega_actions_per_day GU)"
- sleep 3
- sync
- sleep 3
- done
-
- # 1000 nodes DAG registration
- #
- for i in 0 1 2 3; do
- dest="-m $BKSERVER_HOST -x $i"
- my_echo "-n 1000 nodes DAG registration $repeated (scenario $i)..."
- ai_dag1000_lb=`$GLITE_LOCATION/sbin/glite-lb-perftest_jobreg $dest $repeat -n 1000`
- mega_actions_per_day=`echo "scale=6; 86400/$ai_dag1000_lb/1000000*1001*$scale" | bc`
- my_echo ". $ai_dag1000_lb seconds ($mega_actions_per_day GU)"
- sleep 10
- sync
- sleep 10
- done
-
- # 10000 nodes DAG registration
- #
- for i in 0 1 2 3; do
- dest="-m $BKSERVER_HOST -x $i"
- my_echo "-n 10000 nodes DAG registration $repeated (scenario $i)..."
- ai_dag10000_lb=`$GLITE_LOCATION/sbin/glite-lb-perftest_jobreg $dest $repeat -n 10000`
- mega_actions_per_day=`echo "scale=6; 86400/$ai_dag10000_lb/1000000*10001*$scale" | bc`
- my_echo ". $ai_dag10000_lb seconds ($mega_actions_per_day GU)"
- sleep 10
- sync
- sleep 10
- done
-
-
-}
-
-
-################################################################################
-
-unset creds port
-if [ -z ${BKSERVER_HOST} ]; then
- HOST=`hostname -f`
- PORT=${GLITE_LB_SERVER_PORT:-9000};
- BKSERVER_HOST=$HOST:$PORT
-fi
-sink_mode[0]=GLITE_LB_SINK_NONE
-sink_mode[1]=GLITE_LB_SINK_PARSE
-sink_mode[2]=GLITE_LB_SINK_STORE
-sink_mode[3]=GLITE_LB_SINK_STATE
-sink_mode[4]=GLITE_LB_SINK_SEND
-
-test_glite_location;
-test_credentials;
-
-#
-# QUICK TEST
-#
-#start_bkserver 0;
-#start_proxy 0;
-#my_echo "================================================================"
-#my_echo "Testing LB server with sink_mode ${sink_mode[0]}"
-#my_echo "Testing LB proxy with sink_mode ${sink_mode[0]}"
-#sleep 5
-#sync
-#sleep 5
-#for i in `seq 1 10000`; do
-# quick_test server 0;
-## quick_test proxy 0;
-#done
-#stop_bkserver;
-#stop_proxy;
-
-#
-# SINK TEST
-#
-#for i in 1 2 3 4; do
-# my_echo "================================================================"
-#
-# my_echo "Testing LB proxy with sink_mode ${sink_mode[$i]}"
-# start_proxy $i
-# test_ai proxy $i;
-# stop_proxy
-#
-# my_echo "Testing LB server with sink_mode ${sink_mode[$i]}"
-# start_bkserver $i;
-# test_ai server $i;
-# stop_bkserver;
-#done
-
-#
-# PROXY TEST
-#
-#start_proxy 0;
-#start_il;
-my_echo "================================================================"
-my_echo "Testing registrations to bkserver ($BKSERVER_HOST) and to lbproxy"
-#sleep 5
-for i in 1 10 100 1000; do
- proxy_test $i;
-done
-#stop_proxy;
-#stop_il;
-
-echo "__________"
-echo "GU (goal units) are millons of registrations per day, where registration is"
-echo "registration of job or subjob by client or server"
-echo
+++ /dev/null
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <getopt.h>
-#include <time.h>
-#include "glite/lb/context-int.h"
-#include "glite/lb/lb_perftest.h"
-#include "glite/lb/log_proto.h"
-
-extern int edg_wll_DoLogEvent(edg_wll_Context context, edg_wll_LogLine logline);
-extern int edg_wll_DoLogEventProxy(edg_wll_Context context, edg_wll_LogLine logline);
-extern int edg_wll_DoLogEventDirect(edg_wll_Context context, edg_wll_LogLine logline);
-
-#define DEFAULT_SOCKET "/tmp/interlogger.sock"
-#define DEFAULT_PREFIX EDG_WLL_LOG_PREFIX_DEFAULT
-
-/*
-extern char *optarg;
-extern int opterr,optind;
-
-Vzorem by mel byt examples/stresslog.c, ovsem s mirnymi upravami:
-
-1) nacte udalosti jednoho jobu z daneho souboru, rozparsuje a ulozi do pameti
-2) je-li pozadan, zaregistruje dany pocet jobid
-3) vypise timestamp
-4) odesle rozparsovane udalosti pod ruznymi jobid (tolika, kolik ma
- byt jobu - argument) na dany cil (localloger, interlogger, bkserver, proxy)
-5) odesle specialni ukoncovaci udalost
-6) exit
-
- read_job("small_job",&event_lines);
- gettimeoday(&zacatek)
- for (i=0; i<1000; i++) {
- for (e=0; event_lines[e]; e++)
- edg_wll_ParseEvent(event_lines[e],&event[e]);
- }
- gettimeofday(&konec);
-
- printf("parsovani",konec-zacatek/1000);
-
- gettimeofday(&zacatek);
- switch (event[e].type) {
- ...
- edg_wll_LogBlaBla()
-
-
-*/
-
-static struct option const long_options[] = {
- { "help", no_argument, 0, 'h' },
- { "dst", required_argument, NULL, 'd' },
- { "test", required_argument, NULL, 't' },
- { "file", required_argument, NULL, 'f'},
- { "num", required_argument, NULL, 'n'},
- { "machine", required_argument, NULL, 'm'},
- { "nofile", no_argument, NULL, 'N'},
- { "skip", optional_argument, NULL, 'P'},
- { "sock", required_argument, NULL, 's'},
- { "file-prefix", required_argument, NULL, 'p'},
- { NULL, 0, NULL, 0}
-};
-
-
-int nofile = 0;
-char *logfile_prefix = DEFAULT_PREFIX;
-char *il_socket = NULL;
-
-void
-usage(char *program_name)
-{
- fprintf(stderr, "Usage: %s [-d destname] [-t testname] -f filename -n numjobs \n"
- "-h, --help display this help and exit\n"
- "-d, --dst <destname> destination component\n"
- "-s, --sock <sockname> socket name for IL\n"
- "-m, --machine <hostname> destination host\n"
- "-t, --test <testname> name of the test\n"
- "-f, --file <filename> name of the file with prototyped job events\n"
- "-n, --num <numjobs> number of jobs to generate\n"
- "-P, --skip [<numevents>] number of events to skip when sending to IL by IPC\n"
- "-p, --file-prefix <name> file prefix of event files\n"
- "-N, --nofile do not store events in file for interlogger (if dst==IL)\n",
- program_name);
-}
-
-
-#define FCNTL_ATTEMPTS 5
-#define FCNTL_TIMEOUT 1
-
-int edg_wll_DoLogEventIl(
- edg_wll_Context context,
- edg_wll_LogLine logline,
- const char *jobid,
- int len,
- int skip)
-{
- static long filepos = 0;
- int ret = 0;
- edg_wlc_JobId jid;
- char *unique, *event_file;
- static int num_event = 0;
- char *event;
- const char *user = " DG.USER=\"michal\"\n";
-
- /* we must fill in DG.USER */
- /* we need room for user (=strlen(user)), terminating \0 (+1),
- but we overwrite trailing \n (-1) */
- event = realloc(logline, len + strlen(user));
- if(event == NULL) {
- return(edg_wll_SetError(context, ENOMEM, "realloc()"));
- }
- /* it really does not matter WHERE the key is, so append it at the end */
- memmove(event + len - 1, user, strlen(user) + 1);
- len += strlen(user) - 1;
-
- if(!nofile) {
- ret = edg_wlc_JobIdParse(jobid, &jid);
- if(ret != 0)
- return(edg_wll_SetError(context, ret, "edg_wlc_JobIdParse()"));
- unique = edg_wlc_JobIdGetUnique(jid);
- if(unique == NULL) {
- edg_wlc_JobIdFree(jid);
- return(edg_wll_SetError(context, ENOMEM, "edg_wlc_JobIdGetUnique()"));
- }
- asprintf(&event_file, "%s.%s", logfile_prefix, unique);
- if(!event_file) {
- free(unique);
- edg_wlc_JobIdFree(jid);
- return(edg_wll_SetError(context, ENOMEM, "asprintf()"));
- }
- if(edg_wll_log_event_write(context, event_file, event,
- context->p_tmp_timeout.tv_sec > FCNTL_ATTEMPTS ? context->p_tmp_timeout.tv_sec : FCNTL_ATTEMPTS,
- FCNTL_TIMEOUT,
- &filepos)) {
- edg_wll_UpdateError(context, 0, "edg_wll_log_event_write()");
- free(unique);
- edg_wlc_JobIdFree(jid);
- free(event_file);
- }
- }
- if(nofile ||
- (skip < 0) ||
- ((skip > 0) && (++num_event % skip == 0)))
- ret = edg_wll_log_event_send(context, il_socket, filepos,
- event, len, 1,
- &context->p_tmp_timeout);
- if(!nofile) {
- free(unique);
- edg_wlc_JobIdFree(jid);
- free(event_file);
- } else {
- filepos += len;
- }
-
- return(ret);
-}
-
-
-int
-main(int argc, char *argv[])
-{
-
- char *destname= NULL,*hostname=NULL,*testname = NULL,*filename = NULL;
- char *event;
- int num_jobs = 1;
- int opt;
- int skip = -1;
- edg_wll_Context ctx;
- enum {
- DEST_UNDEF = 0,
- DEST_LL,
- DEST_IL,
- DEST_PROXY,
- DEST_BKSERVER
- } dest = 0;
-
-
- edg_wll_InitContext(&ctx);
-
- opterr = 0;
-
- while ((opt = getopt_long(argc,argv,"hd:t:f:m:n:Ns:P::p:",
- long_options, (int *) 0)) != EOF) {
-
- switch (opt) {
- case 'd': destname = (char *) strdup(optarg); break;
- case 't': testname = (char *) strdup(optarg); break;
- case 'f': filename = (char *) strdup(optarg); break;
- case 'm': hostname = (char *) strdup(optarg); break;
- case 'p': logfile_prefix = (char*) strdup(optarg); break;
- case 's': il_socket = (char*) strdup(optarg); break;
- case 'n': num_jobs = atoi(optarg); break;
- case 'N': nofile = 1; break;
- case 'P': skip = optarg ? atoi(optarg) : 0; break;
- case 'h':
- default:
- usage(argv[0]); exit(0);
- }
- }
-
- if(destname) {
- if(!strncasecmp(destname, "pr", 2))
- dest=DEST_PROXY;
- else if(!strncasecmp(destname, "lo", 2) || !strncasecmp(destname, "ll", 2))
- dest=DEST_LL;
- else if(!strncasecmp(destname, "in", 2) || !strncasecmp(destname, "il", 2))
- dest=DEST_IL;
- else if(!strncasecmp(destname, "bk", 2) || !strncasecmp(destname, "se", 2))
- dest=DEST_BKSERVER;
- else {
- fprintf(stderr,"%s: wrong destination\n",argv[0]);
- usage(argv[0]);
- exit(1);
- }
- }
-
- if((dest == DEST_IL) && (il_socket == NULL))
- il_socket = DEFAULT_SOCKET;
- if((dest == DEST_PROXY) && il_socket) {
- char store_sock[256], serve_sock[256];
- sprintf(store_sock, "%s%s", il_socket, "store.sock");
- sprintf(serve_sock, "%s%s", il_socket, "serve.sock");
- edg_wll_SetParam(ctx, EDG_WLL_PARAM_LBPROXY_STORE_SOCK, store_sock);
- edg_wll_SetParam(ctx, EDG_WLL_PARAM_LBPROXY_SERVE_SOCK, serve_sock);
- }
-
- if (num_jobs <= 0) {
- fprintf(stderr,"%s: wrong number of jobs\n",argv[0]);
- usage(argv[0]);
- exit(1);
- }
-
- if (!filename && destname) {
- fprintf(stderr,"%s: -f required\n",argv[0]);
- usage(argv[0]);
- exit(1);
- }
-
- if (glite_wll_perftest_init(hostname, NULL, testname, filename, num_jobs) < 0) {
- fprintf(stderr,"%s: glite_wll_perftest_init failed\n",argv[0]);
- exit(1);
- }
-
- if(dest) {
- char *jobid;
- int len;
- while ((len=glite_wll_perftest_produceEventString(&event, &jobid)) > 0) {
- switch(dest) {
- case DEST_PROXY:
- ctx->p_tmp_timeout = ctx->p_sync_timeout;
- if (edg_wll_DoLogEventProxy(ctx,event)) {
- char *et,*ed;
- edg_wll_Error(ctx,&et,&ed);
- fprintf(stderr,"edg_wll_DoLogEventProxy(): %s (%s)\n",et,ed);
- exit(1);
- }
- break;
-
- case DEST_LL:
- ctx->p_tmp_timeout = ctx->p_log_timeout;
- if (edg_wll_DoLogEvent(ctx,event)) {
- char *et,*ed;
- edg_wll_Error(ctx,&et,&ed);
- fprintf(stderr,"edg_wll_DoLogEvent(): %s (%s)\n",et,ed);
- exit(1);
- }
- break;
-
- case DEST_BKSERVER:
- ctx->p_tmp_timeout = ctx->p_log_timeout;
- edg_wlc_JobIdParse(jobid, &ctx->p_jobid);
- if (edg_wll_DoLogEventDirect(ctx, event)) {
- char *et,*ed;
- edg_wll_Error(ctx,&et,&ed);
- fprintf(stderr,"edg_wll_DoLogEventDirect(): %s (%s)\n",et,ed);
- exit(1);
- }
- break;
-
- case DEST_IL:
- ctx->p_tmp_timeout = ctx->p_log_timeout;
- if (edg_wll_DoLogEventIl(ctx, event, jobid, len, skip)) {
- char *et,*ed;
- edg_wll_Error(ctx,&et,&ed);
- fprintf(stderr,"edg_wll_DoLogEventIl(): %s (%s)\n",et,ed);
- exit(1);
- }
- break;
-
- default:
- break;
- }
- free(event);
- }
- } else {
- /* no destination - only print jobid's that would be used */
- char *jobid;
-
- while(jobid = glite_wll_perftest_produceJobId()) {
- fprintf(stdout, "%s\n", jobid);
- }
- }
- edg_wll_FreeContext(ctx);
- return 0;
-
-}
+++ /dev/null
-#!/bin/sh
-
-clients=${1:-3}
-
-jobs=${2:-/tmp/perftest_10.jobids}
-
-# XXX - there must be better way to find stage
-if [ -z "${GLITE_LOCATION}" ]; then
- STAGEDIR=/home/michal/shared/egee/jra1-head/stage
-else
- STAGEDIR=${GLITE_LOCATION}
-fi
-JOBSTAT=$STAGEDIR/examples/glite-lb-job_status
-
-ask() {
- $JOBSTAT `cat $jobs`
-}
-
-do_ask() {
- while (true)
- do
- ask
- sleep `expr 5 \* $RANDOM / 32767`
- done
-}
-
-for i in `seq 1 $clients`
-do
- do_ask &
-done
-
+++ /dev/null
-#ident "$Header$"
-
-#include <sys/types.h>
-#include <sys/un.h>
-#include <unistd.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <netinet/in.h>
-#include <string.h>
-
-#include "glite/lb/producer.h"
-#include "glite/lb/lb_plain_io.h"
-#include "glite/lb/il_msg.h"
-#include "glite/lb/il_string.h"
-#include "glite/lb/connpool.h"
-
-#include "prod_proto.h"
-#include "connection.h"
-
-static const char* socket_path="/tmp/lb_proxy_store.sock";
-
-/**
- *----------------------------------------------------------------------
- * Handle GSS failures on the client side
- *----------------------------------------------------------------------
- */
-static
-int handle_gss_failures(edg_wll_Context ctx, int code, edg_wll_GssStatus *gss_code, const char *text)
-{
- static char err[256];
- int myerrno, ret;
-
- myerrno = errno;
- ret = 0;
-
- edg_wll_ResetError(ctx);
-
- if(code>0)
- return(0);
-
- switch(code) {
- case EDG_WLL_GSS_ERROR_EOF:
- snprintf(err, sizeof(err), "%s;; GSS Error: EOF occured;", text);
- ret = edg_wll_SetError(ctx,ENOTCONN,err);
- break;
- case EDG_WLL_GSS_ERROR_TIMEOUT:
- snprintf(err, sizeof(err), "%s;; GSS Error: timeout expired;", text);
- ret = edg_wll_SetError(ctx,ENOTCONN,err);
- break;
- case EDG_WLL_GSS_ERROR_ERRNO:
- {
- const char *msg1;
- char *msg2;
- msg1 = strerror(myerrno);
- asprintf(&msg2, "%s;; System Error: %s", text, msg1);
- ret = edg_wll_SetError(ctx,ENOTCONN,msg2);
- free(msg2);
- }
- break;
- case EDG_WLL_GSS_ERROR_GSS:
- snprintf(err, sizeof(err), "%s;; GSS Error: GSS failure occured", text);
- ret = edg_wll_SetErrorGss(ctx,err,gss_code);
- break;
- case EDG_WLL_GSS_ERROR_HERRNO:
- {
- const char *msg1;
- char *msg2;
- msg1 = hstrerror(myerrno);
- asprintf(&msg2, "%s;; GSS Error: %s", text, msg1);
- ret = edg_wll_SetError(ctx,EDG_WLL_ERROR_DNS, msg2);
- free(msg2);
- }
- break;
- default:
- snprintf(err, sizeof(err), "%s;; GSS Error: unknown failure", text);
- ret = edg_wll_SetError(ctx,ECONNREFUSED,err);
- break;
- }
- return ret;
-}
-
-#if 0 /* unused */
-/**
- *----------------------------------------------------------------------
- * Handle UNIX socket failures on the client side
- *----------------------------------------------------------------------
- */
-static
-int edg_wll_log_proto_handle_plain_failures(edg_wll_Context ctx, int code, const char *text)
-{
- return 0;
-}
-#endif
-
-/*
- *----------------------------------------------------------------------
- * get_reply_plain, get_reply_gss - read reply from server
- *
- * Returns: -1 - error reading message,
- * code > 0 - error code from server
- *----------------------------------------------------------------------
- */
-struct reader_data {
- edg_wll_Context ctx;
- void *conn;
-};
-
-static
-int plain_reader(void *user_data, char *buffer, int max_len)
-{
- struct reader_data *data = (struct reader_data *)user_data;
- int len;
-
- len = edg_wll_plain_read_full(data->conn, buffer, max_len, &data->ctx->p_tmp_timeout);
- if(len < 0) {
- edg_wll_SetError(data->ctx, errno, "edg_wll_plain_read_full()");
- edg_wll_UpdateError(data->ctx, EDG_WLL_IL_PROTO, "plain_reader(): error reading message data");
- }
-
- return(len);
-}
-
-static
-int get_reply_plain(edg_wll_Context ctx, edg_wll_PlainConnection *conn, char **buf, int *code_maj, int *code_min)
-{
- char *msg=NULL;
- int len;
- struct reader_data data;
-
- data.ctx = ctx;
- data.conn = conn;
- len = read_il_data(&data, &msg, plain_reader);
- if(len < 0) {
- edg_wll_SetError(ctx, EDG_WLL_IL_PROTO, "get_reply_plain(): error reading message");
- goto get_reply_plain_end;
- }
-
- if(decode_il_reply(code_maj, code_min, buf, msg) < 0) {
- edg_wll_SetError(ctx, EDG_WLL_IL_PROTO, "get_reply_plain(): error decoding message");
- goto get_reply_plain_end;
- }
-
-get_reply_plain_end:
- if(msg) free(msg);
- return edg_wll_Error(ctx,NULL,NULL);
-}
-
-
-static
-int gss_reader(void *user_data, char *buffer, int max_len)
-{
- struct reader_data *data = (struct reader_data *)user_data;
- int ret;
- size_t len;
- edg_wll_GssStatus gss_code;
-
- ret = edg_wll_gss_read_full(data->conn, buffer, max_len, &data->ctx->p_tmp_timeout,
- &len, &gss_code);
- if(ret < 0) {
- handle_gss_failures(data->ctx, ret, &gss_code, "edg_wll_gss_read_full");
- edg_wll_UpdateError(data->ctx, EDG_WLL_IL_PROTO, "gss_reader(): error reading message");
- }
-
- return(ret);
-}
-
-
-static
-int get_reply_gss(edg_wll_Context ctx, edg_wll_GssConnection *conn, char **buf, int *code_maj, int *code_min)
-{
- char *msg = NULL;
- int code;
- struct reader_data data;
-
- data.ctx = ctx;
- data.conn = conn;
- code = read_il_data(&data, &msg, gss_reader);
- if(code < 0) {
- edg_wll_UpdateError(ctx, EDG_WLL_IL_PROTO, "get_reply_gss(): error reading reply");
- goto get_reply_gss_end;
- }
-
- if(decode_il_reply(code_maj, code_min, buf, msg) < 0) {
- char *et;
- asprintf(&et,"get_reply_gss(): error decoding reply \"%s\"", msg);
- edg_wll_UpdateError(ctx, EDG_WLL_IL_PROTO, et);
- if (et) free(et);
- goto get_reply_gss_end;
- }
-
-get_reply_gss_end:
- if(msg) free(msg);
- return edg_wll_Error(ctx,NULL,NULL);
-}
-
-/**
- *----------------------------------------------------------------------
- * connect to locallogger
- *----------------------------------------------------------------------
- */
-int edg_wll_log_connect(edg_wll_Context ctx, int *conn)
-{
- int ret, answer=0, index;
- char *my_subject_name = NULL;
- edg_wll_GssStatus gss_stat;
-
- edg_wll_ResetError(ctx);
- edg_wll_poolLock();
-
-#ifdef EDG_WLL_LOG_STUB
- fprintf(stderr,"edg_wll_log_connect: setting connection to local-logger %s:%d (remaining timeout %d.%06d sec)\n",
- ctx->p_destination,ctx->p_dest_port,
- (int) ctx->p_tmp_timeout.tv_sec, (int) ctx->p_tmp_timeout.tv_usec);
-#endif
- /* check if connection already in pool */
- if ( (index = ConnectionIndex(ctx, ctx->p_destination, ctx->p_dest_port)) == -1 ) {
- if (ctx->connections->connOpened == ctx->connections->poolSize)
- if (ReleaseConnection(ctx, NULL, 0))
- goto edg_wll_log_connect_end;
- index = AddConnection(ctx, ctx->p_destination, ctx->p_dest_port);
- if (index < 0) {
- edg_wll_SetError(ctx,EAGAIN,"connection pool size exceeded");
- goto edg_wll_log_connect_end;
- }
-#ifdef EDG_WLL_LOG_STUB
- fprintf(stderr,"edg_wll_log_connect: connection to local-logger %s:%d added as No. %d in the pool\n",
- ctx->connections->connPool[index].peerName,
- ctx->connections->connPool[index].peerPort,index);
-#endif
- }
-#ifdef EDG_WLL_LOG_STUB
- else fprintf(stderr,"edg_wll_log_connect: connection to %s:%d exists (No. %d in the pool) - reusing\n",
- ctx->connections->connPool[index].peerName,
- ctx->connections->connPool[index].peerPort,index);
-#endif
-
-#if 0
- /* acquire gss credentials */
- ret = edg_wll_gss_acquire_cred_gsi(
- ctx->p_proxy_filename ? ctx->p_proxy_filename : ctx->p_cert_filename,
- ctx->p_proxy_filename ? ctx->p_proxy_filename : ctx->p_key_filename,
- &ctx->connections->connPool[index].gsiCred, &my_subject_name, &gss_stat);
- /* give up if unable to acquire prescribed credentials, otherwise go on anonymously */
- if (ret && ctx->p_proxy_filename) {
- edg_wll_SetErrorGss(ctx, "edg_wll_gss_acquire_cred_gsi(): failed to load GSI credentials", &gss_stat);
- goto edg_wll_log_connect_err;
- }
-#ifdef EDG_WLL_LOG_STUB
- if (my_subject_name != NULL) {
- fprintf(stderr,"edg_wll_log_connect: using certificate: %s\n",my_subject_name);
- } else {
- fprintf(stderr,"edg_wll_log_connect: going on anonymously!\n");
- }
-#endif
-#endif
-#ifdef EDG_WLL_LOG_STUB
- fprintf(stderr,"edg_wll_log_connect: opening connection to local-logger %s:%d\n",
- ctx->connections->connPool[index].peerName,
- ctx->connections->connPool[index].peerPort);
-#endif
- /* gss_connect */
- if (ctx->connections->connPool[index].gss.context == GSS_C_NO_CONTEXT) {
-
- /* acquire gss credentials */
- ret = edg_wll_gss_acquire_cred_gsi(
- ctx->p_proxy_filename ? ctx->p_proxy_filename : ctx->p_cert_filename,
- ctx->p_proxy_filename ? ctx->p_proxy_filename : ctx->p_key_filename,
- &ctx->connections->connPool[index].gsiCred, &my_subject_name, &gss_stat);
- /* give up if unable to acquire prescribed credentials, otherwise go on anonymously */
- if (ret && ctx->p_proxy_filename) {
- edg_wll_SetErrorGss(ctx, "edg_wll_gss_acquire_cred_gsi(): failed to load GSI credentials", &gss_stat);
- goto edg_wll_log_connect_err;
- }
-#ifdef EDG_WLL_LOG_STUB
- if (my_subject_name != NULL) {
- fprintf(stderr,"edg_wll_log_connect: using certificate: %s\n",my_subject_name);
- } else {
- fprintf(stderr,"edg_wll_log_connect: going on anonymously!\n");
- }
-#endif
- if ((answer = edg_wll_gss_connect(
- ctx->connections->connPool[index].gsiCred,
- ctx->connections->connPool[index].peerName,
- ctx->connections->connPool[index].peerPort,
- &ctx->p_tmp_timeout,
- &ctx->connections->connPool[index].gss,
- &gss_stat)) < 0) {
- answer = handle_gss_failures(ctx,answer,&gss_stat,"edg_wll_gss_connect()");
- goto edg_wll_log_connect_err;
- }
- goto edg_wll_log_connect_end;
- } else goto edg_wll_log_connect_end;
-
-edg_wll_log_connect_err:
- if (index >= 0) CloseConnection(ctx, &index);
- index = -1;
-
-edg_wll_log_connect_end:
- if (index >= 0) edg_wll_connectionTryLock(ctx, index);
- if (my_subject_name) free(my_subject_name);
-
- edg_wll_poolUnlock();
-
-#ifdef EDG_WLL_LOG_STUB
- if (answer) {
- fprintf(stderr,"edg_wll_log_connect: error (remaining timeout %d.%06d sec)\n",
- (int) ctx->p_tmp_timeout.tv_sec, (int) ctx->p_tmp_timeout.tv_usec);
- } else {
- fprintf(stderr,"edg_wll_log_connect: done o.k. (remaining timeout %d.%06d sec)\n",
- (int) ctx->p_tmp_timeout.tv_sec, (int) ctx->p_tmp_timeout.tv_usec);
- }
-#endif
- *conn = index;
- return answer;
-}
-
-/**
- *----------------------------------------------------------------------
- * close connection to locallogger
- *----------------------------------------------------------------------
- */
-int edg_wll_log_close(edg_wll_Context ctx, int conn)
-{
- int ret = 0;
-
- if (conn == -1) return 0;
- ret = CloseConnection(ctx,&conn);
- edg_wll_connectionUnlock(ctx,conn);
- return ret;
-}
-
-/**
- *----------------------------------------------------------------------
- * write/send to locallogger
- *----------------------------------------------------------------------
- */
-int edg_wll_log_write(edg_wll_Context ctx, int conn, edg_wll_LogLine logline)
-{
- char header[EDG_WLL_LOG_SOCKET_HEADER_LENGTH+1];
- int err;
- int answer;
- size_t count,sent;
- int size;
- u_int8_t size_end[4];
- edg_wll_GssStatus gss_code;
-
- errno = err = answer = count = sent = 0;
- size = strlen(logline)+1;
- size_end[0] = size & 0xff; size >>= 8;
- size_end[1] = size & 0xff; size >>= 8;
- size_end[2] = size & 0xff; size >>= 8;
- size_end[3] = size;
- size = strlen(logline)+1;
-
- edg_wll_ResetError(ctx);
-
-#ifdef EDG_WLL_LOG_STUB
- fprintf(stderr,"edg_wll_log_write: sending header\n");
-#endif
- sprintf(header,"%s",EDG_WLL_LOG_SOCKET_HEADER);
- header[EDG_WLL_LOG_SOCKET_HEADER_LENGTH]='\0';
- if ((err = edg_wll_gss_write_full(&ctx->connections->connPool[conn].gss, header, EDG_WLL_LOG_SOCKET_HEADER_LENGTH, &ctx->p_tmp_timeout, &count, &gss_code)) < 0) {
- answer = handle_gss_failures(ctx,err,&gss_code,"edg_wll_gss_write_full()");
- edg_wll_UpdateError(ctx,answer,"edg_wll_log_write(): error sending header");
- return -1;
- }
- sent += count;
-
-#ifdef EDG_WLL_LOG_STUB
- fprintf(stderr,"edg_wll_log_write: sending message size\n");
-#endif
- count = 0;
- if ((err = edg_wll_gss_write_full(&ctx->connections->connPool[conn].gss, size_end, 4, &ctx->p_tmp_timeout, &count, &gss_code)) < 0) {
- answer = handle_gss_failures(ctx,err,&gss_code,"edg_wll_gss_write_full()");
- edg_wll_UpdateError(ctx,answer,"edg_wll_log_write(): error sending message size");
- return -1;
- }
- sent += count;
-
-#ifdef EDG_WLL_LOG_STUB
- fprintf(stderr,"edg_wll_log_write: sending message...\n");
-#endif
- count = 0;
- if (( err = edg_wll_gss_write_full(&ctx->connections->connPool[conn].gss, logline, size, &ctx->p_tmp_timeout, &count, &gss_code)) < 0) {
- answer = handle_gss_failures(ctx,err,&gss_code,"edg_wll_gss_write_full()");
- edg_wll_UpdateError(ctx,answer,"edg_wll_log_write(): error sending message");
- return -1;
- }
- sent += count;
-
-#ifdef EDG_WLL_LOG_STUB
- fprintf(stderr,"edg_wll_log_write: done (remaining timeout %d.%06d sec)\n",
- (int) ctx->p_tmp_timeout.tv_sec, (int) ctx->p_tmp_timeout.tv_usec);
-#endif
- return sent;
-}
-
-/**
- *----------------------------------------------------------------------
- * read/receive from locallogger
- *----------------------------------------------------------------------
- */
-int edg_wll_log_read(edg_wll_Context ctx, int conn)
-{
- int err;
- int answer;
- u_int8_t answer_end[4];
- size_t count;
- edg_wll_GssStatus gss_code;
-
- errno = err = answer = count = 0;
-
- edg_wll_ResetError(ctx);
-
-#ifdef EDG_WLL_LOG_STUB
- fprintf(stderr,"edg_wll_log_read: reading answer from local-logger\n");
-#endif
- count = 0;
- if ((err = edg_wll_gss_read_full(&ctx->connections->connPool[conn].gss, answer_end, 4, &ctx->p_tmp_timeout, &count, &gss_code)) < 0 ) {
- answer = handle_gss_failures(ctx,err,&gss_code,"edg_wll_gss_read_full()");
- edg_wll_UpdateError(ctx,answer,"edg_wll_log_read(): error reading answer from local-logger");
- return -1;
- } else {
- answer = answer_end[3]; answer <<=8;
- answer |= answer_end[2]; answer <<=8;
- answer |= answer_end[1]; answer <<=8;
- answer |= answer_end[0];
-#ifdef EDG_WLL_LOG_STUB
- fprintf(stderr,"edg_wll_log_read: read answer \"%d\"\n",answer);
-#endif
- edg_wll_SetError(ctx,answer,"edg_wll_log_read(): answer read from locallogger");
- }
-
-#ifdef EDG_WLL_LOG_STUB
- fprintf(stderr,"edg_wll_log_read: done (remaining timeout %d.%06d sec)\n",
- (int) ctx->p_tmp_timeout.tv_sec, (int) ctx->p_tmp_timeout.tv_usec);
-#endif
- return count;
-}
-
-
-/**
- *----------------------------------------------------------------------
- * connect to lbproxy
- *----------------------------------------------------------------------
- */
-int edg_wll_log_proxy_connect(edg_wll_Context ctx, edg_wll_PlainConnection *conn)
-{
- int answer = 0, retries;
- int flags;
- struct sockaddr_un saddr;
-
- edg_wll_ResetError(ctx);
-
-#ifdef EDG_WLL_LOG_STUB
- fprintf(stderr,"edg_wll_log_proxy_connect: setting connection to lbroxy (remaining timeout %d.%06d sec)\n",
- (int) ctx->p_tmp_timeout.tv_sec, (int) ctx->p_tmp_timeout.tv_usec);
-#endif
- conn->sock = socket(PF_UNIX, SOCK_STREAM, 0);
- if (conn->sock < 0) {
- edg_wll_SetError(ctx,answer = errno,"edg_wll_log_proxy_connect(): socket() error");
- goto edg_wll_log_proxy_connect_end;
- }
- memset(&saddr, 0, sizeof(saddr));
- saddr.sun_family = AF_UNIX;
- strcpy(saddr.sun_path, ctx->p_lbproxy_store_sock?
- ctx->p_lbproxy_store_sock: socket_path);
- if ((flags = fcntl(conn->sock, F_GETFL, 0)) < 0 || fcntl(conn->sock, F_SETFL, flags | O_NONBLOCK) < 0) {
- edg_wll_SetError(ctx,answer = errno,"edg_wll_log_proxy_connect(): fcntl() error");
- close(conn->sock); conn->sock = -1;
- goto edg_wll_log_proxy_connect_end;
- }
-#ifdef EDG_WLL_LOG_STUB
- fprintf(stderr,"edg_wll_log_proxy_connect: opening connection to lbproxy (socket '%s')\n",
- ctx->p_lbproxy_store_sock? ctx->p_lbproxy_store_sock: socket_path);
-#endif
- retries = 0;
- while ((answer = connect(conn->sock, (struct sockaddr *)&saddr, sizeof(saddr))) < 0 &&
- errno == EAGAIN &&
- ctx->p_tmp_timeout.tv_sec >= 0 && ctx->p_tmp_timeout.tv_usec >= 0 &&
- !(ctx->p_tmp_timeout.tv_sec == 0 && ctx->p_tmp_timeout.tv_usec == 0)
- )
- {
- struct timespec ns = { 0, PROXY_CONNECT_RETRY * 1000000 /* 10 ms */ },rem;
-
- nanosleep(&ns,&rem);
-
- ctx->p_tmp_timeout.tv_usec -= ns.tv_nsec/1000;
- ctx->p_tmp_timeout.tv_usec += rem.tv_nsec/1000;
-
- ctx->p_tmp_timeout.tv_sec -= ns.tv_sec;
- ctx->p_tmp_timeout.tv_sec += rem.tv_sec;
-
- if (ctx->p_tmp_timeout.tv_usec < 0) {
- ctx->p_tmp_timeout.tv_usec += 1000000;
- ctx->p_tmp_timeout.tv_sec--;
- }
- retries++;
- }
-
- if (answer) {
- edg_wll_SetError(ctx,answer = (errno == EAGAIN ? ETIMEDOUT : errno),"edg_wll_log_proxy_connect()");
- close(conn->sock); conn->sock = -1;
- }
-
-#ifdef EDG_WLL_LOG_STUB
- if (retries) fprintf(stderr,"edg_wll_log_proxy_connect: there were %d connect retries\n",retries);
-#endif
-
-edg_wll_log_proxy_connect_end:
-#ifdef EDG_WLL_LOG_STUB
- fprintf(stderr,"edg_wll_log_proxy_connect: done (remaining timeout %d.%06d sec)\n",
- (int) ctx->p_tmp_timeout.tv_sec, (int) ctx->p_tmp_timeout.tv_usec);
-#endif
- return answer;
-}
-
-/**
- *----------------------------------------------------------------------
- * close connection to lbproxy
- *----------------------------------------------------------------------
- */
-int edg_wll_log_proxy_close(edg_wll_Context ctx, edg_wll_PlainConnection *conn)
-{
- return edg_wll_plain_close(conn);
-}
-
-/**
- *----------------------------------------------------------------------
- * write/send to lbproxy
- *----------------------------------------------------------------------
- */
-int edg_wll_log_proxy_write(edg_wll_Context ctx, edg_wll_PlainConnection *conn, edg_wll_LogLine logline)
-{
- int len,count = 0;
- char *buffer;
-
- edg_wll_ResetError(ctx);
-
-#ifdef EDG_WLL_LOG_STUB
- fprintf(stderr,"edg_wll_log_proxy_write: encoding message\n");
-#endif
- {
- il_octet_string_t ll;
-
- ll.len = strlen(logline);
- ll.data = logline;
- len = encode_il_msg(&buffer, &ll);
- }
- if(len < 0) {
- edg_wll_SetError(ctx,errno,"encode_il_msg()");
- edg_wll_UpdateError(ctx,ENOMEM,"edg_wll_log_proto_client_proxy(): error encoding message");
- return -1;
- }
-
-#ifdef EDG_WLL_LOG_STUB
- fprintf(stderr,"edg_wll_log_proxy_write: sending message\n");
-#endif
- if ((count = edg_wll_plain_write_full(conn, buffer, len, &ctx->p_tmp_timeout)) < 0) {
- edg_wll_SetError(ctx, errno, "edg_wll_plain_write_full()");
- edg_wll_UpdateError(ctx, EDG_WLL_IL_PROTO,"edg_wll_log_proto_client_proxy(): error sending message to socket");
- return -1;
- }
-
- if (buffer) free(buffer);
-
-#ifdef EDG_WLL_LOG_STUB
- fprintf(stderr,"edg_wll_log_proxy_write: done (remaining timeout %d.%06d sec)\n",
- (int) ctx->p_tmp_timeout.tv_sec, (int) ctx->p_tmp_timeout.tv_usec);
-#endif
- return count;
-}
-
-/**
- *----------------------------------------------------------------------
- * read/receive from lbproxy
- *----------------------------------------------------------------------
- */
-int edg_wll_log_proxy_read(edg_wll_Context ctx, edg_wll_PlainConnection *conn)
-{
- char *answer = NULL;
- static char et[256];
- int err;
- int code;
- int lbproto_code;
- int count;
-
- errno = err = code = count = 0;
- lbproto_code = 0;
-
- edg_wll_ResetError(ctx);
-
-#ifdef EDG_WLL_LOG_STUB
- fprintf(stderr,"edg_wll_log_proxy_read: reading answer from lbproxy\n");
-#endif
- if ((err = get_reply_plain(ctx, conn, &answer, &lbproto_code, &code)) != 0 ) {
- edg_wll_UpdateError(ctx, EDG_WLL_IL_PROTO,"edg_wll_log_proxy_read(): error reading answer from lbproxy");
- return -1;
- } else {
-#ifdef EDG_WLL_LOG_STUB
- fprintf(stderr,"edg_wll_log_proxy_read: read answer \"%d:%d: %s\"\n",lbproto_code,code,answer);
-#endif
- switch (lbproto_code) {
- case LB_OK: break;
- case LB_NOMEM:
- edg_wll_SetError(ctx, ENOMEM, "edg_wll_log_proxy_read(): proxy out of memory");
- break;
- case LB_PROTO:
- edg_wll_SetError(ctx, EDG_WLL_IL_PROTO, "edg_wll_log_proxy_read(): received protocol error response");
- break;
- case LB_DBERR:
- snprintf(et, sizeof(et), "edg_wll_log_proxy_read(): error details from L&B Proxy server: %s", answer);
- edg_wll_SetError(ctx, code, et);
- break;
- default:
- edg_wll_SetError(ctx, EDG_WLL_IL_PROTO, "edg_wll_log_proxy_read(): received unknown protocol response");
- break;
- }
- }
-
-#ifdef EDG_WLL_LOG_STUB
- fprintf(stderr,"edg_wll_log_proxy_read: done (remaining timeout %d.%06d sec)\n",
- (int) ctx->p_tmp_timeout.tv_sec, (int) ctx->p_tmp_timeout.tv_usec);
-#endif
- return 0;
-}
-
-
-/**
- *----------------------------------------------------------------------
- * connect to bkserver
- *----------------------------------------------------------------------
- */
-int edg_wll_log_direct_connect(edg_wll_Context ctx, edg_wll_GssConnection *conn)
-{
- int ret,answer;
- char *my_subject_name = NULL;
- edg_wll_GssStatus gss_stat;
- gss_cred_id_t cred = GSS_C_NO_CREDENTIAL;
- OM_uint32 min_stat;
- char *host;
- int port;
-
- ret = answer = 0;
-
- edg_wll_ResetError(ctx);
-
-#ifdef EDG_WLL_LOG_STUB
- fprintf(stderr,"edg_wll_log_direct_connect: setting connection to bkserver (remaining timeout %d.%06d sec)\n",
- (int) ctx->p_tmp_timeout.tv_sec, (int) ctx->p_tmp_timeout.tv_usec);
-#endif
- /* get bkserver location: */
- edg_wlc_JobIdGetServerParts(ctx->p_jobid,&host,&port);
- port +=1;
- /* acquire gss credentials */
- ret = edg_wll_gss_acquire_cred_gsi(
- ctx->p_proxy_filename ? ctx->p_proxy_filename : ctx->p_cert_filename,
- ctx->p_proxy_filename ? ctx->p_proxy_filename : ctx->p_key_filename,
- &cred, &my_subject_name, &gss_stat);
- /* give up if unable to acquire prescribed credentials, otherwise go on anonymously */
- if (ret && ctx->p_proxy_filename) {
- edg_wll_SetErrorGss(ctx, "edg_wll_gss_acquire_cred_gsi(): failed to load GSI credentials", &gss_stat);
- goto edg_wll_log_direct_connect_end;
- }
-#ifdef EDG_WLL_LOG_STUB
- if (my_subject_name) {
- // XXX: shouldn't be probably ctx->p_user_lbproxy but some new parameter, eg. ctx->p_user
- edg_wll_SetParamString(ctx, EDG_WLL_PARAM_LBPROXY_USER, my_subject_name);
- fprintf(stderr,"edg_wll_log_direct_connect: using certificate: %s\n",my_subject_name);
- } else {
- fprintf(stderr,"edg_wll_log_direct_connect: going on anonymously\n");
- }
- fprintf(stderr,"edg_wll_log_direct_connect: opening connection to bkserver (host '%s', port '%d')\n", host, port);
-#endif
- if ((answer = edg_wll_gss_connect(cred,host,port,
- &ctx->p_tmp_timeout, conn, &gss_stat)) < 0) {
- answer = handle_gss_failures(ctx,answer,&gss_stat,"edg_wll_gss_connect()");
- goto edg_wll_log_direct_connect_end;
- }
-
-edg_wll_log_direct_connect_end:
-#ifdef EDG_WLL_LOG_STUB
- fprintf(stderr,"edg_wll_log_direct_connect: done (remaining timeout %d.%06d sec)\n",
- (int) ctx->p_tmp_timeout.tv_sec, (int) ctx->p_tmp_timeout.tv_usec);
-#endif
- if (cred != GSS_C_NO_CREDENTIAL)
- gss_release_cred(&min_stat, &cred);
- if (my_subject_name) free(my_subject_name);
- if (host) free(host);
-
- return answer;
-}
-
-/**
- *----------------------------------------------------------------------
- * close connection to bkserver
- *----------------------------------------------------------------------
- */
-int edg_wll_log_direct_close(edg_wll_Context ctx, edg_wll_GssConnection *conn)
-{
- return edg_wll_gss_close(conn,&ctx->p_tmp_timeout);
-}
-
-/**
- *----------------------------------------------------------------------
- * write/send to bkserver
- *----------------------------------------------------------------------
- */
-int edg_wll_log_direct_write(edg_wll_Context ctx, edg_wll_GssConnection *conn, edg_wll_LogLine logline)
-{
- size_t len,count=0;
- int err;
- char *buffer;
- edg_wll_GssStatus gss_code;
-
- edg_wll_ResetError(ctx);
-
-#ifdef EDG_WLL_LOG_STUB
- fprintf(stderr,"edg_wll_log_direct_write: encoding message\n");
-#endif
- {
- il_octet_string_t ll;
-
- ll.len=strlen(logline); ll.data=logline;
- len = encode_il_msg(&buffer, &ll);
- }
- if(len < 0) {
- edg_wll_SetError(ctx, errno, "encode_il_msg()");
- edg_wll_UpdateError(ctx, ENOMEM, "edg_wll_log_proto_client_direct(): error encoding message");
- return -1;
- }
-#ifdef EDG_WLL_LOG_STUB
- fprintf(stderr,"edg_wll_log_direct_write: sending message\n");
-#endif
- count = 0;
- if (( err = edg_wll_gss_write_full(conn, buffer, len, &ctx->p_tmp_timeout, &count, &gss_code)) < 0) {
- handle_gss_failures(ctx,err,&gss_code,"edg_wll_gss_write_full()");
- edg_wll_UpdateError(ctx, EDG_WLL_IL_PROTO,"edg_wll_log_direct_write(): error sending message");
- return -1;
- }
- if (buffer) free(buffer);
-#ifdef EDG_WLL_LOG_STUB
- fprintf(stderr,"edg_wll_log_direct_write: done (remaining timeout %d.%06d sec)\n",
- (int) ctx->p_tmp_timeout.tv_sec, (int) ctx->p_tmp_timeout.tv_usec);
-#endif
- return count;
-}
-
-/**
- *----------------------------------------------------------------------
- * read/receive from bkserver
- *----------------------------------------------------------------------
- */
-int edg_wll_log_direct_read(edg_wll_Context ctx, edg_wll_GssConnection *con)
-{
- char *answer = NULL;
- static char et[256];
- int err;
- int code, lbproto_code;
- int count;
-
- errno = err = code = count = 0;
-
- edg_wll_ResetError(ctx);
-
-#ifdef EDG_WLL_LOG_STUB
- fprintf(stderr,"edg_wll_log_direct_read: reading answer from bkserver\n");
-#endif
- if ((err = get_reply_gss(ctx, con, &answer, &lbproto_code, &code)) != 0 ) {
- edg_wll_UpdateError(ctx, EDG_WLL_IL_PROTO,"edg_wll_log_proto_client_direct(): error reading answer from L&B direct server");
- if (answer) free(answer);
- return -1;
- } else {
-#ifdef EDG_WLL_LOG_STUB
- fprintf(stderr,"edg_wll_log_direct_read: read answer \"%d:%d: %s\"\n",lbproto_code,code,answer);
-#endif
- switch (lbproto_code) {
- case LB_OK: break;
- case LB_NOMEM:
- edg_wll_SetError(ctx, ENOMEM, "edg_wll_log_direct_read(): server out of memory");
- break;
- case LB_PROTO:
- edg_wll_SetError(ctx, EDG_WLL_IL_PROTO, "edg_wll_log_direct_read(): received protocol error response");
- break;
- case LB_DBERR:
- snprintf(et, sizeof(et), "edg_wll_log_direct_read: error details from L&B server: %s", answer);
- edg_wll_SetError(ctx, code, et);
- break;
- default:
- edg_wll_SetError(ctx, EDG_WLL_IL_PROTO, "edg_wll_log_direct_read(): received unknown protocol response");
- break;
- }
- }
-#ifdef EDG_WLL_LOG_STUB
- fprintf(stderr,"edg_wll_log_direct_read: done (remaining timeout %d.%06d sec)\n",
- (int) ctx->p_tmp_timeout.tv_sec, (int) ctx->p_tmp_timeout.tv_usec);
-#endif
- return 0;
-}
+++ /dev/null
-#ifndef __EDG_WORKLOAD_LOGGING_CLIENT_PROD_PROTO_H__
-#define __EDG_WORKLOAD_LOGGING_CLIENT_PROD_PROTO_H__
-
-#ident "$Header$"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "glite/security/glite_gss.h"
-#include "glite/lb/log_proto.h"
-#include "glite/lb/context-int.h"
-
-#define PROXY_CONNECT_RETRY 10 /* ms */
-
-/**
- * connect to local-logger
- * \param[in,out] ctx context to work with
- * \param[out] conn opened connection (index in the connection pool)
- * \return errno
- */
-int edg_wll_log_connect(edg_wll_Context ctx, int *conn);
-
-/**
- * close connection to local-logger
- * \param[in,out] ctx context to work with
- * \param[in] conn opened connection
- * \return errno
- */
-int edg_wll_log_close(edg_wll_Context ctx, int conn);
-
-/**
- * write/send to local-logger
- * \param[in,out] ctx context to work with
- * \param[in] conn connection to use
- * \param[in] logline message to send
- * \return the number of bytes written (zero indicates nothing was written) or -1 on error
- */
-int edg_wll_log_write(edg_wll_Context ctx, int conn, edg_wll_LogLine logline);
-
-/**
- * read/receive answer (stored in context) from local-logger
- * \param[in,out] ctx context to work with
- * \param[in] conn connection to use
- * \return the number of bytes read (zero indicates nothing was read) or -1 on error
- */
-int edg_wll_log_read(edg_wll_Context ctx, int conn);
-
-
-/**
- * connect to lbproxy
- * \param[in,out] ctx context to work with
- * \param[out] conn opened connection
- * \return errno
- */
-int edg_wll_log_proxy_connect(edg_wll_Context ctx, edg_wll_PlainConnection *conn);
-
-/**
- * close connection to lbproxy
- * \param[in,out] ctx context to work with
- * \param[out] conn opened connection
- * \return errno
- */
-int edg_wll_log_proxy_close(edg_wll_Context ctx, edg_wll_PlainConnection *conn);
-
-/**
- * write/send to lbproxy
- * \param[in,out] ctx context to work with
- * \param[in] conn connection to use
- * \param[in] logline message to send
- * \return the number of bytes written (zero indicates nothing was written) or -1 on error
- */
-int edg_wll_log_proxy_write(edg_wll_Context ctx, edg_wll_PlainConnection *conn, edg_wll_LogLine logline);
-
-/**
- * read/receive from lbproxy
- * \param[in,out] ctx context to work with
- * \param[in] conn connection to use
- * \return the number of bytes read (zero indicates nothing was read) or -1 on error
- */
-int edg_wll_log_proxy_read(edg_wll_Context ctx, edg_wll_PlainConnection *conn);
-
-
-/**
- * connect to bkserver
- * \param[in,out] ctx context to work with
- * \param[out] conn opened connection
- * \return errno
- */
-int edg_wll_log_direct_connect(edg_wll_Context ctx, edg_wll_GssConnection *conn);
-
-/**
- * close connection to bkserver
- * \param[in,out] ctx context to work with
- * \param[out] conn opened connection
- * \return errno
- */
-int edg_wll_log_direct_close(edg_wll_Context ctx, edg_wll_GssConnection *conn);
-
-/**
- * write/send to bkserver
- * \param[in,out] ctx context to work with
- * \param[in] conn connection to use
- * \param[in] logline message to send
- * \return the number of bytes written (zero indicates nothing was written) or -1 on error
- */
-int edg_wll_log_direct_write(edg_wll_Context ctx, edg_wll_GssConnection *conn, edg_wll_LogLine logline);
-
-/**
- * read/receive from bkserver
- * \param[in,out] ctx context to work with
- * \param[in] conn connection to use
- * \return the number of bytes read (zero indicates nothing was read) or -1 on error
- */
-int edg_wll_log_direct_read(edg_wll_Context ctx, edg_wll_GssConnection *conn);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __EDG_WORKLOAD_LOGGING_CLIENT_PROD_PROTO_H__ */
+++ /dev/null
-#ident "$Header$"
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <unistd.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <netinet/in.h>
-#include <syslog.h>
-#include <string.h>
-
-#include "glite/wmsutils/jobid/strmd5.h"
-#include "glite/lb/ulm_parse.h"
-#include "glite/lb/trio.h"
-
-#include "glite/lb/producer.h"
-
-#include "prod_proto.h"
-
-/* XXX: paralel registration is disabled until the race condition (via proxy first)
- * job owner assignment is solved */
-
-#define LB_SERIAL_REG
-
-#ifdef FAKE_VERSION
-int edg_wll_DoLogEvent(edg_wll_Context ctx, edg_wll_LogLine logline);
-int edg_wll_DoLogEventProxy(edg_wll_Context ctx, edg_wll_LogLine logline);
-int edg_wll_DoLogEventDirect(edg_wll_Context ctx, edg_wll_LogLine logline);
-#else
-
-/**
- *----------------------------------------------------------------------
- * handle_errors - handle answers from logging functions
- *----------------------------------------------------------------------
- */
-static
-int handle_errors(edg_wll_Context ctx, int code, const char *text)
-{
- static char err[256];
-
- switch(code) {
- case 0:
- case EINVAL:
- case ENOSPC:
- case ENOMEM:
- case EDG_WLL_ERROR_GSS:
- case EDG_WLL_ERROR_DNS:
- case ENOTCONN:
- case ECONNREFUSED:
- case ETIMEDOUT:
- case EAGAIN:
- break;
- case EDG_WLL_ERROR_PARSE_EVENT_UNDEF:
- case EDG_WLL_ERROR_PARSE_MSG_INCOMPLETE:
- case EDG_WLL_ERROR_PARSE_KEY_DUPLICITY:
- case EDG_WLL_ERROR_PARSE_KEY_MISUSE:
-// case EDG_WLL_ERROR_PARSE_OK_WITH_EXTRA_FIELDS:
- snprintf(err, sizeof(err), "%s: Error code mapped to EINVAL", text);
- edg_wll_UpdateError(ctx,EINVAL,err);
- break;
- case EDG_WLL_IL_PROTO:
- case EDG_WLL_IL_SYS:
- case EDG_WLL_IL_EVENTS_WAITING:
- snprintf(err, sizeof(err), "%s: Error code mapped to EAGAIN", text);
- edg_wll_UpdateError(ctx,EAGAIN,err);
- break;
- default:
- snprintf(err, sizeof(err), "%s: Error code mapped to EAGAIN", text);
- edg_wll_UpdateError(ctx,EAGAIN,err);
- break;
- }
-
- return edg_wll_Error(ctx, NULL, NULL);
-}
-
-/**
- *----------------------------------------------------------------------
- * Open a GSS connection to local-logger, send already formatted ULM string
- * and get answer back from local-logger
- * \brief connect to local-logger, send message and get answer back
- * \param[in,out] ctx context to work with,
- * \param[in] logline formated ULM string
- *----------------------------------------------------------------------
- */
-int edg_wll_DoLogEvent(
- edg_wll_Context ctx,
- edg_wll_LogLine logline)
-{
- int ret = 0, answer = EAGAIN;
- int conn;
-
- edg_wll_ResetError(ctx);
- memset(&conn,0,sizeof(conn));
-
- /* connect to local-logger */
- if ((ret = edg_wll_log_connect(ctx,&conn))) {
- edg_wll_UpdateError(ctx,EDG_WLL_IL_PROTO,"edg_wll_DoLogEvent(): edg_wll_log_connect error");
- goto edg_wll_DoLogEvent_end;
- }
-
- /* why? sleep(3); */
- /* send message */
- if ((ret = edg_wll_log_write(ctx,conn,logline)) == -1) {
- edg_wll_UpdateError(ctx,EDG_WLL_IL_PROTO,"edg_wll_DoLogEvent(): edg_wll_log_write error");
- goto edg_wll_DoLogEvent_end;
- }
-
- /* get answer */
- if ((ret = edg_wll_log_read(ctx,conn)) == -1) {
- edg_wll_UpdateError(ctx,EDG_WLL_IL_PROTO,"edg_wll_DoLogEvent(): edg_wll_log_read error");
- } else {
- answer = edg_wll_Error(ctx, NULL, NULL);
- }
-
-edg_wll_DoLogEvent_end:
-// XXX: no close if using connpool: edg_wll_log_close(ctx,&conn);
-
- return handle_errors(ctx,answer,"edg_wll_DoLogEvent()");
-}
-
-/**
- *----------------------------------------------------------------------
- * Open a plain (UNIX socket) connection to L&B Proxy, send already formatted ULM string
- * and get answer back from L&B Proxy
- * \brief connect to lbproxy, send message and get answer back
- * \param[in,out] ctx context to work with,
- * \param[in] logline formated ULM string
- *----------------------------------------------------------------------
- */
-int edg_wll_DoLogEventProxy(
- edg_wll_Context ctx,
- edg_wll_LogLine logline)
-{
- int ret = 0, answer = EAGAIN;
- edg_wll_PlainConnection conn;
-
- edg_wll_ResetError(ctx);
- memset(&conn,0,sizeof(conn));
-
- /* connect to lbproxy */
- if ((ret = edg_wll_log_proxy_connect(ctx,&conn))) {
- edg_wll_UpdateError(ctx,EDG_WLL_IL_PROTO,"edg_wll_DoLogEventProxy(): edg_wll_log_proxy_write error");
- goto edg_wll_DoLogEventProxy_end;
- }
-
- /* send message */
- if ((ret = edg_wll_log_proxy_write(ctx,&conn,logline)) == -1) {
- edg_wll_UpdateError(ctx,EDG_WLL_IL_PROTO,"edg_wll_DoLogEventProxy(): edg_wll_log_proxy_write error");
- goto edg_wll_DoLogEventProxy_end;
- }
-
- /* get answer */
- if ((ret = edg_wll_log_proxy_read(ctx,&conn)) == -1) {
- edg_wll_UpdateError(ctx,EDG_WLL_IL_PROTO,"edg_wll_DoLogEventProxy(): edg_wll_log_proxy_read error");
- } else {
- answer = edg_wll_Error(ctx, NULL, NULL);
- }
-
-edg_wll_DoLogEventProxy_end:
- edg_wll_log_proxy_close(ctx,&conn);
-
- return handle_errors(ctx,answer,"edg_wll_DoLogEventProxy()");
-}
-
-/**
- *----------------------------------------------------------------------
- * Open a GSS connection to L&B server, send already formatted ULM string
- * and get answer back from L&B server
- * \brief connect to bkserver, send message and get answer back
- * \param[in,out] ctx context to work with,
- * \param[in] logline formated ULM string
- *----------------------------------------------------------------------
- */
-int edg_wll_DoLogEventDirect(
- edg_wll_Context ctx,
- edg_wll_LogLine logline)
-{
- int ret = 0, answer = EAGAIN;
- edg_wll_GssConnection conn;
-
- edg_wll_ResetError(ctx);
- memset(&conn,0,sizeof(conn));
-
- /* connect to bkserver */
- if ((ret = edg_wll_log_direct_connect(ctx,&conn))) {
- edg_wll_UpdateError(ctx,EDG_WLL_IL_PROTO,"edg_wll_DoLogEventDirect(): edg_wll_log_direct_connect error");
- goto edg_wll_DoLogEventDirect_end;
- }
-
- /* send message */
- if ((ret = edg_wll_log_direct_write(ctx,&conn,logline)) == -1) {
- edg_wll_UpdateError(ctx,EDG_WLL_IL_PROTO,"edg_wll_DoLogEventDirect(): edg_wll_log_direct_write error");
- goto edg_wll_DoLogEventDirect_end;
- }
-
- /* get answer */
- if ((ret = edg_wll_log_direct_read(ctx,&conn)) == -1) {
- edg_wll_UpdateError(ctx,EDG_WLL_IL_PROTO,"edg_wll_DoLogEventDirect(): edg_wll_log_direct_read error");
- } else {
- answer = edg_wll_Error(ctx, NULL, NULL);
- }
-
-edg_wll_DoLogEventDirect_end:
- edg_wll_log_direct_close(ctx,&conn);
-
- return handle_errors(ctx,answer,"edg_wll_DoLogEventDirect()");
-}
-
-#endif /* FAKE_VERSION */
-
-#define LOGFLAG_ASYNC 0 /**< asynchronous logging */
-#define LOGFLAG_SYNC 1 /**< synchronous logging */
-#define LOGFLAG_NORMAL 2 /**< logging to local logger */
-#define LOGFLAG_PROXY 4 /**< logging to L&B Proxy */
-#define LOGFLAG_DIRECT 8 /**< logging directly to bkserver */
-
-/**
- *----------------------------------------------------------------------
- * Formats a logging message
- * \brief formats a logging message
- * \param[in,out] ctx context to work with,
- * \param[in] flags as defined by LOGFLAG_*
- * \param[in] event type of the event,
- * \param[out] logline formated logging message
- * \param[in] fmt printf()-like format string,
- * \param[in] ... event specific values/data according to fmt.
- *----------------------------------------------------------------------
- */
-static int edg_wll_FormatLogLine(
- edg_wll_Context ctx,
- int flags,
- edg_wll_EventCode event,
- edg_wll_LogLine *logline,
- char *fmt, ...)
-{
- va_list fmt_args;
- int priority;
- int ret;
- char *fix,*var,*dguser;
- char *source,*eventName,*lvl,*fullid,*seq;
- struct timeval start_time;
- char date[ULM_DATE_STRING_LENGTH+1];
- edg_wll_LogLine out;
- size_t size;
- int i;
-
- i = errno = size = ret = 0;
- seq = fix = var = dguser = out = source = eventName = lvl = fullid = NULL;
- priority = flags & LOGFLAG_SYNC;
-
- edg_wll_ResetError(ctx);
-
- /* format the message: */
- va_start(fmt_args,fmt);
-
- gettimeofday(&start_time,0);
- if (edg_wll_ULMTimevalToDate(start_time.tv_sec,start_time.tv_usec,date) != 0) {
- edg_wll_SetError(ctx,ret = EINVAL,"edg_wll_FormatLogLine(): edg_wll_ULMTimevalToDate() error");
- goto edg_wll_formatlogline_end;
- }
- source = edg_wll_SourceToString(ctx->p_source);
- lvl = edg_wll_LevelToString(ctx->p_level);
- eventName = edg_wll_EventToString(event);
- if (!eventName) {
- edg_wll_SetError(ctx,ret = EINVAL,"edg_wll_FormatLogLine(): event name not specified");
- goto edg_wll_formatlogline_end;
- }
- if (!(fullid = edg_wlc_JobIdUnparse(ctx->p_jobid))) {
- edg_wll_SetError(ctx,ret = EINVAL,"edg_wll_FormatLogLine(): edg_wlc_JobIdUnparse() error");
- goto edg_wll_formatlogline_end;
- }
- seq = edg_wll_GetSequenceCode(ctx);
-
- if (trio_asprintf(&fix,EDG_WLL_FORMAT_COMMON,
- date,ctx->p_host,lvl,priority,
- source,ctx->p_instance ? ctx->p_instance : "",
- eventName,fullid,seq) == -1) {
- edg_wll_SetError(ctx,ret = ENOMEM,"edg_wll_FormatLogLine(): trio_asprintf() error");
- goto edg_wll_formatlogline_end;
- }
- /* TODO: add always, probably new ctx->p_user */
- if ( ( (flags & LOGFLAG_PROXY) || (flags & LOGFLAG_DIRECT) ) &&
- (ctx->p_user_lbproxy) ) {
- if (trio_asprintf(&dguser,EDG_WLL_FORMAT_USER,ctx->p_user_lbproxy) == -1) {
- edg_wll_SetError(ctx,ret = ENOMEM,"edg_wll_FormatLogLine(): trio_asprintf() error");
- goto edg_wll_formatlogline_end;
- }
- } else {
- dguser = strdup("");
- }
- if (trio_vasprintf(&var,fmt,fmt_args) == -1) {
- edg_wll_SetError(ctx,ret = ENOMEM,"edg_wll_FormatLogLine(): trio_vasprintf() error");
- goto edg_wll_formatlogline_end;
- }
- if (asprintf(&out,"%s%s%s\n",fix,dguser,var) == -1) {
- edg_wll_SetError(ctx,ret = ENOMEM,"edg_wll_FormatLogLine(): asprintf() error");
- goto edg_wll_formatlogline_end;
- }
- size = strlen(out);
-
- if (priority && (size > EDG_WLL_LOG_SYNC_MAXMSGSIZE)) {
- edg_wll_SetError(ctx,ret = ENOSPC,"edg_wll_FormatLogLine(): Message size too large for synchronous transfer");
- goto edg_wll_formatlogline_end;
- }
-
-#ifdef EDG_WLL_LOG_STUB
-// fprintf(stderr,"edg_wll_FormatLogLine (%d chars): %s",size,out);
-#endif
- if (out) {
- *logline = out;
- } else {
- *logline = NULL;
- }
-
-edg_wll_formatlogline_end:
- va_end(fmt_args);
- if (seq) free(seq);
- if (fix) free(fix);
- if (dguser) free(dguser);
- if (var) free(var);
- if (source) free(source);
- if (lvl) free(lvl);
- if (eventName) free(eventName);
- if (fullid) free(fullid);
-
- return edg_wll_Error(ctx,NULL,NULL);
-}
-
-/**
- *----------------------------------------------------------------------
- * Formats a logging message and sends it to local-logger
- * \brief master logging event function
- * \param[in,out] ctx context to work with,
- * \param[in] flags as defined by LOGFLAG_*
- * \param[in] event type of the event,
- * \param[in] fmt printf()-like format string,
- * \param[in] ... event specific values/data according to fmt.
- *----------------------------------------------------------------------
- */
-static int edg_wll_LogEventMaster(
- edg_wll_Context ctx,
- int flags,
- edg_wll_EventCode event,
- char *fmt, ...)
-{
- va_list fmt_args;
- int priority;
- int ret;
- edg_wll_LogLine in = NULL, out = NULL;
-
- priority = flags & LOGFLAG_SYNC;
-
- edg_wll_ResetError(ctx);
-
- /* default return value is "Try Again" */
- ret = EAGAIN;
-
- /* format the message: */
- va_start(fmt_args,fmt);
-
- if (trio_vasprintf(&in,fmt,fmt_args) == -1) {
- edg_wll_UpdateError(ctx,ret = ENOMEM,"edg_wll_LogEventMaster(): trio_vasprintf() error");
- goto edg_wll_logeventmaster_end;
- }
-
- if (edg_wll_FormatLogLine(ctx,flags,event,&out,"%s",in) != 0 ) {
- edg_wll_UpdateError(ctx,ret = EINVAL,"edg_wll_LogEventMaster(): edg_wll_FormatLogLine() error");
- goto edg_wll_logeventmaster_end;
- }
-
-#ifdef EDG_WLL_LOG_STUB
-// fprintf(stderr,"edg_wll_LogEventMaster (%d chars): %s",strlen(out),out);
-#endif
-
- ctx->p_tmp_timeout.tv_sec = 0;
- ctx->p_tmp_timeout.tv_usec = 0;
- if (priority) {
- ctx->p_tmp_timeout = ctx->p_sync_timeout;
- }
- else {
- ctx->p_tmp_timeout = ctx->p_log_timeout;
- }
-
- /* and send the message */
-#ifndef LB_PERF_DROP
- if (flags & LOGFLAG_NORMAL) {
- /* to the local-logger: */
- ret = edg_wll_DoLogEvent(ctx, out);
- } else if (flags & LOGFLAG_PROXY) {
- /* to the L&B Proxy: */
- ret = edg_wll_DoLogEventProxy(ctx, out);
- } else if (flags & LOGFLAG_DIRECT) {
- /* directly to the bkserver: */
- ret = edg_wll_DoLogEventDirect(ctx, out);
- } else {
- edg_wll_SetError(ctx,ret = EINVAL,"edg_wll_LogEventMaster(): wrong flag specified");
- }
-#endif
-
-edg_wll_logeventmaster_end:
- va_end(fmt_args);
- if (in) free(in);
- if (out) free(out);
-
- if (!ret) if(edg_wll_IncSequenceCode(ctx)) {
- edg_wll_SetError(ctx,ret = EINVAL,"edg_wll_LogEventMaster(): edg_wll_IncSequenceCode failed");
- }
-
- if (ret) edg_wll_UpdateError(ctx,0,"Logging library ERROR: ");
-
- return edg_wll_Error(ctx,NULL,NULL);
-}
-
-
-/**
- *----------------------------------------------------------------------
- * Formats a logging message and sends it asynchronously to local-logger
- * \brief generic asynchronous logging function
- *----------------------------------------------------------------------
- */
-int edg_wll_LogEvent(
- edg_wll_Context ctx,
- edg_wll_EventCode event,
- char *fmt, ...)
-{
- int ret=0;
- char *list=NULL;
- va_list fmt_args;
-
- edg_wll_ResetError(ctx);
-
- va_start(fmt_args,fmt);
- if (trio_vasprintf(&list,fmt,fmt_args) == -1) {
- edg_wll_SetError(ctx,ret = ENOMEM,"edg_wll_LogEvent(): trio_vasprintf() error");
- goto edg_wll_logevent_end;
- }
-
- ret=edg_wll_LogEventMaster(ctx,LOGFLAG_NORMAL | LOGFLAG_ASYNC,event,"%s",list);
-
-edg_wll_logevent_end:
- va_end(fmt_args);
- if (list) free(list);
-
- if (ret) edg_wll_UpdateError(ctx,0,"edg_wll_LogEvent(): ");
-
- return edg_wll_Error(ctx,NULL,NULL);
-}
-
-/**
- *----------------------------------------------------------------------
- * Formats a logging message and sends it synchronously to local-logger
- * \brief generic synchronous logging function
- * \note simple wrapper around edg_wll_LogEventMaster()
- *----------------------------------------------------------------------
- */
-int edg_wll_LogEventSync(
- edg_wll_Context ctx,
- edg_wll_EventCode event,
- char *fmt, ...)
-{
- int ret=0;
- char *list=NULL;
- va_list fmt_args;
-
- edg_wll_ResetError(ctx);
-
- va_start(fmt_args,fmt);
- if (trio_vasprintf(&list,fmt,fmt_args) == -1) {
- edg_wll_SetError(ctx,ret = ENOMEM,"edg_wll_LogEventSync(): trio_vasprintf() error");
- goto edg_wll_logeventsync_end;
- }
-
- ret=edg_wll_LogEventMaster(ctx,LOGFLAG_NORMAL | LOGFLAG_SYNC,event,"%s",list);
-
-edg_wll_logeventsync_end:
- va_end(fmt_args);
- if (list) free(list);
-
- if (ret) edg_wll_UpdateError(ctx,0,"edg_wll_LogEventSync(): ");
-
- return edg_wll_Error(ctx,NULL,NULL);
-}
-
-/**
- *----------------------------------------------------------------------
- * Formats a logging message and sends it synchronously to L&B Proxy
- * \brief generic synchronous logging function
- * \note simple wrapper around edg_wll_LogEventMaster()
- *----------------------------------------------------------------------
- */
-int edg_wll_LogEventProxy(
- edg_wll_Context ctx,
- edg_wll_EventCode event,
- char *fmt, ...)
-{
- int ret=0;
- char *list=NULL;
- va_list fmt_args;
-
- edg_wll_ResetError(ctx);
-
- va_start(fmt_args,fmt);
- if (trio_vasprintf(&list,fmt,fmt_args) == -1) {
- edg_wll_SetError(ctx,ret = ENOMEM,"edg_wll_LogEventProxy(): trio_vasprintf() error");
- goto edg_wll_logevent_end;
- }
-
- ret=edg_wll_LogEventMaster(ctx,LOGFLAG_PROXY | LOGFLAG_SYNC, event,"%s",list);
-
-edg_wll_logevent_end:
- va_end(fmt_args);
- if (list) free(list);
-
- if (ret) edg_wll_UpdateError(ctx,0,"edg_wll_LogEventProxy(): ");
-
- return edg_wll_Error(ctx,NULL,NULL);
-}
-
-/**
- *-----------------------------------------------------------------------
- * Instructs interlogger to to deliver all pending events related to current job
- * \brief flush events from interlogger
- * \note simple wrapper around edg_wll_LogEventMaster()
- *-----------------------------------------------------------------------
- */
-int edg_wll_LogFlush(
- edg_wll_Context ctx,
- struct timeval *timeout)
-{
- int ret = 0;
- edg_wll_LogLine out = NULL;
- char *fullid;
- char date[ULM_DATE_STRING_LENGTH+1];
- struct timeval start_time;
-
- fullid = NULL;
-
- edg_wll_ResetError(ctx);
-
- gettimeofday(&start_time, 0);
- if (edg_wll_ULMTimevalToDate(start_time.tv_sec, start_time.tv_usec, date) != 0) {
- edg_wll_SetError(ctx,ret = EINVAL,"edg_wll_LogFlush(): edg_wll_ULMTimevalToDate() error");
- goto edg_wll_logflush_end;
- }
- if (!(fullid = edg_wlc_JobIdUnparse(ctx->p_jobid))) {
- ret = edg_wll_SetError(ctx,EINVAL,"edg_wll_LogFlush(): edg_wlc_JobIdUnparse() error");
- goto edg_wll_logflush_end;
- }
-
- if (trio_asprintf(&out, "DATE=%s HOST=\"%|Us\" PROG=internal LVL=system DG.PRIORITY=1 DG.TYPE=\"command\" DG.COMMAND=\"flush\" DG.TIMEOUT=\"%d\" DG.JOBID=\"%s\"\n",
- date, ctx->p_host, (timeout ? timeout->tv_sec : ctx->p_sync_timeout.tv_sec), fullid) == -1) {
- edg_wll_SetError(ctx,ret = EINVAL,"edg_wll_LogFlush(): trio_asprintf() error");
- goto edg_wll_logflush_end;
- }
-
- if (timeout)
- ctx->p_tmp_timeout = *timeout;
- else
- ctx->p_tmp_timeout = ctx->p_sync_timeout;
-
- ret = edg_wll_DoLogEvent(ctx, out);
-
-edg_wll_logflush_end:
- if(out) free(out);
- if(fullid) free(fullid);
-
- if (ret) edg_wll_UpdateError(ctx,0,"edg_wll_LogFlush(): ");
-
- return edg_wll_Error(ctx,NULL,NULL);
-}
-
-/**
- *-----------------------------------------------------------------------
- * Instructs interlogger to to deliver all pending events
- * \brief flush all events from interlogger
- * \note simple wrapper around edg_wll_LogEventMaster()
- *-----------------------------------------------------------------------
- */
-int edg_wll_LogFlushAll(
- edg_wll_Context ctx,
- struct timeval *timeout)
-{
- int ret = 0;
- edg_wll_LogLine out = NULL;
- char date[ULM_DATE_STRING_LENGTH+1];
- struct timeval start_time;
-
- edg_wll_ResetError(ctx);
-
- gettimeofday(&start_time, 0);
- if (edg_wll_ULMTimevalToDate(start_time.tv_sec, start_time.tv_usec, date) != 0) {
- edg_wll_SetError(ctx,ret = EINVAL,"edg_wll_LogFlushAll(): edg_wll_ULMTimevalToDate() error");
- goto edg_wll_logflushall_end;
- }
-
- if (trio_asprintf(&out, "DATE=%s HOST=\"%|Us\" PROG=internal LVL=system DG.PRIORITY=1 DG.TYPE=\"command\" DG.COMMAND=\"flush\" DG.TIMEOUT=\"%d\"\n",
- date, ctx->p_host, (timeout ? timeout->tv_sec : ctx->p_sync_timeout.tv_sec)) == -1) {
- edg_wll_SetError(ctx,ret = ENOMEM,"edg_wll_LogFlushAll(): trio_asprintf() error");
- goto edg_wll_logflushall_end;
- }
-
- if (timeout)
- ctx->p_tmp_timeout = *timeout;
- else
- ctx->p_tmp_timeout = ctx->p_sync_timeout;
-
- ret = edg_wll_DoLogEvent(ctx, out);
-
-edg_wll_logflushall_end:
- if(out) free(out);
-
- if (ret) edg_wll_UpdateError(ctx,0,"edg_wll_LogFlushAll(): ");
-
- return edg_wll_Error(ctx,NULL,NULL);
-}
-
-/**
- *-----------------------------------------------------------------------
- * Set a current job for given context.
- * \note Should be called before any logging call.
- *-----------------------------------------------------------------------
- */
-int edg_wll_SetLoggingJob(
- edg_wll_Context ctx,
- const edg_wlc_JobId job,
- const char *code,
- int flags)
-{
- int err;
-
- edg_wll_ResetError(ctx);
-
- if (!job) return edg_wll_SetError(ctx,EINVAL,"edg_wll_SetLoggingJob(): jobid is null");
-
- edg_wlc_JobIdFree(ctx->p_jobid);
- if ((err = edg_wlc_JobIdDup(job,&ctx->p_jobid))) {
- edg_wll_SetError(ctx,err,"edg_wll_SetLoggingJob(): edg_wlc_JobIdDup() error");
- } else if (!edg_wll_SetSequenceCode(ctx,code,flags)) {
- edg_wll_IncSequenceCode(ctx);
- }
-
- /* add user credentials to context */
- {
- char *my_subject_name = NULL;
- edg_wll_GssStatus gss_stat;
- gss_cred_id_t cred = GSS_C_NO_CREDENTIAL;
- OM_uint32 min_stat;
-
- /* acquire gss credentials */
- err = edg_wll_gss_acquire_cred_gsi(
- ctx->p_proxy_filename ? ctx->p_proxy_filename : ctx->p_cert_filename,
- ctx->p_proxy_filename ? ctx->p_proxy_filename : ctx->p_key_filename,
- &cred, &my_subject_name, &gss_stat);
- /* give up if unable to acquire prescribed credentials */
- if (err && ctx->p_proxy_filename) {
- edg_wll_SetErrorGss(ctx, "failed to load GSI credentials", &gss_stat);
- edg_wll_SetParamString(ctx, EDG_WLL_PARAM_LBPROXY_USER, EDG_WLL_LOG_USER_DEFAULT);
- } else {
- edg_wll_SetParamString(ctx, EDG_WLL_PARAM_LBPROXY_USER, my_subject_name);
- }
- if (cred != GSS_C_NO_CREDENTIAL)
- gss_release_cred(&min_stat, &cred);
- if (my_subject_name) free(my_subject_name);
- }
-
- return edg_wll_Error(ctx,NULL,NULL);
-}
-
-/**
- *-----------------------------------------------------------------------
- * Set a current job for given context.
- * \note Should be called before any logging call.
- *-----------------------------------------------------------------------
- */
-int edg_wll_SetLoggingJobProxy(
- edg_wll_Context ctx,
- const edg_wlc_JobId job,
- const char *code,
- const char *user,
- int flags)
-{
- int err;
- char *code_loc = NULL;
-
- edg_wll_ResetError(ctx);
-
- if (!job) return edg_wll_SetError(ctx,EINVAL,"edg_wll_SetLoggingJobProxy(): jobid is null");
-
- edg_wlc_JobIdFree(ctx->p_jobid);
- if ((err = edg_wlc_JobIdDup(job,&ctx->p_jobid))) {
- edg_wll_SetError(ctx,err,"edg_wll_SetLoggingJobProxy(): edg_wlc_JobIdDup() error");
- goto edg_wll_setloggingjobproxy_end;
- }
-
- /* add user credentials to context */
- if (user) {
- edg_wll_SetParamString(ctx, EDG_WLL_PARAM_LBPROXY_USER, user);
- } else {
- char *my_subject_name = NULL;
- edg_wll_GssStatus gss_stat;
- gss_cred_id_t cred = GSS_C_NO_CREDENTIAL;
- OM_uint32 min_stat;
-
- /* acquire gss credentials */
- err = edg_wll_gss_acquire_cred_gsi(
- ctx->p_proxy_filename ? ctx->p_proxy_filename : ctx->p_cert_filename,
- ctx->p_proxy_filename ? ctx->p_proxy_filename : ctx->p_key_filename,
- &cred, &my_subject_name, &gss_stat);
- /* give up if unable to acquire prescribed credentials */
- if (err && ctx->p_proxy_filename) {
- edg_wll_SetErrorGss(ctx, "failed to load GSI credentials", &gss_stat);
- edg_wll_SetParamString(ctx, EDG_WLL_PARAM_LBPROXY_USER, EDG_WLL_LOG_USER_DEFAULT);
- } else {
- edg_wll_SetParamString(ctx, EDG_WLL_PARAM_LBPROXY_USER, my_subject_name);
- }
-
- if (cred != GSS_C_NO_CREDENTIAL)
- gss_release_cred(&min_stat, &cred);
- if (my_subject_name) free(my_subject_name);
- }
-
- /* query LBProxyServer for sequence code if not user-suplied */
-/* XXX: don't know if working properly */
- if (!code) {
- if (edg_wll_QuerySequenceCodeProxy(ctx, job, &code_loc))
- goto edg_wll_setloggingjobproxy_end;
- } else {
- code_loc = strdup(code);
- }
-
- if (!edg_wll_SetSequenceCode(ctx,code_loc,flags)) {
- edg_wll_IncSequenceCode(ctx);
- }
-
-edg_wll_setloggingjobproxy_end:
- if (code_loc) free(code_loc);
-
- return edg_wll_Error(ctx,NULL,NULL);
-}
-
-/**
- *-----------------------------------------------------------------------
- * Register job with L&B service.
- *-----------------------------------------------------------------------
- */
-static int edg_wll_RegisterJobMaster(
- edg_wll_Context ctx,
- int flags,
- const edg_wlc_JobId job,
- enum edg_wll_RegJobJobtype type,
- const char * jdl,
- const char * ns,
- edg_wlc_JobId parent,
- int num_subjobs,
- const char * seed,
- edg_wlc_JobId ** subjobs)
-{
- char *seq,*type_s,*parent_s;
- int err = 0;
- struct timeval sync_to;
-
- seq = type_s = parent_s = NULL;
-
- edg_wll_ResetError(ctx);
- memcpy(&sync_to, &ctx->p_sync_timeout, sizeof sync_to);
-
- type_s = edg_wll_RegJobJobtypeToString(type);
- if (!type_s) {
- edg_wll_SetError(ctx,EINVAL,"edg_wll_RegisterJobMaster(): no jobtype specified");
- goto edg_wll_registerjobmaster_end;
- }
- if ((type == EDG_WLL_REGJOB_DAG ||
- type == EDG_WLL_REGJOB_PARTITIONED ||
- type == EDG_WLL_REGJOB_COLLECTION)
- && num_subjobs > 0) {
- err = edg_wll_GenerateSubjobIds(ctx,job,num_subjobs,seed,subjobs);
- edg_wll_SetSequenceCode(ctx, NULL, EDG_WLL_SEQ_NORMAL);
- /* increase log timeout on client (the same as on BK server) */
- ctx->p_sync_timeout.tv_sec += num_subjobs;
- if (ctx->p_sync_timeout.tv_sec > 86400) ctx->p_sync_timeout.tv_sec = 86400;
- }
- if (err) {
- edg_wll_UpdateError(ctx,EINVAL,"edg_wll_RegisterJobMaster(): edg_wll_GenerateSubjobIds() error");
- goto edg_wll_registerjobmaster_end;
- }
- parent_s = parent ? edg_wlc_JobIdUnparse(parent) : strdup("");
-
- if (flags & LOGFLAG_DIRECT) {
- /* SetLoggingJob and log directly the message */
- if (edg_wll_SetLoggingJob(ctx,job,NULL,EDG_WLL_SEQ_NORMAL) == 0) {
- edg_wll_LogEventMaster(ctx,LOGFLAG_DIRECT | LOGFLAG_SYNC,
- EDG_WLL_EVENT_REGJOB,EDG_WLL_FORMAT_REGJOB,
- (char *)jdl,ns,parent_s,type_s,num_subjobs,seed);
- }
- } else if (flags & LOGFLAG_PROXY) {
- /* SetLoggingJobProxy and and log to proxy */
- edg_wll_SetSequenceCode(ctx, NULL, EDG_WLL_SEQ_NORMAL);
- if (seq) free(seq);
- seq = edg_wll_GetSequenceCode(ctx);
- if (edg_wll_SetLoggingJobProxy(ctx,job,seq,NULL,EDG_WLL_SEQ_NORMAL) == 0) {
- edg_wll_LogEventMaster(ctx,LOGFLAG_PROXY | LOGFLAG_SYNC,
- EDG_WLL_EVENT_REGJOB,EDG_WLL_FORMAT_REGJOB,
- (char *)jdl,ns,parent_s,type_s,num_subjobs,seed);
- }
- } else if (flags & LOGFLAG_NORMAL) {
- /* SetLoggingJob and log normally the message through the local-logger */
- if (edg_wll_SetLoggingJob(ctx,job,NULL,EDG_WLL_SEQ_NORMAL) == 0) {
- edg_wll_LogEventMaster(ctx, LOGFLAG_NORMAL,
- EDG_WLL_EVENT_REGJOB,EDG_WLL_FORMAT_REGJOB,
- (char *)jdl,ns,parent_s,type_s,num_subjobs,seed);
- }
- } else {
- edg_wll_SetError(ctx,EINVAL,"edg_wll_RegisterJobMaster(): wrong flag specified");
- }
-
-edg_wll_registerjobmaster_end:
- memcpy(&ctx->p_sync_timeout, &sync_to, sizeof sync_to);
- if (seq) free(seq);
- if (type_s) free(type_s);
- if (parent_s) free(parent_s);
- return edg_wll_Error(ctx,NULL,NULL);
-}
-
-/**
- *-----------------------------------------------------------------------
- * Register synchronously one job with L&B service
- * \note simple wrapper around edg_wll_RegisterJobMaster()
- *-----------------------------------------------------------------------
- */
-int edg_wll_RegisterJobSync(
- edg_wll_Context ctx,
- const edg_wlc_JobId job,
- enum edg_wll_RegJobJobtype type,
- const char * jdl,
- const char * ns,
- int num_subjobs,
- const char * seed,
- edg_wlc_JobId ** subjobs)
-{
- return edg_wll_RegisterJobMaster(ctx,LOGFLAG_DIRECT,job,type,jdl,ns,NULL,num_subjobs,seed,subjobs);
-}
-
-/**
- *-----------------------------------------------------------------------
- * Register (asynchronously) one job with L&B service
- * \note simple wrapper around edg_wll_RegisterJobMaster()
- *-----------------------------------------------------------------------
- */
-int edg_wll_RegisterJob(
- edg_wll_Context ctx,
- const edg_wlc_JobId job,
- enum edg_wll_RegJobJobtype type,
- const char * jdl,
- const char * ns,
- int num_subjobs,
- const char * seed,
- edg_wlc_JobId ** subjobs)
-{
- return edg_wll_RegisterJobMaster(ctx,LOGFLAG_DIRECT,job,type,jdl,ns,NULL,num_subjobs,seed,subjobs);
-}
-
-#ifndef LB_SERIAL_REG
-
-/**
- *-----------------------------------------------------------------------
- * Register one job with L&B Proxy service
- * \note simple wrapper around edg_wll_RegisterJobMaster()
- * this is new (!LB_SERIAL_REG) edg_wll_RegisterJobProxy
- *-----------------------------------------------------------------------
- */
-int edg_wll_RegisterJobProxy(
- edg_wll_Context ctx,
- const edg_wlc_JobId job,
- enum edg_wll_RegJobJobtype type,
- const char * jdl,
- const char * ns,
- int num_subjobs,
- const char * seed,
- edg_wlc_JobId ** subjobs)
-{
- char *seq,*type_s;
- edg_wll_LogLine logline = NULL;
- int ret = 0,n,count,fd;
- struct timeval sync_to;
- edg_wll_GssConnection con_bkserver;
- edg_wll_PlainConnection con_lbproxy;
- fd_set fdset;
-
- seq = type_s = NULL;
-
- edg_wll_ResetError(ctx);
- memcpy(&sync_to, &ctx->p_sync_timeout, sizeof sync_to);
- memset(&con_bkserver, 0, sizeof(con_bkserver));
- memset(&con_lbproxy, 0, sizeof(con_lbproxy));
-
- FD_ZERO(&fdset);
-
- type_s = edg_wll_RegJobJobtypeToString(type);
- if (!type_s) {
- edg_wll_SetError(ctx,EINVAL,"edg_wll_RegisterJobProxy(): no jobtype specified");
- goto edg_wll_registerjobproxy_end;
- }
- if ((type == EDG_WLL_REGJOB_DAG ||
- type == EDG_WLL_REGJOB_PARTITIONED ||
- type == EDG_WLL_REGJOB_COLLECTION)
- && num_subjobs > 0) {
- edg_wll_SetSequenceCode(ctx, NULL, EDG_WLL_SEQ_NORMAL);
- ret = edg_wll_GenerateSubjobIds(ctx,job,num_subjobs,seed,subjobs);
- /* increase log timeout on client (the same as on BK server) */
- ctx->p_sync_timeout.tv_sec += num_subjobs;
- if (ctx->p_sync_timeout.tv_sec > 86400) ctx->p_sync_timeout.tv_sec = 86400;
- }
- if (ret) {
- edg_wll_UpdateError(ctx,EINVAL,"edg_wll_RegisterJobProxy(): edg_wll_GenerateSubjobIds() error");
- goto edg_wll_registerjobproxy_end;
- }
-
- /* SetLoggingJobProxy */
- edg_wll_SetSequenceCode(ctx, NULL, EDG_WLL_SEQ_NORMAL);
- seq = edg_wll_GetSequenceCode(ctx);
- if (edg_wll_SetLoggingJobProxy(ctx,job,seq,NULL,EDG_WLL_SEQ_NORMAL) != 0) {
- edg_wll_UpdateError(ctx,EINVAL,"edg_wll_RegisterJobProxy(): edg_wll_SetLoggingJobProxy() error");
- goto edg_wll_registerjobproxy_end;
- }
-
- /* format the RegJob event message */
- if (edg_wll_FormatLogLine(ctx,LOGFLAG_SYNC | LOGFLAG_PROXY | LOGFLAG_PROXY,
- EDG_WLL_EVENT_REGJOB,&logline,
- EDG_WLL_FORMAT_REGJOB,(char *)jdl,ns,"",type_s,num_subjobs,seed) != 0 ) {
- edg_wll_UpdateError(ctx,EINVAL,"edg_wll_RegisterJobProxy(): edg_wll_FormatLogLine() error");
- goto edg_wll_registerjobproxy_end;
- }
-
- /* do not forget to set the timeout!!! */
- ctx->p_tmp_timeout = ctx->p_sync_timeout;
-
- /* and now do the pseudo-parallel registration: */
-
-#ifdef EDG_WLL_LOG_STUB
- fprintf(stderr,"edg_wll_RegisterJobProxy: start (remaining timeout %d.%06d sec)\n",
- (int) ctx->p_tmp_timeout.tv_sec, (int) ctx->p_tmp_timeout.tv_usec);
-#endif
- /* connect to bkserver */
- if ((ret = edg_wll_log_direct_connect(ctx,&con_bkserver))) {
- edg_wll_UpdateError(ctx,EAGAIN,"edg_wll_RegisterJobProxy(): edg_wll_log_direct_connect error");
- goto edg_wll_registerjobproxy_end;
- }
- /* connect to lbproxy */
- if ((ret = edg_wll_log_proxy_connect(ctx,&con_lbproxy))) {
- edg_wll_UpdateError(ctx,EAGAIN,"edg_wll_RegisterJobProxy(): edg_wll_log_proxy_connect error");
- goto edg_wll_registerjobproxy_end;
- }
- /* send to bkserver */
- if ((ret = edg_wll_log_direct_write(ctx,&con_bkserver,logline)) == -1) {
- edg_wll_UpdateError(ctx,EAGAIN,"edg_wll_RegisterJobProxy(): edg_wll_log_direct_write error");
- goto edg_wll_registerjobproxy_end;
- }
- /* send to lbproxy */
- if ((ret = edg_wll_log_proxy_write(ctx,&con_lbproxy,logline)) == -1) {
- edg_wll_UpdateError(ctx,EAGAIN,"edg_wll_RegisterJobProxy(): edg_wll_log_proxy_write error");
- goto edg_wll_registerjobproxy_end;
- }
- /* select and read the answers */
- count = 2;
- while (count > 0) {
- FD_SET(con_bkserver.sock,&fdset);
- n = con_bkserver.sock;
- FD_SET(con_lbproxy.sock,&fdset);
- if (con_lbproxy.sock > n) n = con_lbproxy.sock;
- n += 1;
-#ifdef EDG_WLL_LOG_STUB
- fprintf(stderr,"edg_wll_RegisterJobProxy: calling select (remaining timeout %d.%06d sec)\n",
- (int) ctx->p_tmp_timeout.tv_sec, (int) ctx->p_tmp_timeout.tv_usec);
-#endif
- fd = select(n,&fdset,NULL,NULL,&ctx->p_tmp_timeout);
- switch (fd) {
- case 0: /* timeout */
- edg_wll_UpdateError(ctx,EAGAIN,"edg_wll_RegisterJobProxy(): select() timeouted");
- count = 0;
- break;
- case -1: /* error */
- switch(errno) {
- case EINTR:
- continue;
- default:
- edg_wll_UpdateError(ctx,errno,"edg_wll_RegisterJobProxy(): select() error");
- }
- default:
- break;
- }
- if (FD_ISSET(con_bkserver.sock,&fdset)) {
- /* read answer from bkserver */
- if ((ret = edg_wll_log_direct_read(ctx,&con_bkserver)) == -1) {
- edg_wll_UpdateError(ctx,EAGAIN,"edg_wll_RegisterJobProxy(): edg_wll_log_direct_read error");
- goto edg_wll_registerjobproxy_end;
- }
- count -= 1;
- }
- if (FD_ISSET(con_lbproxy.sock,&fdset)) {
- /* read answer from lbproxy */
- if ((ret = edg_wll_log_proxy_read(ctx,&con_lbproxy)) == -1) {
- edg_wll_UpdateError(ctx,EAGAIN,"edg_wll_RegisterJobProxy(): edg_wll_log_proxy_read error");
- goto edg_wll_registerjobproxy_end;
- }
- count -= 1;
- }
- }
-
-edg_wll_registerjobproxy_end:
-#ifdef EDG_WLL_LOG_STUB
- fprintf(stderr,"edg_wll_RegisterJobProxy: done (remaining timeout %d.%06d sec)\n",
- (int) ctx->p_tmp_timeout.tv_sec, (int) ctx->p_tmp_timeout.tv_usec);
-#endif
- if (con_bkserver.sock) edg_wll_gss_close(&con_bkserver,&ctx->p_tmp_timeout);
- if (con_lbproxy.sock) edg_wll_plain_close(&con_lbproxy);
-
- memcpy(&ctx->p_sync_timeout, &sync_to, sizeof sync_to);
- if (type_s) free(type_s);
- if (seq) free(seq);
- if (logline) free(logline);
-
- return edg_wll_Error(ctx,NULL,NULL);
-}
-
-/**
- *-----------------------------------------------------------------------
- * Register one job with L&B Proxy service
- * \note simple wrapper around edg_wll_RegisterJobMaster()
- * this is original edg_wll_RegisterJobProxy
- *-----------------------------------------------------------------------
- */
-int edg_wll_RegisterJobProxyOld(
- edg_wll_Context ctx,
- const edg_wlc_JobId job,
- enum edg_wll_RegJobJobtype type,
- const char * jdl,
- const char * ns,
- int num_subjobs,
- const char * seed,
- edg_wlc_JobId ** subjobs)
-{
- /* first register with bkserver */
- int ret = edg_wll_RegisterJobMaster(ctx,LOGFLAG_DIRECT,job,type,jdl,ns,NULL,num_subjobs,seed,subjobs);
- if (ret) {
- edg_wll_UpdateError(ctx,0,"edg_wll_RegisterJobProxyOld(): unable to register with bkserver");
- return edg_wll_Error(ctx,NULL,NULL);
- }
- /* and then with L&B Proxy */
- return edg_wll_RegisterJobMaster(ctx,LOGFLAG_PROXY,job,type,jdl,ns,NULL,num_subjobs,seed,subjobs);
-}
-
-#else /* LB_SERIAL_REG */
-
-/**
- *-----------------------------------------------------------------------
- * Register one job with L&B Proxy service
- * \note simple wrapper around edg_wll_RegisterJobMaster()
- * this is original edg_wll_RegisterJobProxy
- *-----------------------------------------------------------------------
- */
-int edg_wll_RegisterJobProxy(
- edg_wll_Context ctx,
- const edg_wlc_JobId job,
- enum edg_wll_RegJobJobtype type,
- const char * jdl,
- const char * ns,
- int num_subjobs,
- const char * seed,
- edg_wlc_JobId ** subjobs)
-{
- /* first register with bkserver */
- int ret = edg_wll_RegisterJobMaster(ctx,LOGFLAG_DIRECT,job,type,jdl,ns,NULL,num_subjobs,seed,subjobs);
- if (ret) {
- edg_wll_UpdateError(ctx,0,"edg_wll_RegisterJobProxy(): unable to register with bkserver");
- return edg_wll_Error(ctx,NULL,NULL);
- }
- /* and then with L&B Proxy */
- return edg_wll_RegisterJobMaster(ctx,LOGFLAG_PROXY,job,type,jdl,ns,NULL,num_subjobs,seed,subjobs);
-}
-
-#endif /* LB_SERIAL_REG */
-
-
-#ifndef LB_SERIAL_REG
-
-/**
- *-----------------------------------------------------------------------
- * Register one job with L&B Proxy service ONLY
- * \note simple wrapper around edg_wll_RegisterJobMaster()
- * useful for performace measuring
- *-----------------------------------------------------------------------
- */
-int edg_wll_RegisterJobProxyOnly(
- edg_wll_Context ctx,
- const edg_wlc_JobId job,
- enum edg_wll_RegJobJobtype type,
- const char * jdl,
- const char * ns,
- int num_subjobs,
- const char * seed,
- edg_wlc_JobId ** subjobs)
-{
- return edg_wll_RegisterJobMaster(ctx,LOGFLAG_PROXY,job,type,jdl,ns,NULL,num_subjobs,seed,subjobs);
-}
-
-#endif /* LB_SERIAL_REG */
-
-/**
- *-----------------------------------------------------------------------
- * Register one subjob with L&B service
- * \note simple wrapper around edg_wll_RegisterJobMaster()
- *-----------------------------------------------------------------------
- */
-static
-int edg_wll_RegisterSubjob(
- edg_wll_Context ctx,
- const edg_wlc_JobId job,
- enum edg_wll_RegJobJobtype type,
- const char * jdl,
- const char * ns,
- edg_wlc_JobId parent,
- int num_subjobs,
- const char * seed,
- edg_wlc_JobId ** subjobs)
-{
-/* XXX: what is that ? */
-#ifdef LB_PERF
- return edg_wll_RegisterJobMaster(ctx,LOGFLAG_DIRECT,job,type,jdl,ns,parent,num_subjobs,seed,subjobs);
-#else
- return edg_wll_RegisterJobMaster(ctx,LOGFLAG_NORMAL,job,type,jdl,ns,parent,num_subjobs,seed,subjobs);
-#endif
-}
-
-/**
- *-----------------------------------------------------------------------
- * Register one subjob with L&B Proxy service
- * \note simple wrapper around edg_wll_RegisterJobMaster()
- *-----------------------------------------------------------------------
- */
-static
-int edg_wll_RegisterSubjobProxy(
- edg_wll_Context ctx,
- const edg_wlc_JobId job,
- enum edg_wll_RegJobJobtype type,
- const char * jdl,
- const char * ns,
- edg_wlc_JobId parent,
- int num_subjobs,
- const char * seed,
- edg_wlc_JobId ** subjobs)
-{
- return edg_wll_RegisterJobMaster(ctx,LOGFLAG_PROXY,job,type,jdl,ns,parent,num_subjobs,seed,subjobs);
-}
-
-/**
- *-----------------------------------------------------------------------
- * Register batch of subjobs with L&B service
- * \note simple wrapper around edg_wll_RegisterSubjob()
- *-----------------------------------------------------------------------
- */
-int edg_wll_RegisterSubjobs(
- edg_wll_Context ctx,
- const edg_wlc_JobId parent,
- char const * const * jdls,
- const char * ns,
- edg_wlc_JobId const * subjobs)
-{
- char const * const *pjdl;
- edg_wlc_JobId const *psubjob;
- edg_wlc_JobId oldctxjob;
- char * oldctxseq;
- int errcode = 0;
- char * errdesc = NULL;
-
- if (edg_wll_GetLoggingJob(ctx, &oldctxjob)) return edg_wll_Error(ctx, NULL, NULL);
- oldctxseq = edg_wll_GetSequenceCode(ctx);
-
- pjdl = jdls;
- psubjob = subjobs;
-
- while (*pjdl != NULL) {
- if (edg_wll_RegisterSubjob(ctx, *psubjob, EDG_WLL_REGJOB_SIMPLE, *pjdl,
- ns, parent, 0, NULL, NULL) != 0) {
- errcode = edg_wll_Error(ctx, NULL, &errdesc);
- goto edg_wll_registersubjobs_end;
- }
- pjdl++; psubjob++;
- }
-
-edg_wll_registersubjobs_end:
- edg_wll_SetLoggingJob(ctx, oldctxjob, oldctxseq, EDG_WLL_SEQ_NORMAL);
-
- if (errcode) {
- edg_wll_SetError(ctx, errcode, errdesc);
- free(errdesc);
- }
- return edg_wll_Error(ctx, NULL, NULL);
-}
-
-/**
- *-----------------------------------------------------------------------
- * Register batch of subjobs with L&B Proxy service
- * \note simple wrapper around edg_wll_RegisterSubjobProxy()
- *-----------------------------------------------------------------------
- */
-int edg_wll_RegisterSubjobsProxy(
- edg_wll_Context ctx,
- const edg_wlc_JobId parent,
- char const * const * jdls,
- const char * ns,
- edg_wlc_JobId const * subjobs)
-{
- char const * const *pjdl;
- edg_wlc_JobId const *psubjob;
- edg_wlc_JobId oldctxjob;
- char * oldctxseq;
- int errcode = 0;
- char * errdesc = NULL;
-
- if (edg_wll_GetLoggingJob(ctx, &oldctxjob)) return edg_wll_Error(ctx, NULL, NULL);
- oldctxseq = edg_wll_GetSequenceCode(ctx);
-
- pjdl = jdls;
- psubjob = subjobs;
-
- while (*pjdl != NULL) {
- if (edg_wll_RegisterSubjobProxy(ctx, *psubjob, EDG_WLL_REGJOB_SIMPLE, *pjdl,
- ns, parent, 0, NULL, NULL) != 0) {
- errcode = edg_wll_Error(ctx, NULL, &errdesc);
- goto edg_wll_registersubjobsproxy_end;
- }
- pjdl++; psubjob++;
- }
-
-edg_wll_registersubjobsproxy_end:
- edg_wll_SetLoggingJobProxy(ctx, oldctxjob, oldctxseq, NULL, EDG_WLL_SEQ_NORMAL);
-
- if (errcode) {
- edg_wll_SetError(ctx, errcode, errdesc);
- free(errdesc);
- }
- return edg_wll_Error(ctx, NULL, NULL);
-}
-
-/**
- *-----------------------------------------------------------------------
- * Change ACL for given job
- *-----------------------------------------------------------------------
- */
-int edg_wll_ChangeACL(
- edg_wll_Context ctx,
- const edg_wlc_JobId jobid,
- const char *user_id,
- enum edg_wll_UserIdType user_id_type,
- enum edg_wll_Permission permission,
- enum edg_wll_PermissionType permission_type,
- enum edg_wll_ACLOperation operation)
-{
- if ( edg_wll_SetLoggingJob(ctx, jobid, NULL, EDG_WLL_SEQ_NORMAL) == 0 ) {
- edg_wll_LogEventMaster(ctx, LOGFLAG_NORMAL | LOGFLAG_SYNC,
- EDG_WLL_EVENT_CHANGEACL, EDG_WLL_FORMAT_CHANGEACL,
- user_id, user_id_type, permission, permission_type, operation);
- }
-
- return edg_wll_Error(ctx,NULL,NULL);
-}
+++ /dev/null
-#ident "$Header$"
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <getopt.h>
-#include <string.h>
-#include <time.h>
-#include <errno.h>
-
-#include <globus_common.h>
-
-#define CLIENT_SBIN_PROG
-
-#include "glite/lb/consumer.h"
-#include "glite/lb/context-int.h"
-#include "glite/lb/purge.h"
-#include "glite/lb/xml_parse.h"
-#include "glite/lb/mini_http.h"
-
-
-#define dprintf(x) { if (debug) printf x; }
-
-#define free_jobs(jobs) { \
- if (jobs) { \
- int i; \
- for ( i = 0; jobs[i]; i++ ) \
- free(jobs[i]); \
- free(jobs); \
- } \
-}
-
-static const char rcsid[] = "@(#)$Id$";
-
-static int debug=0;
-static char *file;
-
-static int read_jobIds(const char *file, char ***jobs_out);
-static int get_timeout(const char *arg, int *timeout);
-static void printerr(edg_wll_Context ctx);
-
-static struct option opts[] = {
- { "aborted", required_argument, NULL, 'a'},
- { "cleared", required_argument, NULL, 'c'},
- { "cancelled", required_argument, NULL, 'n'},
- { "other", required_argument, NULL, 'o'},
- { "dry-run", no_argument, NULL, 'r'},
- { "jobs", required_argument, NULL, 'j'},
- { "return-list", no_argument, NULL, 'l'},
- { "server-dump", no_argument, NULL, 's'},
- { "client-dump", no_argument, NULL, 'i'},
- { "help", no_argument, NULL, 'h' },
- { "version", no_argument, NULL, 'v' },
- { "debug", no_argument, NULL, 'd' },
- { "server", required_argument, NULL, 'm' },
- { NULL, no_argument, NULL, 0 }
-};
-
-static void usage(char *me)
-{
- fprintf(stderr,"usage: %s [option]\n"
- " -a, --aborted NNN[smhd] purge ABORTED jobs older than NNN secs/mins/hours/days\n"
- " -c, --cleared NNN[smhd] purge CLEARED jobs older than given time\n"
- " -n, --cancelled NNN[smhd] purge CANCELLED jobs older than given time\n"
- " -o, --other NNN[smhd] purge OTHER jobs older than given time\n"
- " -r, --dry-run do not really purge\n"
- " -j, --jobs <filename> input file with jobIds of jobs to purge\n"
- " -l, --return-list return list of jobid matching the purge/dump criteria\n"
- " -s, --server-dump dump jobs into any server file\n"
- " -i, --client-dump receive stream of dumped jobs\n"
- " -h, --help display this help\n"
- " -v, --version display version\n"
- " -d, --debug diagnostic output\n"
- " -m, --server L&B server machine name\n",
- me);
-}
-
-int main(int argc,char *argv[])
-{
- edg_wll_PurgeRequest *request;
- edg_wll_PurgeResult *result;
- int i, timeout;
- char *server = NULL;
-
- char *me;
- int opt;
- edg_wll_Context ctx;
-
- /* initialize request to server defaults */
- request = (edg_wll_PurgeRequest *) calloc(1,sizeof(edg_wll_PurgeRequest));
- request->jobs = NULL;
- for (i=0; i < EDG_WLL_NUMBER_OF_STATCODES; i++) {
- request->timeout[i]=-1;
- }
- request->flags = EDG_WLL_PURGE_REALLY_PURGE;
-
- /* initialize result */
- result = (edg_wll_PurgeResult *) calloc(1,sizeof(edg_wll_PurgeResult));
-
- me = strrchr(argv[0],'/');
- if (me) me++; else me=argv[0];
-
- /* get arguments */
- while ((opt = getopt_long(argc,argv,"a:c:n:o:j:m:rlsidhv",opts,NULL)) != EOF) {
- timeout=-1;
-
- switch (opt) {
-
- case 'a':
- if ((get_timeout(optarg,&timeout) != 0 )) {
- printf("Wrong usage of timeout argument.\n");
- usage(me);
- return 1;
- }
- if (timeout >= 0) {
- request->timeout[EDG_WLL_JOB_ABORTED]=timeout;
- }
- break;
-
- case 'c':
- if (get_timeout(optarg,&timeout) != 0 ) {
- printf("Wrong usage of timeout argument.\n");
- usage(me);
- return 1;
- }
- if (timeout >= 0) {
- request->timeout[EDG_WLL_JOB_CLEARED]=timeout;
- }
- break;
-
- case 'n':
- if (get_timeout(optarg,&timeout) != 0 ) {
- printf("Wrong usage of timeout argument.\n");
- usage(me);
- return 1;
- }
- if (timeout >= 0) {
- request->timeout[EDG_WLL_JOB_CANCELLED]=timeout;
- }
- break;
- case 'o':
- if (get_timeout(optarg,&timeout) != 0 ) {
- printf("Wrong usage of timeout argument.\n");
- usage(me);
- return 1;
- }
- if (timeout >= 0) request->timeout[EDG_WLL_PURGE_JOBSTAT_OTHER]= timeout;
- break;
-
- case 'm': server = optarg; break;
- case 'j': file = optarg; break;
- case 'r': request->flags &= (~EDG_WLL_PURGE_REALLY_PURGE); break;
- case 'l': request->flags |= EDG_WLL_PURGE_LIST_JOBS; break;
- case 's': request->flags |= EDG_WLL_PURGE_SERVER_DUMP; break;
- case 'i': request->flags |= EDG_WLL_PURGE_CLIENT_DUMP; break;
- case 'd': debug = 1; break;
- case 'v': fprintf(stdout,"%s:\t%s\n",me,rcsid); exit(0);
- case 'h':
- case '?': usage(me); return 1;
- }
- }
-
- /* Initialize Globus common module */
- dprintf(("Initializing Globus common module..."));
- if (globus_module_activate(GLOBUS_COMMON_MODULE) != GLOBUS_SUCCESS) {
- dprintf(("no.\n"));
- fprintf(stderr,"Unable to initialize Globus common module\n");
- } else {
- dprintf(("yes.\n"));
- }
-
- /* initialize context */
- edg_wll_InitContext(&ctx);
-
- /* read the jobIds from file, if wanted */
- if (file) {
- char **jobs=NULL;
- dprintf(("Reading jobIds form file \'%s\'...",file));
- if (read_jobIds(file,&jobs) != 0) {
- dprintf(("no.\n"));
- fprintf(stderr,"Unable to read jobIds from file \'%s\'\n",file);
- goto main_end;
- } else {
- dprintf(("yes.\n"));
- }
- request->jobs = jobs;
- }
-
- /* check request */
- if (debug) {
- printf("Purge request:\n");
- printf("- flags: %d\n",request->flags);
- printf("- %d timeouts:\n",EDG_WLL_NUMBER_OF_STATCODES);
- for (i=0; i < EDG_WLL_NUMBER_OF_STATCODES; i++) {
- char *stat=edg_wll_StatToString(i);
- printf("\t%s: %ld\n",stat,request->timeout[i]);
- if (stat) free(stat);
- }
- printf("- list of jobs:\n");
- if (!request->jobs) {
- printf("Not specified.\n");
- } else {
- for ( i = 0; request->jobs[i]; i++ )
- printf("%s\n", request->jobs[i]);
- }
- }
-
- if ( server )
- {
- char *p = strchr(server, ':');
- if ( p )
- {
- edg_wll_SetParam(ctx, EDG_WLL_PARAM_QUERY_SERVER_PORT, atoi(p+1));
- *p = 0;
- }
- edg_wll_SetParam(ctx, EDG_WLL_PARAM_QUERY_SERVER, server);
- }
-
- /* that is the Purge */
- dprintf(("Running the edg_wll_Purge...\n"));
- if (edg_wll_Purge(ctx, request, result) != 0) {
- fprintf(stderr,"Error running the edg_wll_Purge().\n");
- printerr(ctx);
- switch ( edg_wll_Error(ctx, NULL, NULL) )
- {
- case ENOENT:
- case EPERM:
- case EINVAL:
- break;
- default:
- goto main_end;
- }
- }
-
- /* examine the result */
- dprintf(("Examining the result of edg_wll_Purge...\n"));
- if (result->server_file) {
- printf("Server dump: %s\n",result->server_file);
- } else {
- printf("The jobs were not dumped.\n");
- }
- if (request->flags & EDG_WLL_PURGE_LIST_JOBS) {
- printf("The following jobs %s purged:\n",
- request->flags & EDG_WLL_PURGE_REALLY_PURGE ? "were" : "would be");
- if (!result->jobs) printf("None.\n");
- else {
- int i;
- for ( i = 0; result->jobs[i]; i++ )
- printf("%s\n",result->jobs[i]);
- }
- }
-
-main_end:
- dprintf(("End.\n"));
- if (request)
- {
- free_jobs(request->jobs);
- free(request);
- }
- if (result) free(result);
- edg_wll_FreeContext(ctx);
- return 0;
-}
-
-
-static void printerr(edg_wll_Context ctx)
-{
- char *errt,*errd;
-
- edg_wll_Error(ctx,&errt,&errd);
- fprintf(stderr,"%s (%s)\n",errt,errd);
-}
-
-
-static int read_jobIds(const char *file, char ***jobs_out)
-{
- FILE *jobIds = fopen(file,"r");
- char buf[256];
- char **jobs;
- int cnt = 0;
-
- jobs = NULL;
-
-
- if (!jobIds) {
- perror(file);
- return 1;
- }
-
- while ( 1 ) {
- char *nl;
- if ( !fgets(buf,sizeof buf,jobIds) )
- {
- if (feof(jobIds))
- break;
-
- free_jobs(jobs);
- fprintf(stderr, "Error reading file\n");
- return 1;
- }
- nl = strchr(buf,'\n');
- if (nl) *nl = 0;
- /* TODO: check if it is really jobId, e.g. by edg_wlc_JobIdParse() */
-
- if ( !(jobs = realloc(jobs, (cnt+2)*sizeof(*jobs))) )
- {
- perror("cond_parse()");
- return(1);
- }
- jobs[cnt++] = strdup(buf);
- }
- jobs[cnt] = NULL;
-
- fclose(jobIds);
- *jobs_out = jobs;
-
- return 0;
-}
-
-static int get_timeout(const char *arg, int *timeout)
-{
- int t = -1;
- char tunit = '\0';
-
- if (sscanf(arg,"%d%c",&t,&tunit) > 0) {
- if (tunit) {
- switch (tunit) {
- case 'd': t *= 86400; break; // 24*60*60
- case 'h': t *= 3600; break; // 60*60
- case 'm': t *= 60; break;
- case 's': break;
- default: fprintf(stderr,"Allowed time units are s,m,h,d\n");
- return -1;
- }
- }
- }
- if (t < 0) return -1;
- *timeout = t;
- return 0;
-}
-
-static const char* const request_headers[] = {
- "Cache-Control: no-cache",
- "Accept: application/x-dglb",
- "User-Agent: edg_wll_Api/" PROTO_VERSION "/" COMP_PROTO,
- "Content-Type: application/x-dglb",
- NULL
-};
-
-int edg_wll_Purge(
- edg_wll_Context ctx,
- edg_wll_PurgeRequest *request,
- edg_wll_PurgeResult *result)
-{
- char *send_mess,
- *response = NULL,
- *recv_mess = NULL;
-
- edg_wll_ResetError(ctx);
-
- if (request->flags & EDG_WLL_PURGE_CLIENT_DUMP)
- return edg_wll_SetError(ctx,ENOSYS,"client dump");
-
- if (edg_wll_PurgeRequestToXML(ctx, request, &send_mess))
- goto edg_wll_purge_end;
-
- ctx->p_tmp_timeout = ctx->p_query_timeout;
- if (ctx->p_tmp_timeout.tv_sec < 600) ctx->p_tmp_timeout.tv_sec = 600;
-
- if (set_server_name_and_port(ctx, NULL))
- goto edg_wll_purge_end;
-
- if (edg_wll_http_send_recv(ctx,
- "POST /purgeRequest HTTP/1.1", request_headers, send_mess,
- &response, NULL, &recv_mess))
- goto edg_wll_purge_end;
-
- if (http_check_status(ctx, response, &recv_mess))
- goto edg_wll_purge_end;
-
- if (edg_wll_ParsePurgeResult(ctx, recv_mess, result))
- goto edg_wll_purge_end;
-
-edg_wll_purge_end:
- if (response) free(response);
- if (recv_mess) free(recv_mess);
- if (send_mess) free(send_mess);
- return edg_wll_Error(ctx,NULL,NULL);
-}
+++ /dev/null
-#ident "$Header$"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <errno.h>
-
-#include "glite/lb/statistics.h"
-#include "glite/lb/context.h"
-#include "glite/lb/context-int.h"
-#include "glite/lb/xml_parse.h"
-#include "glite/lb/mini_http.h"
-
-#include "connection.h"
-
-
-
-static const char* const request_headers[] = {
- "Cache-Control: no-cache",
- "Accept: application/x-dglb",
- "User-Agent: edg_wll_Api/" PROTO_VERSION "/" COMP_PROTO,
- "Content-Type: application/x-dglb",
- NULL
-};
-
-static int set_server_name_and_port(edg_wll_Context, const edg_wll_QueryRec **);
-
-
-
-/** Count the number of jobs which entered the specified state.
- */
-
-int edg_wll_StateRate(
- edg_wll_Context ctx,
- const edg_wll_QueryRec *group,
- edg_wll_JobStatCode major,
- int minor,
- time_t *from,
- time_t *to,
- float *rate,
- int *res_from,
- int *res_to)
-
-{
- char *response = NULL, *send_mess = NULL, *message = NULL;
- float not_returned;
-
-
- edg_wll_ResetError(ctx);
-
- edg_wll_StatsRequestToXML(ctx, "Rate", group, major, minor, from, to, &send_mess);
-
- if (set_server_name_and_port(ctx, NULL))
- goto err;
-
- ctx->p_tmp_timeout = ctx->p_query_timeout;
-
- if (edg_wll_http_send_recv(ctx, "POST /statsRequest HTTP/1.1",request_headers, send_mess,
- &response,NULL,&message))
- goto err;
-
- if (http_check_status(ctx,response))
- goto err;
-
- edg_wll_ParseStatsResult(ctx,message, from, to, rate,
- ¬_returned, res_from, res_to);
-
-err:
- free(response);
- free(message);
-
- return edg_wll_Error(ctx,NULL,NULL);
-}
-
-
-
-/** Compute average time for which jobs stay in the specified state.
- */
-
-int edg_wll_StateDuration(
- edg_wll_Context ctx,
- const edg_wll_QueryRec *group,
- edg_wll_JobStatCode major,
- int minor,
- time_t *from,
- time_t *to,
- float *duration,
- int *res_from,
- int *res_to)
-{
- char *response = NULL, *send_mess = NULL, *message = NULL;
- float not_returned;
-
-
- edg_wll_ResetError(ctx);
-
- edg_wll_StatsRequestToXML(ctx, "Duration", group, major, minor, from, to, &send_mess);
-
- if (set_server_name_and_port(ctx, NULL))
- goto err;
-
- ctx->p_tmp_timeout = ctx->p_query_timeout;
-
- if (edg_wll_http_send_recv(ctx, "POST /statsRequest HTTP/1.1",request_headers, send_mess,
- &response,NULL,&message))
- goto err;
-
- if (http_check_status(ctx,response))
- goto err;
-
- edg_wll_ParseStatsResult(ctx,message, from, to, ¬_returned,
- duration, res_from, res_to);
-
-err:
- free(response);
- free(message);
-
- return edg_wll_Error(ctx,NULL,NULL);
-}
-
-
-
-static int set_server_name_and_port(edg_wll_Context ctx, const edg_wll_QueryRec **job_conditions)
-{
- int i = 0, j,
- found = 0,
- error = 0;
- int srvPort = 0,
- srvPortTmp;
- char *srvName = NULL,
- *srvNameTmp;
-
-
- if ( job_conditions ) for ( j = 0; job_conditions[j]; j++ )
- for ( i = 0; (job_conditions[j][i].attr != EDG_WLL_QUERY_ATTR_UNDEF); i++ )
- if ( job_conditions[j][i].attr == EDG_WLL_QUERY_ATTR_JOBID)
- {
- edg_wlc_JobIdGetServerParts(job_conditions[j][i].value.j,&srvNameTmp,&srvPortTmp);
- if ( found )
- {
- if ( strcmp(srvName, srvNameTmp) || (srvPort != srvPortTmp) )
- {
- free(srvNameTmp); free(srvName);
- return edg_wll_SetError(ctx, EINVAL, "Two different servers specifieed in one query");
- }
- free(srvNameTmp);
- }
- else
- {
- srvName = srvNameTmp;
- srvPort = srvPortTmp;
- found = 1;
- }
- }
-
- if ( found && !ctx->p_query_server_override)
- {
- if (!ctx->srvName)
- {
- ctx->srvName = strdup(srvName);
- ctx->srvPort = srvPort;
- free(srvName);
- }
- else if (strcmp(srvName, ctx->srvName) || (srvPort != ctx->srvPort))
- {
- free(ctx->srvName);
- ctx->srvName = strdup(srvName);
- ctx->srvPort = srvPort;
- free(srvName);
- }
- }
- else if ( !ctx->srvName || !ctx->srvPort )
- {
- if (!ctx->p_query_server)
- return(edg_wll_SetError(ctx, (edg_wll_ErrorCode) EINVAL, "Hostname of server to query is not set"));
- else ctx->srvName = strdup(ctx->p_query_server);
- if (!ctx->p_query_server_port)
- return(edg_wll_SetError(ctx, (edg_wll_ErrorCode) EINVAL, "Port of server to query is not set"));
- else ctx->srvPort = ctx->p_query_server_port;
- }
-
- return(error);
-}
-
-
+++ /dev/null
-#ident "$Header$"
-/*
-@@@AUTO
-*/
-@@@LANG: C
-
-#include "glite/wmsutils/jobid/cjobid.h"
-#include "glite/lb/producer.h"
-
-@@@{
-for my $t (sort { $event->{order}->{$a} <=> $event->{order}->{$b} }
- $event->getTypes) {
- my $tu = uc $t;
- my $a = "(edg_wll_Context context";
- my $b = "(context,EDG_WLL_EVENT_$tu,EDG_WLL_FORMAT_$tu";
- my $decl = "";
- my $free = "";
- my $doc = qq{
- * \\param context\tcontext to work with,
-};
- selectType $event $t;
- for ($event->getFieldsOrdered) {
- my $f = selectField $event $_;
- my $fn = $f->getName;
- my $ft;
- my $bfn = $fn;
- if ($f->{codes}) {
-# $ft = "enum edg_wll\_$t" . ucfirst $fn;
- $ft = "char *";
- } else {
- $ft = $f->getType;
- }
- if ($ULMasString{$f->{type}}) {
- $decl .= "\tchar *s_$fn = ".$f->getType()."ToString($fn);\n";
- $free .= "\tfree(s_$fn);\n";
- $bfn = "s_$fn";
- }
- $ft = "const ".$ft;
- my $fc = $f->getComment;
- $a = $a . ", $ft $fn";
- $b = $b . ", $bfn";
- $doc = $doc . " * \\param $fn\t$fc\n";
- }
- $a = $a . ")";
- $b = $b . ")";
-
- gen qq{
-/*!
- * \\fn int edg_wll_Log$t$a;
- * \\brief simple wrapper around edg_wll_LogEvent for event $t} . $doc . qq{ * \\see edg_wll_LogEvent\(\)
- */
-};
-# gen "\nextern int edg_wll_Log$t$a;\n\n";
- gen qq{
-int edg_wll_Log$t$a
-\{
-$decl
- return edg_wll_LogEvent$b;
-\}\n
-};
- gen qq{
-int edg_wll_Log${t}Proxy$a
-\{
-$decl
- return edg_wll_LogEventProxy$b;
-\}\n
-};
- for ($event->getFieldsOrdered) {
- my $f = selectField $event $_;
- my $fn = $f->getName;
- my $ft;
- if ($f->{codes}) {
-# $ft = "enum edg_wll\_$t" . ucfirst $fn;
- $ft = "char *";
- } else {
- $ft = $f->getType;
- }
- my $ftreg = $ft;
- $ftreg =~ s/\*/\\\*/g;
- $ftreg = "const ".$ftreg;
- my $fc = $f->getComment;
- if ($f->{codes}) {
- for (@{$f->{codes}}) {
- my $code = uc $_->{name};
- my $c = $a;
- my $d = $b;
- my $e = $doc;
- $c =~ s/, $ftreg $fn//g;
- $d =~ s/$fn/"$code"/g;
- $e =~ s/ \* \\param $fn\t$fc\n//g;
- gen qq{
-/*!
- * \\fn int edg_wll_Log$t$code$c;
- * \\brief simple wrapper around edg_wll_LogEvent for event $t, $fn $code} . $e . qq{ * \\see edg_wll_LogEvent\(\)
- */
-};
-# gen "\nextern int edg_wll_Log$t$code$c;\n\n";
- gen qq{
-int edg_wll_Log$t$code$c
-\{
-$decl
- return edg_wll_LogEvent$d;
-\}\n
-};
- gen qq{
-int edg_wll_Log$t${code}Proxy$c
-\{
-$decl
- return edg_wll_LogEventProxy$d;
-\}\n
-};
- }
- }
- }
-}
-@@@}
+++ /dev/null
-#!/bin/bash
-
-for i in /tmp/test_ORG /tmp/test_ORG.LB_BUF /tmp/test_ORG.LB_BUF_LB_DAG_EMBRIONIC /tmp/test_ORG.LB_DAG_EMBRIONIC /tmp/test_ORG.LB_BUF_LB_DAG_EMBRIONIC_*[0-9] /tmp/test_ORG.LB_BUF_LB_DAG_EMBRIONIC_10;
-#for i in /tmp/test_ORG.LB_BUF_LB_DAG_EMBRIONIC_10;
-do
-
- #cat $i | grep 1000| sed 's/(//'| awk 'BEGIN {a=8002}; // {print a " " $8 " " sqrt(500000/a); a=a+16004}' > $i.plot;
- lines=`cat $i | wc -l| sed 's/ //g'`
- cat $i | grep 1000| sed 's/(//'| awk -v lines=$lines 'BEGIN {a=500}; // {print a " " $8 " " lines*1000/a; a=a+1000}' > $i.plot;
-# cat $i | grep 1000| sed 's/(//'| awk -v lines=$lines 'BEGIN {a=500}; // {print a " " $8 " " 1; a=a+1000}' > $i.plot;
-
-
-cat <<EOF >/tmp/plot.gp
-f(x) = a*log(x+b) + c
-a=0
-b=1
-c=0
-fit f(x) '$i.plot' using 1:2:3 via a, b, c
-print "f(100000) = ", f(100000)
-EOF
-
-a=`gnuplot /tmp/plot.gp 2>&1| awk '/^a.*=.*%/ {print $3}'`
-b=`gnuplot /tmp/plot.gp 2>&1| awk '/^b.*=.*%/ {print $3}'`
-c=`gnuplot /tmp/plot.gp 2>&1| awk '/^c.*=.*%/ {print $3}'`
-f100000=`gnuplot /tmp/plot.gp 2>&1| awk '/^f\(100000\)/ {print $3}'`
-
-
-cat <<EOF >/tmp/plot_final.gp
-f(x) = a*log(x+b) + c
-a=0
-b=1
-c=0
-fit f(x) "$i.plot" using 1:2:3 via a, b, c
-set xlabel "Number of jobs in DB"
-set ylabel "Millions of registrations per day"
-set title "Megajob challenge performance measurement"
-set out "$i.ps"
-set terminal postscript landscape "Helvetica" 14
-plot '$i.plot', f(x) title "f(x) = a * log(x+b) + c [a=$a b=$b c=$c] ",\
- f(100000) title "f(100000) = $f100000"
-print f(100000)
-print f(1000000)
-print f(10000000)
-EOF
-
-gnuplot /tmp/plot_final.gp
-
-done
+++ /dev/null
-#!/bin/bash
-
-TEST_SCRIPT=/home/mulac/src/ORG/org.glite.lb.client/src/perftest_jobreg.sh
-
-db_clean() {
- mysql -u lbserver -e "delete from users;" lbserver20_test
- mysql -u lbserver -e "delete from status_tags;" lbserver20_test
- mysql -u lbserver -e "delete from states;" lbserver20_test
- mysql -u lbserver -e "delete from short_fields;" lbserver20_test
- mysql -u lbserver -e "delete from jobs;" lbserver20_test
- mysql -u lbserver -e "delete from events;" lbserver20_test
- mysql -u lbserver -e "delete from server_state;" lbserver20_test
- mysql -u lbserver -e "delete from notif_registrations;" lbserver20_test
- mysql -u lbserver -e "delete from notif_jobs;" lbserver20_test
- mysql -u lbserver -e "delete from long_fields;" lbserver20_test
- mysql -u lbserver -e "delete from acls;" lbserver20_test
-}
-
-
-#db_clean;
-GLITE_LOCATION=/home/mulac/src/ORG.LB_BUF_LB_DAG_EMBRIONIC/stage
-#killall -9 glite-lb-bkserverd
-LB_BUF_BYTES=0
-LB_BUF_LINES=10
-$TEST_SCRIPT 1>>/tmp/test_ORG.LB_BUF_LB_DAG_EMBRIONIC_10 2>>/tmp/test_ORG.LB_BUF_LB_DAG_EMBRIONIC_10
-
-exit(0);
-
-db_clean;
-GLITE_LOCATION=/home/mulac/src/ORG/stage
-#for i in `seq 1 30`; do $TEST_SCRIPT ; done 2>>/tmp/test_ORG 1>>/tmp/test_ORG
-killall -9 glite-lb-bkserverd
-$TEST_SCRIPT &>/tmp/test_ORG
-
-db_clean;
-GLITE_LOCATION=/home/mulac/src/ORG.LB_BUF/stage
-#for i in `seq 1 30`; do $TEST_SCRIPT ; done &>/tmp/test_ORG.LB_BUF
-killall -9 glite-lb-bkserverd
-$TEST_SCRIPT &>/tmp/test_ORG.LB_BUF
-
-db_clean;
-GLITE_LOCATION=/home/mulac/src/ORG.LB_DAG_EMBRIONIC/stage
-#for i in `seq 1 30`; do $TEST_SCRIPT ; done &>/tmp/test_ORG.LB_DAG_EMBRIONIC
-killall -9 glite-lb-bkserverd
-$TEST_SCRIPT &>/tmp/test_ORG.LB_DAG_EMBRIONIC
-
-db_clean;
-GLITE_LOCATION=/home/mulac/src/ORG.LB_BUF_LB_DAG_EMBRIONIC/stage
-#for i in `seq 1 30`; do $TEST_SCRIPT; done &>/tmp/test_ORG.LB_BUF_LB_DAG_EMBRIONIC
-unset LB_BUF_BYTES
-unset LB_BUF_LINES
-killall -9 glite-lb-bkserverd
-$TEST_SCRIPT &>/tmp/test_ORG.LB_BUF_LB_DAG_EMBRIONIC
-
-db_clean;
-GLITE_LOCATION=/home/mulac/src/ORG.LB_BUF_LB_DAG_EMBRIONIC/stage
-killall -9 glite-lb-bkserverd
-LB_BUF_BYTES=0
-LB_BUF_LINES=5
-$TEST_SCRIPT &>/tmp/test_ORG.LB_BUF_LB_DAG_EMBRIONIC_5
-
-db_clean;
-GLITE_LOCATION=/home/mulac/src/ORG.LB_BUF_LB_DAG_EMBRIONIC/stage
-killall -9 glite-lb-bkserverd
-LB_BUF_BYTES=0
-LB_BUF_LINES=20
-$TEST_SCRIPT &>/tmp/test_ORG.LB_BUF_LB_DAG_EMBRIONIC_20
-
-
-db_clean;
-GLITE_LOCATION=/home/mulac/src/ORG.LB_BUF_LB_DAG_EMBRIONIC/stage
-killall -9 glite-lb-bkserverd
-LB_BUF_BYTES=0
-LB_BUF_LINES=100
-$TEST_SCRIPT &>/tmp/test_ORG.LB_BUF_LB_DAG_EMBRIONIC_100
-
-
-db_clean;
-GLITE_LOCATION=/home/mulac/src/ORG.LB_BUF_LB_DAG_EMBRIONIC/stage
-killall -9 glite-lb-bkserverd
-LB_BUF_BYTES=0
-LB_BUF_LINES=500
-$TEST_SCRIPT &>/tmp/test_ORG.LB_BUF_LB_DAG_EMBRIONIC_500
-
-
-db_clean;
-GLITE_LOCATION=/home/mulac/src/ORG.LB_BUF_LB_DAG_EMBRIONIC/stage
-killall -9 glite-lb-bkserverd
-LB_BUF_BYTES=0
-LB_BUF_LINES=100
-$TEST_SCRIPT &>/tmp/test_ORG.LB_BUF_LB_DAG_EMBRIONIC_1000
-
-
-exit 0;
-
+++ /dev/null
-#define edg_wll_gss_read_full(a,b,c,d,e,f) test_edg_wll_gss_read_full(a,b,c,d,e,f)
-#define edg_wll_gss_write_full(a,b,c,d,e,f) test_edg_wll_gss_write_full(a,b,c,d,e,f)
-
-#include "prod_proto.h"
-#include "glite/lb/producer.h"
-
-/* virtual read will return all zeroes (answer from logger always without error) */
-int
-test_edg_wll_gss_read_full(edg_wll_GssConnection *con,
- void *buf,
- size_t bufsize,
- struct timeval *timeout,
- size_t *total,
- edg_wll_GssStatus *code)
-{
- code->major_status = 0;
- code->minor_status = 0;
- if (bufsize > 0) memset(buf, 0, bufsize);
- return bufsize;
-}
-
-int
-test_edg_wll_gss_write_full(edg_wll_GssConnection *con,
- const void *buf,
- size_t bufsize,
- struct timeval *timeout,
- size_t *total,
- edg_wll_GssStatus *code)
-{
- *total = write(*(int *)con, buf, bufsize);
- code->major_status = 0;
- code->minor_status = *total < 0 ? *total : 0;
- return *total < 0 ? *total : 0;
-}
-
-#include "prod_proto.c"
+++ /dev/null
-#include <iostream>
-
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/CompilerOutputter.h>
-#include <cppunit/extensions/TestFactoryRegistry.h>
-#include <cppunit/ui/text/TestRunner.h>
-
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <sys/time.h>
-#include <unistd.h>
-#include <errno.h>
-#include <assert.h>
-#include <string.h>
-
-#include "glite/lb/context-int.h"
-#include "glite/lb/log_proto.h"
-
-extern "C" {
-int edg_wll_log_write(edg_wll_Context, int *,char *);
-int edg_wll_log_read(edg_wll_Context, int *);
-int edg_wll_log_proxy_write(edg_wll_Context, int *,char *);
-int edg_wll_log_proxy_read(edg_wll_Context, int *);
-int edg_wll_log_direct_write(edg_wll_Context, int *,char *);
-int edg_wll_log_direct_read(edg_wll_Context, int *);
-}
-
-class ProducerTest: public CppUnit::TestFixture
-{
- CPPUNIT_TEST_SUITE(ProducerTest);
- CPPUNIT_TEST(testProtoClient);
- CPPUNIT_TEST_SUITE_END();
-
-public:
-
- void setUp() {
- pipe(pd);
- }
-
- void tearDown() {
- close(pd[0]);
- close(pd[1]);
- }
-
- void testProtoClient() {
- edg_wll_Context context;
- int err;
- static char *tst_msg = "DATE=20040831150159.702224 HOST=\"some.host\" PROG=edg-wms LVL=USAGE DG.PRIORITY=0 DG.SOURCE=\"UserInterface\" DG.SRC_INSTANCE=\"\" DG.EVNT=\"RegJob\" DG.JOBID=\"https://some.host:1234/x67qr549qc\" DG.SEQCODE=\"UI=2:NS=0:WM=0:BH=1:JSS=0:LM=0:LRMS=0:APP=0\" DG.REGJOB.JDL=\"\" DG.REGJOB.NS=\"ns address\" DG.REGJOB.PARENT=\"\" DG.REGJOB.JOBTYPE=\"SIMPLE\" DG.REGJOB.NSUBJOBS=\"0\" DG.REGJOB.SEED=\"\"";
- int size = strlen(tst_msg)+1+EDG_WLL_LOG_SOCKET_HEADER_LENGTH+sizeof(size);
-
- err = edg_wll_InitContext(&context);
- CPPUNIT_ASSERT(err == 0);
- err = edg_wll_log_write(context, &pd[1], tst_msg);
- CPPUNIT_ASSERT(err == size);
- err = edg_wll_log_read(context, &pd[1]);
- CPPUNIT_ASSERT(err == 0);
- log_proto_server(pd[0], tst_msg);
- edg_wll_FreeContext(context);
- }
-
-private:
- int pd[2];
- int sock;
-
- void log_proto_server(int con, char *logline) {
- int i;
- char b[5];
- char *buf;
- ssize_t size, retsize;
-
- // read DGLOG
- retsize = read(con, b, 5);
- CPPUNIT_ASSERT(retsize == 5);
- CPPUNIT_ASSERT(b[0] == 'D' && b[1] == 'G' && b[2] == 'L' && b[3] == 'O' && b[4] == 'G');
-
- // read size (including '\0', little endian)
- for (i = 0; i < 4; i++)
- CPPUNIT_ASSERT(read(con, b + i, 1) == 1);
- size = 0;
- for (i = 0; i < 4; i++)
- size = (size << 8) + b[3-i];
-
- // read the message
- buf = (char *)malloc(size);
- retsize = read(con, buf, size);
- CPPUNIT_ASSERT(size == retsize);
-
- CPPUNIT_ASSERT(strcmp(buf, logline) == 0);
- free(buf);
- }
-};
-
-
-CPPUNIT_TEST_SUITE_REGISTRATION( ProducerTest );
-
-int
-main (int ac,const char *av[])
-{
- CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
- CppUnit::TextUi::TestRunner runner;
-
- runner.addTest(suite);
- return runner.run() ? 0 : 1;
-}
+++ /dev/null
-.project
-.cdtproject
\ No newline at end of file
+++ /dev/null
-LICENSE file for EGEE Middleware\r
-================================\r
-\r
-Copyright (c) 2004 on behalf of the EU EGEE Project: \r
-The European Organization for Nuclear Research (CERN), \r
-Istituto Nazionale di Fisica Nucleare (INFN), Italy\r
-Datamat Spa, Italy\r
-Centre National de la Recherche Scientifique (CNRS), France\r
-CS Systeme d'Information (CSSI), France\r
-Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden\r
-Universiteit van Amsterdam (UvA), Netherlands\r
-University of Helsinki (UH.HIP), Finlan\r
-University of Bergen (UiB), Norway\r
-Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom\r
-\r
-Redistribution and use in source and binary forms, with or without\r
-modification, are permitted provided that the following conditions are\r
-met: \r
-\r
-1. Redistributions of source code must retain the above copyright\r
-notice, this list of conditions and the following disclaimer.\r
-\r
-2. Redistributions in binary form must reproduce the above copyright\r
-notice, this list of conditions and the following disclaimer in the\r
-documentation and/or other materials provided with the distribution.\r
-\r
-3. The end-user documentation included with the redistribution, if\r
-any, must include the following acknowledgment: "This product includes\r
-software developed by The EU EGEE Project (http://cern.ch/eu-egee/)."\r
-Alternatively, this acknowledgment may appear in the software itself, if\r
-and wherever such third-party acknowledgments normally appear.\r
-\r
-4. The names EGEE and the EU EGEE Project must not be\r
-used to endorse or promote products derived from this software without\r
-prior written permission. For written permission, please contact\r
-<email address>.\r
-\r
-5. You are under no obligation whatsoever to provide anyone with any\r
-bug fixes, patches, or upgrades to the features, functionality or\r
-performance of the Software ("Enhancements") that you may develop over\r
-time; however, if you choose to provide your Enhancements to The EU\r
-EGEE Project, or if you choose to otherwise publish or distribute your\r
-Enhancements, in source code form without contemporaneously requiring\r
-end users of The EU EGEE Proejct to enter into a separate written license\r
-agreement for such Enhancements, then you hereby grant The EU EGEE Project\r
-a non-exclusive, royalty-free perpetual license to install, use, copy,\r
-modify, prepare derivative works, incorporate into the EGEE Middleware\r
-or any other computer software, distribute, and sublicense your\r
-Enhancements or derivative works thereof, in binary and source code\r
-form (if any), whether developed by The EU EGEE Project or third parties.\r
-\r
-THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED\r
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\r
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\r
-DISCLAIMED. IN NO EVENT SHALL PROJECT OR ITS CONTRIBUTORS BE LIABLE\r
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\r
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\r
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\r
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN\r
-IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
-\r
-This software consists of voluntary contributions made by many\r
-individuals on behalf of the EU EGEE Prject. For more information on The\r
-EU EGEE Project, please see http://cern.ch/eu-egee/. For more information on\r
-EGEE Middleware, please see http://egee-jra1.web.cern.ch/egee-jra1/\r
-\r
-\r
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- Copyright (c) 2004 on behalf of the EU EGEE Project:
- The European Organization for Nuclear Research (CERN),
- Istituto Nazionale di Fisica Nucleare (INFN), Italy
- Datamat Spa, Italy
- Centre National de la Recherche Scientifique (CNRS), France
- CS Systeme d'Information (CSSI), France
- Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden
- Universiteit van Amsterdam (UvA), Netherlands
- University of Helsinki (UH.HIP), Finland
- University of Bergen (UiB), Norway
- Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom
-
- Build file for the GLite Middleware Loggin and Bookkeeping Subsystem
-
- Authors: Ales Krenek <ljocha@ics.muni.cz>
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
- Revision 1.43.2.1 2007/03/29 20:05:00 akrenek
- disable utils temporarily
-
- Revision 1.43 2007/03/21 13:10:38 akrenek
- utils -> jp.primary (sync with 3.1)
-
- Revision 1.42 2006/03/24 08:26:11 akrenek
- missing utils->client dependency (should fix nightly build)
-
- Revision 1.41 2006/03/15 17:35:35 akrenek
- cares
-
- Revision 1.40 2006/03/15 17:33:24 akrenek
- merge of 1.5 branch
-
- Revision 1.39 2005/11/27 21:51:18 eronchie
- Applied fix for bug 13928
-
- Revision 1.38 2005/11/22 12:13:47 eronchie
- Removed one utils
-
- Revision 1.37 2005/11/04 14:39:20 akrenek
- merge in the "lbonly" hack
-
- Revision 1.36.4.6 2006/02/06 12:10:00 akrenek
- make proxy depend on logger explicitely
-
- Revision 1.36.4.5 2005/12/02 11:15:33 akrenek
- resolved logger dependency conflict
-
- Revision 1.36.4.4 2005/12/02 10:04:14 jpospi
- server depends on logger
-
- Revision 1.36.4.3 2005/11/28 10:39:08 akrenek
- merge bug #13928 fix on the pre_cares branch
-
- Revision 1.36.4.2 2005/11/24 12:59:36 akrenek
- server depends on bones
-
- Revision 1.36.4.1 2005/11/24 12:32:02 akrenek
- merged in "lbonly"
-
- Revision 1.39 2005/11/27 21:51:18 eronchie
- Applied fix for bug 13928
-
- Revision 1.38 2005/11/22 12:13:47 eronchie
- Removed one utils
-
- Revision 1.37 2005/11/04 14:39:20 akrenek
- merge in the "lbonly" hack
-
- Revision 1.36 2005/10/15 13:36:26 akrenek
- added lb.utils
-
- Revision 1.35 2005/10/14 17:19:08 akrenek
- build also lb.utils
-
- Revision 1.34 2005/10/14 11:02:06 akrenek
- depends on jp.primary
-
- Revision 1.33 2005/09/19 15:23:45 akrenek
- "The gigantic merge"; from release 1.4 branch to HEAD
-
- Revision 1.32.2.2 2005/10/31 12:45:10 akrenek
- conditional disabling of cross-subsystem builds via "lbonly" property
-
- Revision 1.32.2.1 2005/08/18 10:36:05 eronchie
- Added cross-subsystem dependencies feature in org.glite.lb subsystem.
- Added wms-utils.jobid and security.gsoap-plugin among common dependencies.
- Added security.voms among server dependencies.
- At the moment I have not consider gridsite.core component.
- Once built gridsiste component, run ant in org.glite.lb to build the whole lb
- and its external gLite dependencies.
-
- Revision 1.32 2005/08/03 11:58:25 akrenek
- Merged the release 1.0 branch
-
- Revision 1.31 2005/05/26 15:13:37 zurek
- inserted module.build.file
-
- Revision 1.30 2005/03/17 09:59:31 zsalvet
- Add proxy target.
-
- Revision 1.29 2005/03/16 10:02:52 zsalvet
- proxy component added
-
- Revision 1.28.2.1 2005/02/12 01:38:13 glbuild
- Changed start time
-
- Revision 1.28 2004/11/29 15:16:26 zsalvet
- Add ws-interface to checkout/build machinery.
-
- Revision 1.27 2004/11/29 13:55:02 akrenek
- added dependence on ws-interface
-
- Revision 1.26 2004/10/29 22:53:41 dimeglio
- Use envset target
-
- Revision 1.25 2004/10/28 22:57:36 dimeglio
- Quoted ant command line parameters
-
- Revision 1.24 2004/10/28 18:19:30 dimeglio
- Added envcheck to individual components
-
- Revision 1.23 2004/10/26 15:12:06 dimeglio
- Fixed spelling error in envchecks
-
- Revision 1.22 2004/10/26 13:11:13 dimeglio
- Added dependency of clean on envchecks
-
- Revision 1.21 2004/10/25 20:57:38 dimeglio
- Use antExec
-
- Revision 1.20 2004/10/21 10:37:48 akrenek
- make server depend on logger due to notification interlogger
-
- Revision 1.19 2004/10/15 12:30:01 akrenek
- build with lb.sever-bones
-
- Revision 1.18 2004/09/29 13:35:39 flammer
- Only update of line formatting.
-
- Revision 1.17 2004/09/09 21:05:29 dimeglio
- Moved tag target to targets-common
-
- Revision 1.16 2004/08/27 03:03:12 dimeglio
- Preserve original timestamp when copying file and overwrite when new
-
- Revision 1.15 2004/08/27 02:46:52 dimeglio
- Added logic to create the tagged dependencies properties file
-
- Revision 1.14 2004/08/26 23:48:26 dimeglio
- Added generation of cruisecontrol config file entry
-
- Revision 1.13 2004/08/09 04:56:14 dimeglio
- Replaced rtag with tag
-
- Revision 1.12 2004/08/09 04:36:44 dimeglio
- Fixed inheritance of do.cvs.tag property
-
- Revision 1.11 2004/08/09 03:06:11 dimeglio
- Fixed inheritance of failonerror property
-
- Revision 1.10 2004/08/09 02:35:35 dimeglio
- Set default value for failonerror
-
- Revision 1.9 2004/08/08 19:07:17 dimeglio
- Added small.memory type of build
-
- Revision 1.8 2004/07/29 10:47:46 dimeglio
- Added server and logger
-
- Revision 1.7 2004/07/29 07:39:57 dimeglio
- Removed local envinfo and envcheck target (must use common ones)
-
- Revision 1.6 2004/07/16 16:25:43 flammer
- Added tags for automated adding of components.
-
- Revision 1.5 2004/07/06 17:43:33 flammer
- Update of classpath definitions, targets & configure file.
-
- Revision 1.4 2004/06/23 00:24:03 dimeglio
- Added common and client modules
-
- Revision 1.3 2004/06/22 18:24:35 dimeglio
- Added client interface module
-
- Revision 1.2 2004/06/18 23:05:12 dimeglio
- Added/upgraded default build scripts
-
--->
-
-<project name="lb" default="dist">
-
- <description>
- Ant build file to build the GLite Logging and Bookkeping Subsystem
- </description>
-
- <!-- =========================================
- Builds the GLite LB subsystem
- ========================================= -->
-
- <!-- Import baseline & user properties -->
- <import file="../org.glite/project/baseline.properties.xml" />
-
- <!-- Import subsystem build properties,
- subsystem properties &
- subsystem common properties -->
- <import file="./project/properties.xml" />
-
- <!-- Import global build properties and global properties -->
- <import file="${global.properties.file}" />
-
- <!-- =========================================
- Load dependencies properties files (order is important)
- ========================================= -->
- <property file="${user.dependencies.file}"/>
- <property file="${subsystem.dependencies.file}"/>
- <property file="${global.dependencies.file}"/>
-
- <!-- =========================================
- Load configure options
- ========================================= -->
- <import file="${global.configure.options.file}"/>
-
- <!-- =========================================
- Import global task definitions
- ========================================= -->
- <import file="${global.taskdefs.file}" />
-
- <!-- =========================================
- Import global compiler definitions
- ========================================= -->
- <import file="${global.compilerdefs.file}" />
-
- <!-- =========================================
- Import targets
- ========================================= -->
- <import file="${global.targets-common.file}"/>
-
- <!-- =========================================
- Load version file
- ========================================= -->
- <property file="${module.version.file}"/>
- <property file="${module.build.file}"/>
-
- <!-- ===============================================
- Public common targets
- =============================================== -->
-
- <target name="localinit" depends="envcheck">
-
- <echo> Preparing directories ... </echo>
-
- <mkdir dir="${stage.bin.dir}" />
- <mkdir dir="${stage.lib.dir}" />
- <mkdir dir="${stage.java.dir}" />
- <mkdir dir="${stage.inc.dir}" />
- <mkdir dir="${stage.int.dir}" />
-
- <mkdir dir="${dist.dir}" />
-
- </target>
-
- <target name="init" depends="localinit">
- <antcall target="buildmodules">
- <param name="target" value="init"/>
- </antcall>
- </target>
-
- <target name="checkstyle" depends="localinit">
- <antcall target="buildmodules">
- <param name="target" value="checkstyle"/>
- </antcall>
- </target>
-
- <target name="compile" depends="localinit">
- <antcall target="buildmodules">
- <param name="target" value="compile"/>
- </antcall>
- </target>
-
- <target name="compiletest" depends="localinit">
- <antcall target="buildmodules">
- <param name="target" value="compiletest"/>
- </antcall>
- </target>
-
- <target name="unittest" depends="localinit">
- <antcall target="buildmodules">
- <param name="target" value="unittest"/>
- </antcall>
- </target>
-
- <target name="unitcoverage" depends="localinit">
- <antcall target="buildmodules">
- <param name="target" value="unitcoverage"/>
- </antcall>
- </target>
-
- <target name="stage" depends="localinit">
- <antcall target="buildmodules">
- <param name="target" value="stage"/>
- </antcall>
- </target>
-
- <target name="dist" depends="localinit">
- <antcall target="buildmodules">
- <param name="target" value="dist"/>
- </antcall>
- </target>
-
- <target name="install" depends="localinit">
- <antcall target="buildmodules">
- <param name="target" value="install"/>
- </antcall>
- </target>
-
- <target name="doc" depends="localinit">
- <antcall target="buildmodules">
- <param name="target" value="doc"/>
- </antcall>
- </target>
-
- <target name="all" depends="localinit">
- <antcall target="buildmodules">
- <param name="target" value="all"/>
- </antcall>
- </target>
-
- <target name="clean" depends="envcheck">
-
- <property name="offline.repository" value="true" />
- <antcall target="buildmodules">
- <param name="target" value="clean"/>
- </antcall>
-
- <delete dir="${module.bin.dir}" />
- <delete dir="${module.lib.dir}" />
- <delete dir="${module.autosrc.dir}" />
- <delete dir="${module.autodoc.dir}" />
- <delete dir="${module.test.reports.dir}" />
-
- </target>
-
- <target name="cleanAll" depends="clean"/>
-
- <!-- ===============================================
- Private targets
- =============================================== -->
-
- <!-- ===============================================
- Modules proxy targets
- =============================================== -->
-
- <!-- component targets definitions tag = do not remove = -->
-
- <target name="security.gsoap-plugin" unless="lbonly" depends="envset">
- <if>
- <isset property="small.memory"/>
- <then>
- <exec dir="${security.subsystem.dir}" executable="${antExec}" failonerror="${failonerror}">
- <arg line="gsoap-plugin -Dtarget=${target} -Dsmall.memory=true -Dbootstrap=${bootstrap} -Dfailonerror=${failonerror} -Ddo.cvs.tag=${do.cvs.tag}"/>
- </exec>
- </then>
- <else>
- <ant dir="${security.subsystem.dir}"
- target="gsoap-plugin"
- inheritall="false" >
- <property name="target" value="${target}"/>
- </ant>
- </else>
- </if>
- </target>
-
- <target name="security.voms-api-c" unless="lbonly" depends="envset">
- <if>
- <isset property="small.memory"/>
- <then>
- <exec dir="${security.subsystem.dir}" executable="${antExec}" failonerror="${failonerror}">
- <arg line="voms-api-c -Dtarget=${target} -Dsmall.memory=true -Dbootstrap=${bootstrap} -Dfailonerror=${failonerror} -Ddo.cvs.tag=${do.cvs.tag}"/>
- </exec>
- </then>
- <else>
- <ant dir="${security.subsystem.dir}"
- target="voms-api-c"
- inheritall="false" >
- <property name="target" value="${target}"/>
- </ant>
- </else>
- </if>
- </target>
-
- <target name="wms-utils.jobid" unless="lbonly" depends="envset">
- <if>
- <isset property="small.memory"/>
- <then>
- <exec dir="${wms-utils.subsystem.dir}" executable="${antExec}" failonerror="${failonerror}">
- <arg line="jobid -Dtarget=${target} -Dsmall.memory=true -Dbootstrap=${bootstrap} -Dfailonerror=${failonerror} -Ddo.cvs.tag=${do.cvs.tag}"/>
- </exec>
- </then>
- <else>
- <ant dir="${wms-utils.subsystem.dir}"
- target="jobid"
- inheritall="false" >
- <property name="target" value="${target}"/>
- </ant>
- </else>
- </if>
- </target>
-
- <target name="jp.primary" unless="lbonly" depends="envset">
- <if>
- <isset property="small.memory"/>
- <then>
- <exec dir="${jp.subsystem.dir}" executable="${antExec}" failonerror="${failonerror}">
- <arg line="primary -Dtarget=${target} -Dsmall.memory=true -Dbootstrap=${bootstrap} -Dfailonerror=${failonerror} -Ddo.cvs.tag=${do.cvs.tag}"/>
- </exec>
- </then>
- <else>
- <ant dir="${jp.subsystem.dir}"
- target="primary"
- inheritall="false" >
- <property name="target" value="${target}"/>
- </ant>
- </else>
- </if>
- </target>
-
- <if>
- <isset property="setenvonly"/>
- <then>
- <property name="lbonly" value="yes"/>
- </then>
- </if>
-
- <target name="client-interface" unless="setenvonly" depends="envset">
- <if>
- <isset property="small.memory" />
- <then>
- <exec dir="${lb.subsystem.dir}.client-interface" executable="${antExec}" failonerror="${failonerror}">
- <arg line="${target} "-Dsmall.memory=true" "-Dbootstrap=${bootstrap}" "-Dfailonerror=${failonerror}" "-Ddo.cvs.tag=${do.cvs.tag}""/>
- </exec>
- </then>
- <else>
- <ant dir="${lb.subsystem.dir}.client-interface"
- target="${target}"
- inheritall="false" />
- </else>
- </if>
- </target>
-
- <target name="ws-interface" unless="setenvonly" depends="envset">
- <if>
- <isset property="small.memory" />
- <then>
- <exec dir="${lb.subsystem.dir}.ws-interface" executable="${antExec}" failonerror="${failonerror}">
- <arg line="${target} "-Dsmall.memory=true" "-Dbootstrap=${bootstrap}" "-Dfailonerror=${failonerror}" "-Ddo.cvs.tag=${do.cvs.tag}""/>
- </exec>
- </then>
- <else>
- <ant dir="${lb.subsystem.dir}.ws-interface"
- target="${target}"
- inheritall="false" />
- </else>
- </if>
- </target>
-
- <target name="server-bones" unless="setenvonly" depends="envset">
- <if>
- <isset property="small.memory" />
- <then>
- <exec dir="${lb.subsystem.dir}.server-bones" executable="${antExec}" failonerror="${failonerror}">
- <arg line="${target} "-Dsmall.memory=true" "-Dbootstrap=${bootstrap}" "-Dfailonerror=${failonerror}" "-Ddo.cvs.tag=${do.cvs.tag}""/>
- </exec>
- </then>
- <else>
- <ant dir="${lb.subsystem.dir}.server-bones"
- target="${target}"
- inheritall="false" />
- </else>
- </if>
- </target>
-
- <target name="common" unless="setenvonly" depends="envset, globus, expat, c-ares, wms-utils.jobid, security.gsoap-plugin, client-interface">
- <if>
- <isset property="small.memory" />
- <then>
- <exec dir="${lb.subsystem.dir}.common" executable="${antExec}" failonerror="${failonerror}">
- <arg line="${target} "-Dsmall.memory=true" "-Dbootstrap=${bootstrap}" "-Dfailonerror=${failonerror}" "-Ddo.cvs.tag=${do.cvs.tag}""/>
- </exec>
- </then>
- <else>
- <ant dir="${lb.subsystem.dir}.common"
- target="${target}"
- inheritall="false" />
- </else>
- </if>
- </target>
-
- <target name="client" unless="setenvonly" depends="envset, globus, expat, c-ares, client-interface, common">
- <if>
- <isset property="small.memory" />
- <then>
- <exec dir="${lb.subsystem.dir}.client" executable="${antExec}" failonerror="${failonerror}">
- <arg line="${target} "-Dsmall.memory=true" "-Dbootstrap=${bootstrap}" "-Dfailonerror=${failonerror}" "-Ddo.cvs.tag=${do.cvs.tag}""/>
- </exec>
- </then>
- <else>
- <ant dir="${lb.subsystem.dir}.client"
- target="${target}"
- inheritall="false" />
- </else>
- </if>
- </target>
-
- <target name="server" unless="setenvonly" depends="envset, globus, expat, c-ares, mysql, gsoap, security.voms-api-c, jp.primary, client-interface, ws-interface, common, server-bones, logger">
- <if>
- <isset property="small.memory" />
- <then>
- <exec dir="${lb.subsystem.dir}.server" executable="${antExec}" failonerror="${failonerror}">
- <arg line="${target} "-Dsmall.memory=true" "-Dbootstrap=${bootstrap}" "-Dfailonerror=${failonerror}" "-Ddo.cvs.tag=${do.cvs.tag}""/>
- </exec>
- </then>
- <else>
- <ant dir="${lb.subsystem.dir}.server"
- target="${target}"
- inheritall="false" />
- </else>
- </if>
- </target>
-
- <target name="proxy" unless="setenvonly" depends="envset, globus, expat, c-ares, client-interface, common, server, logger">
- <if>
- <isset property="small.memory" />
- <then>
- <exec dir="${lb.subsystem.dir}.proxy" executable="${antExec}" failonerror="${failonerror}">
- <arg line="${target} "-Dsmall.memory=true" "-Dbootstrap=${bootstrap}" "-Dfailonerror=${failonerror}" "-Ddo.cvs.tag=${do.cvs.tag}""/>
- </exec>
- </then>
- <else>
- <ant dir="${lb.subsystem.dir}.proxy"
- target="${target}"
- inheritall="false" />
- </else>
- </if>
- </target>
-
- <target name="logger" unless="setenvonly" depends="envset, globus, expat, c-ares, client-interface, common">
- <if>
- <isset property="small.memory" />
- <then>
- <exec dir="${lb.subsystem.dir}.logger" executable="${antExec}" failonerror="${failonerror}">
- <arg line="${target} "-Dsmall.memory=true" "-Dbootstrap=${bootstrap}" "-Dfailonerror=${failonerror}" "-Ddo.cvs.tag=${do.cvs.tag}""/>
- </exec>
- </then>
- <else>
- <ant dir="${lb.subsystem.dir}.logger"
- target="${target}"
- inheritall="false" />
- </else>
- </if>
- </target>
-
- <target name="utils" unless="setenvonly" depends="envset, globus, expat, c-ares, client, server, jp.primary">
- <if>
- <isset property="small.memory"/>
- <then>
- <exec dir="${lb.subsystem.dir}.utils" executable="${antExec}" failonerror="${failonerror}">
- <arg line="${target} -Dsmall.memory=true -Dbootstrap=${bootstrap} -Dfailonerror=${failonerror} -Ddo.cvs.tag=${do.cvs.tag}"/>
- </exec>
- </then>
- <else>
- <ant dir="${lb.subsystem.dir}.utils"
- target="${target}"
- inheritall="false" />
- </else>
- </if>
- </target>
-
- <!-- Main proxy -->
- <target name="buildmodules" depends="envset,
- client-interface,
- ws-interface,
- client,
- server-bones,
- common,
- server,
- proxy,
- logger,
- utils">
- <echo append="true" file="${global.project.dir}/cruisecontrol-stub.xml">
- <project name="${subsystem.name}" type="post-subsystem" packageName="${global.prefix}-${subsystem.prefix}"/>
- </echo>
- </target>
-
-</project>
+++ /dev/null
-deploy_all.diff - against RC31
-deploy_lb, deploy_jp - older patches
+++ /dev/null
-Index: org.glite/project/global.dependencies.properties
-===================================================================
-RCS file: /cvs/jra1mw/org.glite/project/global.dependencies.properties,v
-retrieving revision 1.482.2.279
-diff -u -p -u -r1.482.2.279 global.dependencies.properties
---- org.glite/project/global.dependencies.properties 4 Aug 2006 12:21:59 -0000 1.482.2.279
-+++ org.glite/project/global.dependencies.properties 1 Sep 2006 14:23:09 -0000
-@@ -1819,7 +1819,25 @@ ext.globus-sdk.description = The Globus
- ext.globus-sdk.rpm.name = vdt_globus_sdk
- ext.globus-sdk.rpm.version = ${ext.vdt.version}
- ext.globus-sdk.rpm.age = ${ext.vdt.age}
--
-+
-+# Globus vdt data server - grid ftp server
-+ext.globus-data-server.name = ${ext.globus.name}
-+ext.globus-data-server.vendor = ${ext.globus.vendor}
-+ext.globus-data-server.version = ${ext.globus.version}
-+ext.globus-data-server.platform = ${platform}
-+ext.globus-data-server.subdir = ${ext.globus-data-server.name}/${ext.globus-data-server.version}/${ext.globus-data-server.platform}
-+ext.globus-data-server.rep.base = ${jra1.rep.base}
-+ext.globus-data-server.rep.file =
-+ext.globus-data-server.rep.subdir =
-+ext.globus-data-server.rep.url = ${ext.globus-data-server.rep.base}/${ext.globus-data-server.subdir}/${ext.globus-data-server.rep.subdir}/${ext.globus-data-server.rep.file}
-+ext.globus-data-server.files =
-+ext.globus-data-server.download = http://www.cs.wisc.edu/vdt/releases/1.2.2/installing-rpms.html
-+ext.globus-data-server.homepage = http://www.cs.wisc.edu/vdt//index.html
-+ext.globus-data-server.description = The Globus Toolkit(R). This is the version packaged by VDT.
-+ext.globus-data-server.rpm.name = vdt_globus_data_server
-+ext.globus-data-server.rpm.version = ${ext.vdt.version}
-+ext.globus-data-server.rpm.age = 1
-+
- # GPT
- ext.gpt.name = gpt
- ext.gpt.vendor = gpt
-Index: org.glite.deployment/build.xml
-===================================================================
-RCS file: /cvs/jra1mw/org.glite.deployment/build.xml,v
-retrieving revision 1.61.2.2.2.12.2.26
-diff -u -p -u -r1.61.2.2.2.12.2.26 build.xml
---- org.glite.deployment/build.xml 24 Apr 2006 13:39:27 -0000 1.61.2.2.2.12.2.26
-+++ org.glite.deployment/build.xml 1 Sep 2006 14:23:09 -0000
-@@ -1619,6 +1619,39 @@
- </if>
- </target>
-
-+ <target name="jpps" unless="setenvonly" depends="envset,config">
-+ <if>
-+ <isset property="small.memory"/>
-+ <then>
-+ <exec dir="${deployment.subsystem.dir}.jpps" executable="${antExec}" failonerror="${failonerror}">
-+ <arg line="${target} "-Dsmall.memory=true" "-Dbootstrap=${bootstrap}" "-Dfailonerror=${failonerror}" "-Ddo.cvs.tag=${do.cvs.tag}" "-Dbuild.name=${build.name}""/>
-+ </exec>
-+ </then>
-+ <else>
-+ <ant dir="${deployment.subsystem.dir}.jpps"
-+ target="${target}"
-+ inheritall="false" />
-+ </else>
-+ </if>
-+ </target>
-+
-+
-+ <target name="jpis" unless="setenvonly" depends="envset,config">
-+ <if>
-+ <isset property="small.memory"/>
-+ <then>
-+ <exec dir="${deployment.subsystem.dir}.jpis" executable="${antExec}" failonerror="${failonerror}">
-+ <arg line="${target} "-Dsmall.memory=true" "-Dbootstrap=${bootstrap}" "-Dfailonerror=${failonerror}" "-Ddo.cvs.tag=${do.cvs.tag}" "-Dbuild.name=${build.name}""/>
-+ </exec>
-+ </then>
-+ <else>
-+ <ant dir="${deployment.subsystem.dir}.jpis"
-+ target="${target}"
-+ inheritall="false" />
-+ </else>
-+ </if>
-+ </target>
-+
- <target name="io-server" unless="setenvonly" depends="envset,config">
- <if>
- <isset property="small.memory"/>
-@@ -1730,6 +1763,8 @@
- wn,
- wms,
- lb,
-+ jpps,
-+ jpis,
- io-server,
- io-client,
- ce,
-Index: org.glite.deployment/project/dependencies.properties
-===================================================================
-RCS file: /cvs/jra1mw/org.glite.deployment/project/dependencies.properties,v
-retrieving revision 1.526.2.5.2.127.2.415.2.203
-diff -u -p -u -r1.526.2.5.2.127.2.415.2.203 dependencies.properties
---- org.glite.deployment/project/dependencies.properties 30 Aug 2006 07:41:36 -0000 1.526.2.5.2.127.2.415.2.203
-+++ org.glite.deployment/project/dependencies.properties 1 Sep 2006 14:23:09 -0000
-@@ -47,6 +47,8 @@
- org.glite.deployment.hydra.version = glite-deployment-hydra_R_1_0_3
- org.glite.deployment.io-client.version = glite-deployment-io-client_R_2_2_0
- org.glite.deployment.io-server.version = glite-deployment-io-server_R_2_1_8
-+ org.glite.deployment.jpps.version = HEAD
-+ org.glite.deployment.jpis.version = HEAD
- org.glite.deployment.lb.version = glite-deployment-lb_R_2_2_4
- org.glite.deployment.lcg-CE_torque.version = glite-deployment-lcg-CE_torque_R_3_0_4
- org.glite.deployment.lcg-CE.version = glite-deployment-lcg-CE_R_3_0_5
-Index: org.glite.deployment/project/glite.deployment.csf.xml
-===================================================================
-RCS file: /cvs/jra1mw/org.glite.deployment/project/glite.deployment.csf.xml,v
-retrieving revision 1.44.2.1.2.11.2.24
-diff -u -p -u -r1.44.2.1.2.11.2.24 glite.deployment.csf.xml
---- org.glite.deployment/project/glite.deployment.csf.xml 18 Apr 2006 15:42:14 -0000 1.44.2.1.2.11.2.24
-+++ org.glite.deployment/project/glite.deployment.csf.xml 1 Sep 2006 14:23:09 -0000
-@@ -667,6 +667,14 @@
- <equals arg1="${org.glite.deployment.lb.version}" arg2="HEAD" />
- </condition>
-
-+ <condition property="jpps.head">
-+ <equals arg1="${org.glite.deployment.jpps.version}" arg2="HEAD" />
-+ </condition>
-+
-+ <condition property="jpis.head">
-+ <equals arg1="${org.glite.deployment.jpis.version}" arg2="HEAD" />
-+ </condition>
-+
- <condition property="io-server.head">
- <equals arg1="${org.glite.deployment.io-server.version}" arg2="HEAD" />
- </condition>
-@@ -1571,6 +1579,28 @@
- tag="${org.glite.deployment.lb.version}" />
- </target>
-
-+ <!-- jpps component -->
-+ <target name="jpps" depends="get.jpps.head, get.jpps.tag"/>
-+ <target name="get.jpps.head" if="jpps.head">
-+ <cvs-co package="org.glite.deployment.jpps" />
-+ </target>
-+
-+ <target name="get.jpps.tag" unless="jpps.head">
-+ <cvs-co package="org.glite.deployment.jpps"
-+ tag="${org.glite.deployment.jpps.version}" />
-+ </target>
-+
-+ <!-- jpis component -->
-+ <target name="jpis" depends="get.jpis.head, get.jpis.tag"/>
-+ <target name="get.jpis.head" if="jpis.head">
-+ <cvs-co package="org.glite.deployment.jpis" />
-+ </target>
-+
-+ <target name="get.jpis.tag" unless="jpis.head">
-+ <cvs-co package="org.glite.deployment.jpis"
-+ tag="${org.glite.deployment.jpis.version}" />
-+ </target>
-+
- <!-- io-server component -->
- <target name="io-server" depends="get.io-server.head, get.io-server.tag"/>
- <target name="get.io-server.head" if="io-server.head">
-@@ -1667,6 +1697,8 @@
- wn,
- wms,
- lb,
-+ jpis,
-+ jpps,
- io-server,
- io-client,
- ce" />
-Index: org.glite.deployment.lb/config/scripts/glite-lb-config.py
-===================================================================
-RCS file: /cvs/jra1mw/org.glite.deployment.lb/config/scripts/glite-lb-config.py,v
-retrieving revision 1.65.2.4
-diff -u -p -u -r1.65.2.4 glite-lb-config.py
---- org.glite.deployment.lb/config/scripts/glite-lb-config.py 26 May 2006 12:24:22 -0000 1.65.2.4
-+++ org.glite.deployment.lb/config/scripts/glite-lb-config.py 1 Sep 2006 14:23:10 -0000
-@@ -129,7 +129,12 @@ python %s-config [OPTION...]""" % (self.
-
- if not os.path.exists('/tmp/mysql.sock'):
- os.symlink('/var/lib/mysql/mysql.sock', '/tmp/mysql.sock')
--
-+
-+
-+ #-------------------------------------------------------------------
-+ # start bkserver
-+ #-------------------------------------------------------------------
-+
- pid = glib.getPID('bkserverd')
- if pid != 0:
- print 'The gLite LB Server service is already running. Restarting...'
-@@ -142,7 +147,7 @@ python %s-config [OPTION...]""" % (self.
- pid = glib.getPID('bkserverd')
-
- if (pid != 0):
-- print "The gLite LB Server service has been started ",
-+ print "The gLite LB Server service has been started ",
- glib.printOkMessage()
- else:
- glib.printErrorMessage("Could not start the gLite LB Server service")
-@@ -151,6 +156,36 @@ python %s-config [OPTION...]""" % (self.
- return 1
-
- #-------------------------------------------------------------------
-+ # start jp-importer, if enabled
-+ #-------------------------------------------------------------------
-+
-+ lb_export = 0
-+ if params.has_key('lb.export.enabled'):
-+ if params['lb.export.enabled'] == "true":
-+ lb_export = 1
-+
-+ if lb_export:
-+ pid = glib.getPID('jp-importer')
-+ if pid != 0:
-+ print 'The gLite JP Importer service is already running. Restarting...'
-+ os.system('%s/etc/init.d/glite-jp-importer stop' % os.environ['GLITE_LOCATION'])
-+ else:
-+ print 'Starting the gLite JP Importer service...'
-+
-+ os.system('%s/etc/init.d/glite-jp-importer start' % os.environ['GLITE_LOCATION'])
-+
-+ pid = glib.getPID('jp-importer')
-+
-+ if (pid != 0):
-+ print "The gLite JP Importer service has been started ",
-+ glib.printOkMessage()
-+ else:
-+ glib.printErrorMessage("Could not start the gLite JP Importer service")
-+ glib.printErrorMessage("Please verify and re-run the script "),
-+ glib.printFailedMessage()
-+ return 1
-+
-+ #-------------------------------------------------------------------
- # Start Servicetool
- #-------------------------------------------------------------------
-
-@@ -170,6 +205,10 @@ python %s-config [OPTION...]""" % (self.
- if (pid != 0):
- os.system('%s/etc/init.d/glite-lb-bkserverd stop' % os.environ['GLITE_LOCATION'])
-
-+ #-------------------------------------------------------------------
-+ # Book Keeping Server
-+ #-------------------------------------------------------------------
-+
- pid = glib.getPID('bkserverd')
- if (pid != 0):
- print 'Could not stop the LB Server service ',
-@@ -180,6 +219,25 @@ python %s-config [OPTION...]""" % (self.
- glib.printOkMessage()
-
- #-------------------------------------------------------------------
-+ # JP Importer
-+ #-------------------------------------------------------------------
-+
-+ pid = glib.getPID('jp-importer')
-+ if (pid != 0):
-+ os.system('%s/etc/init.d/glite-jp-importer stop' % os.environ['GLITE_LOCATION'])
-+
-+ pid = glib.getPID('jp-importer')
-+ if (pid != 0):
-+ print 'Could not stop the JP Importer service ',
-+ glib.printFailedMessage()
-+ error_level = 1
-+ else:
-+ if params.has_key('lb.export.enabled'):
-+ if params['lb.export.enabled'] == "true":
-+ print 'The JP Importer service has been stopped ',
-+ glib.printOkMessage()
-+
-+ #-------------------------------------------------------------------
- # MySQL
- #-------------------------------------------------------------------
-
-@@ -204,6 +262,10 @@ python %s-config [OPTION...]""" % (self.
- if retval != 0:
- error_level = 1
-
-+ retval = os.system('%s/etc/init.d/glite-jp-importer status' % os.environ['GLITE_LOCATION'])
-+ if retval != 0:
-+ error_level = 1
-+
- #-------------------------------------------------------------------
- # Servicetool
- #-------------------------------------------------------------------
-@@ -334,7 +396,29 @@ python %s-config [OPTION...]""" % (self.
- print "\n==> MySQL database %s already exist\n" % params['lb.database.name']
-
- self.mysql.stop()
--
-+
-+ # ------------------------------------------------------------------
-+ # export from bkserver to cron
-+ # ------------------------------------------------------------------
-+ if params['GLITE_LB_EXPORT_ENABLED'] == "true":
-+ file = open('%s/etc/glite-lb-export-cron-wrapper.sh' % os.environ['GLITE_LOCATION'], 'w')
-+ file.write('#! /bin/sh\n')
-+ file.write('. %s\n' % glib.getInstallerExportFile())
-+ file.write('$GLITE_LOCATION/sbin/glite-lb-export.sh\n')
-+ file.close()
-+ os.system('/bin/chmod 0755 %s/etc/glite-lb-export-cron-wrapper.sh' % os.environ['GLITE_LOCATION'])
-+
-+ file = open('/etc/cron.d/glite-lb-export.cron', 'w')
-+ file.write('# periodically run purge and export jobs from bkserver\n')
-+ file.write('00,30 * * * * %s %s/etc/glite-lb-export-cron-wrapper.sh 1>/dev/null\n' % (params['glite.user.name'], os.environ['GLITE_LOCATION']))
-+ file.close()
-+ os.system('/bin/chmod 0644 /etc/cron.d/glite-lb-export.cron')
-+ else
-+ os.system('/bin/rm -f /etc/cron.d/glite-lb-export.cron')
-+
-+ # Touch cron spool directory to cause reloading of the crontabs
-+ os.system("/bin/touch /var/spool/cron")
-+
- #-------------------------------------------------------------------
- # RGMA servicetool: configure servicetool
- #-------------------------------------------------------------------
-@@ -420,6 +504,19 @@ def set_env():
- # Perl
- glib.addEnvPath("PERL5LIB", "%s/lib/perl:%s/lib/perl5" % (os.environ['GPT_LOCATION'],os.environ['GLITE_LOCATION']))
-
-+ # LB export
-+ glib.export('GLITE_LB_EXPORT_ENABLED', params['lb.export.enabled']);
-+ glib.export('GLITE_LB_EXPORT_JPPS', params['lb.export.jpps']);
-+ glib.export('GLITE_LB_EXPORT_JPREG_MAILDIR', params['lb.export.jpreg']);
-+ glib.export('GLITE_LB_EXPORT_JPDUMP_MAILDIR', params['lb.export.jpdump']);
-+ glib.export('GLITE_LB_EXPORT_DUMPDIR', params['lb.export.dump']);
-+ glib.export('GLITE_LB_EXPORT_DUMPDIR_KEEP', params['lb.export.dump.keep']);
-+ glib.export('GLITE_LB_EXPORT_JOBSDIR', params['lb.export.jobs']);
-+ glib.export('GLITE_LB_EXPORT_JOBSDIR_KEEP', params['lb.export.jobs.keep']);
-+ glib.export('GLITE_LB_EXPORT_PURGEDIR', params['lb.export.purge']);
-+ glib.export('GLITE_LB_EXPORT_PURGEDIR_KEEP', params['lb.export.purge.keep']);
-+ glib.export('GLITE_LB_EXPORT_PURGE_ARGS', '%s' % params['lb.export.purgeargs']);
-+
- # Set environment
- glib.setUserEnv()
-
-Index: org.glite.deployment.lb/config/templates/glite-lb.cfg.xml
-===================================================================
-RCS file: /cvs/jra1mw/org.glite.deployment.lb/config/templates/glite-lb.cfg.xml,v
-retrieving revision 1.21
-diff -u -p -u -r1.21 glite-lb.cfg.xml
---- org.glite.deployment.lb/config/templates/glite-lb.cfg.xml 13 Mar 2006 15:19:21 -0000 1.21
-+++ org.glite.deployment.lb/config/templates/glite-lb.cfg.xml 1 Sep 2006 14:23:10 -0000
-@@ -17,9 +17,16 @@
- parameter. Leave it empty of comment it out to use the same as 'glite.user.name'"
- value="changeme"/>
-
-- <mysql.root.password
-- description="The mysql root password"
-- value="changeme"/>
-+ <mysql.root.password
-+ description="The mysql root password"
-+ value="changeme"/>
-+
-+ <lb.export.jpps
-+ description="Job Provenance Primary Storage.
-+ [Example: localhost:8901][Type: string]"
-+ value="changeme"/>
-+
-+
-
- <!-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -->
- <!-- Advanced parameters - Change them if you know what you're doing -->
-@@ -55,6 +62,12 @@
- [Example: 17M][Type: Integer][Unit: MB]"
- value="17M"/>
-
-+ <lb.export.enabled
-+ description="Enables exports to Job Provenance.
-+ [Example: true][Type: boolean]"
-+ value="false"/>
-+
-+
- <!-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -->
- <!-- System parameters - You should leave these alone -->
- <!-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -->
-@@ -67,7 +80,47 @@
- <value>destination</value>
-
- </lb.index.list>
--
-+
-+ <lb.export.jpreg
-+ description="Spool directory where job registration requests are stored before delivered to JPPS.
-+ [Type: string]"
-+ value="/tmp/jpreg"/>
-+
-+ <lb.export.jpdump
-+ description="Spool directory where dump upload requests are stored before delivered to JPPS.
-+ [Type: string]"
-+ value="/tmp/jpdump"/>
-+
-+ <lb.export.dump
-+ description="Temporary directory for monitoring dumps, it's cleaned automatically.
-+ [Type: string]"
-+ value="/tmp/dump"/>
-+
-+ <lb.export.purge
-+ description="Temporary directory for dumps of purged jobs.
-+ [Type: string]"
-+ value="/tmp/purge"/>
-+
-+ <lb.export.purge.keep
-+ description="Directory for dumps of jobs that were already handled (sent to JPPS).
-+ [Type: string]"
-+ value=""/>
-+
-+ <lb.export.jobs
-+ description="Exported events in file per job form before delivered to JPPS.
-+ [Type: string]"
-+ value="/tmp/lb_export"/>
-+
-+ <lb.export.jobs.keep
-+ description="Keep the already handled exported events in file per job form.
-+ [Type: string]"
-+ value=""/>
-+
-+ <lb.export.purgeargs
-+ description="Arguments for LB purge process (a job in a given terminal state will be exported from the LB after timeouts defined here). See also glite-lb-purge documentation.
-+ [Example: -c 1h -a 1h -n 1h -o 1d][Type: string]"
-+ value="--cleared 2d --aborted 2w --cancelled 2w --other 2m"/>
-+
- </parameters>
-
- </config>
-Index: org.glite.deployment.lb/project/glite-lb.sdf.xml.template
-===================================================================
-RCS file: /cvs/jra1mw/org.glite.deployment.lb/project/glite-lb.sdf.xml.template,v
-retrieving revision 1.38.2.2
-diff -u -p -u -r1.38.2.2 glite-lb.sdf.xml.template
---- org.glite.deployment.lb/project/glite-lb.sdf.xml.template 2 May 2006 10:36:19 -0000 1.38.2.2
-+++ org.glite.deployment.lb/project/glite-lb.sdf.xml.template 1 Sep 2006 14:23:10 -0000
-@@ -57,6 +57,12 @@
- build="@org.glite.lb.server-bones.info.build@"
- arch="i386"/>
-
-+ <component name="glite-lb-client"
-+ version="@org.glite.lb.client.info.version@"
-+ age="@org.glite.lb.client.info.age@"
-+ build="@org.glite.lb.client.info.build@"
-+ arch="i386"/>
-+
- <component name="glite-wms-utils-jobid"
- version="@org.glite.wms-utils.jobid.info.version@"
- age="@org.glite.wms-utils.jobid.info.age@"
-@@ -105,6 +111,12 @@
- build="@org.glite.jp.ws-interface.info.build@"
- arch="i386"/>
-
-+ <component name="glite-jp-client"
-+ version="@org.glite.jp.client.info.version@"
-+ age="@org.glite.jp.client.info.age@"
-+ build="@org.glite.jp.client.info.build@"
-+ arch="i386"/>
-+
- <component name="gridsite"
- version="@org.gridsite.core.info.version@"
- age="@org.gridsite.core.info.age@"
+++ /dev/null
-This patch was merged to deploy_all.diff, don't use it anymore
-
-Index: org.glite/project/global.dependencies.properties
-===================================================================
-RCS file: /cvs/jra1mw/org.glite/project/global.dependencies.properties,v
-retrieving revision 1.479.2.70.2.3.2.3.2.1
-diff -u -r1.479.2.70.2.3.2.3.2.1 global.dependencies.properties
---- org.glite/project/global.dependencies.properties 9 May 2006 16:17:50 -0000 1.479.2.70.2.3.2.3.2.1
-+++ org.glite/project/global.dependencies.properties 30 Jun 2006 11:13:49 -0000
-@@ -15,7 +15,7 @@
- # Authors: Joachim Flammer <joachim.flammer@cern.ch>
- #
- # Version info: $Id$
--# Release: $Name$
-+# Release: $Name$
- #
- # Revision history:
- # $Log$
- # Revision 1.3 2006/06/30 11:30:28 mmulac
- # actualized patches
- # - against org.glite a org.glite.deployment from glite_R_3_0_0
- #
-@@ -1562,7 +1562,26 @@
- ext.globus-sdk.rpm.name = vdt_globus_sdk
- ext.globus-sdk.rpm.version = ${ext.vdt.version}
- ext.globus-sdk.rpm.age = 1
--
-+
-+# Globus vdt data server - grid ftp server
-+ext.globus-data-server.name = ${ext.globus.name}
-+ext.globus-data-server.vendor = ${ext.globus.vendor}
-+ext.globus-data-server.version = ${ext.globus.version}
-+ext.globus-data-server.platform = ${platform}
-+ext.globus-data-server.subdir = ${ext.globus-data-server.name}/${ext.globus-data-server.version}/${ext.globus-data-server.platform}
-+ext.globus-data-server.rep.base = ${jra1.rep.base}
-+ext.globus-data-server.rep.file =
-+ext.globus-data-server.rep.subdir =
-+ext.globus-data-server.rep.url = ${ext.globus-data-server.rep.base}/${ext.globus-data-server.subdir}/${ext.globus-data-server.rep.subdir}/${ext.globus-data-server.rep.file}
-+ext.globus-data-server.files =
-+ext.globus-data-server.download = http://www.cs.wisc.edu/vdt/releases/1.2.2/installing-rpms.html
-+ext.globus-data-server.homepage = http://www.cs.wisc.edu/vdt//index.html
-+ext.globus-data-server.description = The Globus Toolkit(R). This is the version packaged by VDT.
-+ext.globus-data-server.rpm.name = vdt_globus_data_server
-+ext.globus-data-server.rpm.version = ${ext.vdt.version}
-+ext.globus-data-server.rpm.age = 1
-+
-+
- # GPT
- ext.gpt.name = gpt
- ext.gpt.vendor = gpt
-@@ -3266,8 +3285,9 @@
- org.glite.dgas.version = glite-dgas_R_1_1_16
- org.glite.gpbox.version = glite-gpbox_R_1_0_15
- org.glite.jdl.version = glite-jdl_R_1_0_0
--org.glite.jp.version = glite-jp_R_1_1_3
--org.glite.lb.version = glite-lb_R_1_2_9
-+org.glite.jp.version = glite-jp_R_1_3_0
-+org.glite.lb.version = glite-lb_R_1_2_11
-+
- org.glite.rgma.version = glite-rgma_R_5_0_26
- org.glite.security.version = glite-security_R_3_0_15
- org.glite.service-discovery.version = glite-service-discovery_R_2_0_12
-Index: org.glite.deployment/build.xml
-===================================================================
-RCS file: /cvs/jra1mw/org.glite.deployment/build.xml,v
-retrieving revision 1.61.2.2.2.12.2.26
-diff -u -r1.61.2.2.2.12.2.26 build.xml
---- org.glite.deployment/build.xml 24 Apr 2006 13:39:27 -0000 1.61.2.2.2.12.2.26
-+++ org.glite.deployment/build.xml 30 Jun 2006 11:13:49 -0000
-@@ -9,7 +9,7 @@
- Authors: Alberto Di Meglio <alberto.di.meglio@cern.ch>
- Version info: $Id$
-
-- Release: $Name$
-+ Release: $Name$
-
- Revision history:
- $Log$
- Revision 1.3 2006/06/30 11:30:28 mmulac
- actualized patches
- - against org.glite a org.glite.deployment from glite_R_3_0_0
-
-@@ -1619,6 +1619,39 @@
- </if>
- </target>
-
-+ <target name="jpps" unless="setenvonly" depends="envset,config">
-+ <if>
-+ <isset property="small.memory"/>
-+ <then>
-+ <exec dir="${deployment.subsystem.dir}.jpps" executable="${antExec}" failonerror="${failonerror}">
-+ <arg line="${target} "-Dsmall.memory=true" "-Dbootstrap=${bootstrap}" "-Dfailonerror=${failonerror}" "-Ddo.cvs.tag=${do.cvs.tag}" "-Dbuild.name=${build.name}""/>
-+ </exec>
-+ </then>
-+ <else>
-+ <ant dir="${deployment.subsystem.dir}.jpps"
-+ target="${target}"
-+ inheritall="false" />
-+ </else>
-+ </if>
-+ </target>
-+
-+
-+ <target name="jpis" unless="setenvonly" depends="envset,config">
-+ <if>
-+ <isset property="small.memory"/>
-+ <then>
-+ <exec dir="${deployment.subsystem.dir}.jpis" executable="${antExec}" failonerror="${failonerror}">
-+ <arg line="${target} "-Dsmall.memory=true" "-Dbootstrap=${bootstrap}" "-Dfailonerror=${failonerror}" "-Ddo.cvs.tag=${do.cvs.tag}" "-Dbuild.name=${build.name}""/>
-+ </exec>
-+ </then>
-+ <else>
-+ <ant dir="${deployment.subsystem.dir}.jpis"
-+ target="${target}"
-+ inheritall="false" />
-+ </else>
-+ </if>
-+ </target>
-+
- <target name="io-server" unless="setenvonly" depends="envset,config">
- <if>
- <isset property="small.memory"/>
-@@ -1730,6 +1763,8 @@
- wn,
- wms,
- lb,
-+ jpps,
-+ jpis,
- io-server,
- io-client,
- ce,
-Index: org.glite.deployment/project/dependencies.properties
-===================================================================
-RCS file: /cvs/jra1mw/org.glite.deployment/project/dependencies.properties,v
-retrieving revision 1.526.2.5.2.127.2.415.2.22
-diff -u -r1.526.2.5.2.127.2.415.2.22 dependencies.properties
---- org.glite.deployment/project/dependencies.properties 9 May 2006 12:33:18 -0000 1.526.2.5.2.127.2.415.2.22
-+++ org.glite.deployment/project/dependencies.properties 30 Jun 2006 11:13:49 -0000
-@@ -80,6 +80,10 @@
-
- org.glite.deployment.lb.version = glite-deployment-lb_R_2_2_3
-
-+ org.glite.deployment.jpis.version = HEAD
-+
-+ org.glite.deployment.jpps.version = HEAD
-+
- org.glite.deployment.glite-WMSLB.version = glite-deployment-glite-WMSLB_R_2_4_2
-
- org.glite.deployment.wn.version = glite-deployment-wn_R_2_3_7
-Index: org.glite.deployment/project/glite.deployment.csf.xml
-===================================================================
-RCS file: /cvs/jra1mw/org.glite.deployment/project/glite.deployment.csf.xml,v
-retrieving revision 1.44.2.1.2.11.2.24
-diff -u -r1.44.2.1.2.11.2.24 glite.deployment.csf.xml
---- org.glite.deployment/project/glite.deployment.csf.xml 18 Apr 2006 15:42:14 -0000 1.44.2.1.2.11.2.24
-+++ org.glite.deployment/project/glite.deployment.csf.xml 30 Jun 2006 11:13:50 -0000
-@@ -9,7 +9,7 @@
- Authors: Joachim Flammer <Joachim.Flammer@cern.ch>
-
- Version info: $Id$
-- Release: $Name$
-+ Release: $Name$
-
- Revision history:
- $Log$
- Revision 1.3 2006/06/30 11:30:28 mmulac
- actualized patches
- - against org.glite a org.glite.deployment from glite_R_3_0_0
-
-@@ -667,6 +667,14 @@
- <equals arg1="${org.glite.deployment.lb.version}" arg2="HEAD" />
- </condition>
-
-+ <condition property="jpps.head">
-+ <equals arg1="${org.glite.deployment.jpps.version}" arg2="HEAD" />
-+ </condition>
-+
-+ <condition property="jpis.head">
-+ <equals arg1="${org.glite.deployment.jpis.version}" arg2="HEAD" />
-+ </condition>
-+
- <condition property="io-server.head">
- <equals arg1="${org.glite.deployment.io-server.version}" arg2="HEAD" />
- </condition>
-@@ -1571,6 +1579,28 @@
- tag="${org.glite.deployment.lb.version}" />
- </target>
-
-+ <!-- jpps component -->
-+ <target name="jpps" depends="get.jpps.head, get.jpps.tag"/>
-+ <target name="get.jpps.head" if="jpps.head">
-+ <cvs-co package="org.glite.deployment.jpps" />
-+ </target>
-+
-+ <target name="get.jpps.tag" unless="jpps.head">
-+ <cvs-co package="org.glite.deployment.jpps"
-+ tag="${org.glite.deployment.jpps.version}" />
-+ </target>
-+
-+ <!-- jpis component -->
-+ <target name="jpis" depends="get.jpis.head, get.jpis.tag"/>
-+ <target name="get.jpis.head" if="jpis.head">
-+ <cvs-co package="org.glite.deployment.jpis" />
-+ </target>
-+
-+ <target name="get.jpis.tag" unless="jpis.head">
-+ <cvs-co package="org.glite.deployment.jpis"
-+ tag="${org.glite.deployment.jpis.version}" />
-+ </target>
-+
- <!-- io-server component -->
- <target name="io-server" depends="get.io-server.head, get.io-server.tag"/>
- <target name="get.io-server.head" if="io-server.head">
-@@ -1667,6 +1697,8 @@
- wn,
- wms,
- lb,
-+ jpis,
-+ jpps,
- io-server,
- io-client,
- ce" />
+++ /dev/null
-This patch was merged to deploy_all.diff, don't use it anymore.
-
-Index: org.glite.deployment.lb/config/scripts/glite-lb-config.py
-===================================================================
-RCS file: /cvs/jra1mw/org.glite.deployment.lb/config/scripts/glite-lb-config.py,v
-retrieving revision 1.65.2.3
-diff -u -r1.65.2.3 glite-lb-config.py
---- org.glite.deployment.lb/config/scripts/glite-lb-config.py 2 May 2006 10:36:16 -0000 1.65.2.3
-+++ org.glite.deployment.lb/config/scripts/glite-lb-config.py 30 Jun 2006 09:29:21 -0000
-@@ -127,7 +127,12 @@
-
- if not os.path.exists('/tmp/mysql.sock'):
- os.symlink('/var/lib/mysql/mysql.sock', '/tmp/mysql.sock')
--
-+
-+
-+ #-------------------------------------------------------------------
-+ # start bkserver
-+ #-------------------------------------------------------------------
-+
- pid = glib.getPID('bkserverd')
- if pid != 0:
- print 'The gLite LB Server service is already running. Restarting...'
-@@ -140,7 +145,7 @@
- pid = glib.getPID('bkserverd')
-
- if (pid != 0):
-- print "The gLite LB Server service has been started ",
-+ print "The gLite LB Server service has been started ",
- glib.printOkMessage()
- else:
- glib.printErrorMessage("Could not start the gLite LB Server service")
-@@ -149,6 +154,36 @@
- return 1
-
- #-------------------------------------------------------------------
-+ # start jp-importer, if enabled
-+ #-------------------------------------------------------------------
-+
-+ lb_export = 0
-+ if params.has_key('lb.export.enabled'):
-+ if params['lb.export.enabled'] == "true":
-+ lb_export = 1
-+
-+ if lb_export:
-+ pid = glib.getPID('jp-importer')
-+ if pid != 0:
-+ print 'The gLite JP Importer service is already running. Restarting...'
-+ os.system('%s/etc/init.d/glite-jp-importer stop' % os.environ['GLITE_LOCATION'])
-+ else:
-+ print 'Starting the gLite JP Importer service...'
-+
-+ os.system('%s/etc/init.d/glite-jp-importer start' % os.environ['GLITE_LOCATION'])
-+
-+ pid = glib.getPID('jp-importer')
-+
-+ if (pid != 0):
-+ print "The gLite JP Importer service has been started ",
-+ glib.printOkMessage()
-+ else:
-+ glib.printErrorMessage("Could not start the gLite JP Importer service")
-+ glib.printErrorMessage("Please verify and re-run the script "),
-+ glib.printFailedMessage()
-+ return 1
-+
-+ #-------------------------------------------------------------------
- # Start Servicetool
- #-------------------------------------------------------------------
-
-@@ -168,6 +203,10 @@
- if (pid != 0):
- os.system('%s/etc/init.d/glite-lb-bkserverd stop' % os.environ['GLITE_LOCATION'])
-
-+ #-------------------------------------------------------------------
-+ # Book Keeping Server
-+ #-------------------------------------------------------------------
-+
- pid = glib.getPID('bkserverd')
- if (pid != 0):
- print 'Could not stop the LB Server service ',
-@@ -178,6 +217,25 @@
- glib.printOkMessage()
-
- #-------------------------------------------------------------------
-+ # JP Importer
-+ #-------------------------------------------------------------------
-+
-+ pid = glib.getPID('jp-importer')
-+ if (pid != 0):
-+ os.system('%s/etc/init.d/glite-jp-importer stop' % os.environ['GLITE_LOCATION'])
-+
-+ pid = glib.getPID('jp-importer')
-+ if (pid != 0):
-+ print 'Could not stop the JP Importer service ',
-+ glib.printFailedMessage()
-+ error_level = 1
-+ else:
-+ if params.has_key('lb.export.enabled'):
-+ if params['lb.export.enabled'] == "true":
-+ print 'The JP Importer service has been stopped ',
-+ glib.printOkMessage()
-+
-+ #-------------------------------------------------------------------
- # MySQL
- #-------------------------------------------------------------------
-
-@@ -202,6 +260,10 @@
- if retval != 0:
- error_level = 1
-
-+ retval = os.system('%s/etc/init.d/glite-jp-importer status' % os.environ['GLITE_LOCATION'])
-+ if retval != 0:
-+ error_level = 1
-+
- #-------------------------------------------------------------------
- # Servicetool
- #-------------------------------------------------------------------
-@@ -332,7 +394,27 @@
- print "\n==> MySQL database %s already exist\n" % params['lb.database.name']
-
- self.mysql.stop()
--
-+
-+ # ------------------------------------------------------------------
-+ # export from bkserver to cron
-+ # ------------------------------------------------------------------
-+ if params['GLITE_LB_EXPORT_ENABLED'] == "true":
-+ file = open('%s/etc/glite-lb-export-cron-wrapper.sh' % os.environ['GLITE_LOCATION'], 'w')
-+ file.write('#! /bin/sh\n')
-+ file.write('. %s\n' % glib.getInstallerExportFile())
-+ file.write('$GLITE_LOCATION/examples/glite-lb-export.sh\n')
-+ file.close()
-+ os.system('/bin/chmod 0755 %s/etc/glite-lb-export-cron-wrapper.sh' % os.environ['GLITE_LOCATION'])
-+
-+ file = open('/etc/cron.d/glite-lb-export.cron', 'w')
-+ file.write('# periodically run purge and export jobs from bkserver\n')
-+ file.write('00,30 * * * * %s %s/etc/glite-lb-export-cron-wrapper.sh\n' % (params['glite.user.name'], os.environ['GLITE_LOCATION']))
-+ file.close()
-+ os.system('/bin/chmod 0755 /etc/cron.d/glite-lb-export.cron')
-+
-+ # Touch cron spool directory to cause reloading of the crontabs
-+ os.system("/bin/touch /var/spool/cron")
-+
- #-------------------------------------------------------------------
- # RGMA servicetool: configure servicetool
- #-------------------------------------------------------------------
-@@ -418,6 +500,17 @@
- # Perl
- glib.addEnvPath("PERL5LIB", "%s/lib/perl:%s/lib/perl5" % (os.environ['GPT_LOCATION'],os.environ['GLITE_LOCATION']))
-
-+ # LB export
-+ glib.export('GLITE_LB_EXPORT_ENABLED', params['lb.export.enabled']);
-+ glib.export('GLITE_LB_EXPORT_BKSERVER', params['lb.export.bkserver']);
-+ glib.export('GLITE_LB_EXPORT_JPPS', params['lb.export.jpps']);
-+ glib.export('GLITE_LB_EXPORT_JPREG_MAILDIR', params['lb.export.jpreg']);
-+ glib.export('GLITE_LB_EXPORT_JPDUMP_MAILDIR', params['lb.export.jpdump']);
-+ glib.export('GLITE_LB_EXPORT_DUMPDIR', params['lb.export.dump']);
-+ glib.export('GLITE_LB_EXPORT_DUMPDIR_OLD', params['lb.export.dump.old']);
-+ glib.export('GLITE_LB_EXPORT_EXPORTDIR', params['lb.export.export']);
-+ glib.export('GLITE_LB_EXPORT_PURGE_ARGS', '"%s"' % params['lb.export.purgeargs']);
-+
- # Set environment
- glib.setUserEnv()
-
-Index: org.glite.deployment.lb/config/templates/glite-lb.cfg.xml
-===================================================================
-RCS file: /cvs/jra1mw/org.glite.deployment.lb/config/templates/glite-lb.cfg.xml,v
-retrieving revision 1.21
-diff -u -r1.21 glite-lb.cfg.xml
---- org.glite.deployment.lb/config/templates/glite-lb.cfg.xml 13 Mar 2006 15:19:21 -0000 1.21
-+++ org.glite.deployment.lb/config/templates/glite-lb.cfg.xml 30 Jun 2006 09:29:21 -0000
-@@ -17,9 +17,16 @@
- parameter. Leave it empty of comment it out to use the same as 'glite.user.name'"
- value="changeme"/>
-
-- <mysql.root.password
-- description="The mysql root password"
-- value="changeme"/>
-+ <mysql.root.password
-+ description="The mysql root password"
-+ value="changeme"/>
-+
-+ <lb.export.jpps
-+ description="Job Provenance Primary Storage.
-+ [Example: localhost:8901][Type: string]"
-+ value="changeme"/>
-+
-+
-
- <!-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -->
- <!-- Advanced parameters - Change them if you know what you're doing -->
-@@ -55,6 +62,12 @@
- [Example: 17M][Type: Integer][Unit: MB]"
- value="17M"/>
-
-+ <lb.export.enabled
-+ description="Enables exports to Job Provenance.
-+ [Example: true][Type: boolean]"
-+ value="true"/>
-+
-+
- <!-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -->
- <!-- System parameters - You should leave these alone -->
- <!-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -->
-@@ -67,7 +80,42 @@
- <value>destination</value>
-
- </lb.index.list>
--
-+
-+ <lb.export.bkserver
-+ description="Book Keeping Server service when differs from default port on localhost.
-+ [Example: localhost:9000][Type: string]"
-+ value=""/>
-+
-+ <lb.export.jpreg
-+ description="Maildir for job registrations.
-+ [Example: /tmp/jpreg][Type: string]"
-+ value=""/>
-+
-+ <lb.export.jpdump
-+ description="Maildir for job dumps.
-+ [Example: /tmp/jpdump][Type: string]"
-+ value=""/>
-+
-+ <lb.export.dump
-+ description="Dump directory for purged jobs.
-+ [Example: /tmp/dump][Type: string]"
-+ value=""/>
-+
-+ <lb.export.dump.old
-+ description="Dump directory for handled purged jobs.
-+ [Example: /tmp/dump.old][Type: string]"
-+ value=""/>
-+
-+ <lb.export.export
-+ description="Exported events divided to file per job.
-+ [Example: /tmp/lb_export][Type: string]"
-+ value=""/>
-+
-+ <lb.export.purgeargs
-+ description="Purge arguments (with timeouts).
-+ [Example: -a 1h -c 1h -n 1h -o 1d][Type: string]"
-+ value="-a 1d -c 1d -n 1d -o 7d"/>
-+
- </parameters>
-
- </config>
-Index: org.glite.deployment.lb/project/glite-lb.sdf.xml.template
-===================================================================
-RCS file: /cvs/jra1mw/org.glite.deployment.lb/project/glite-lb.sdf.xml.template,v
-retrieving revision 1.38.2.2
-diff -u -r1.38.2.2 glite-lb.sdf.xml.template
---- org.glite.deployment.lb/project/glite-lb.sdf.xml.template 2 May 2006 10:36:19 -0000 1.38.2.2
-+++ org.glite.deployment.lb/project/glite-lb.sdf.xml.template 30 Jun 2006 09:29:21 -0000
-@@ -57,6 +57,12 @@
- build="@org.glite.lb.server-bones.info.build@"
- arch="i386"/>
-
-+ <component name="glite-lb-client"
-+ version="@org.glite.lb.client.info.version@"
-+ age="@org.glite.lb.client.info.age@"
-+ build="@org.glite.lb.client.info.build@"
-+ arch="i386"/>
-+
- <component name="glite-wms-utils-jobid"
- version="@org.glite.wms-utils.jobid.info.version@"
- age="@org.glite.wms-utils.jobid.info.age@"
-@@ -105,6 +111,12 @@
- build="@org.glite.jp.ws-interface.info.build@"
- arch="i386"/>
-
-+ <component name="glite-jp-client"
-+ version="@org.glite.jp.client.info.version@"
-+ age="@org.glite.jp.client.info.age@"
-+ build="@org.glite.jp.client.info.build@"
-+ arch="i386"/>
-+
- <component name="gridsite"
- version="@org.gridsite.core.info.version@"
- age="@org.gridsite.core.info.age@"
+++ /dev/null
-These are the instructions how to build LB for VDT:
-
-$ mkdir lb4vdt
-$ cd lb4vdt
-$ export CVSROOT=:pserver:anonymous@jra1mw.cvs.cern.ch:/cvs/jra1mw
-$ cvs co org.glite.lb
-
-you may need to edit ./org.glite.lb/lb4vdt/Makefile.inc
-to specify some paths (some of them should be set automaticaly,
-e.g. by VDT_LOCATION)
-
-and then (still from the top directory) run
-
-$ ./org.glite.lb/lb4vdt/LB_install.sh 2>&1 | tee log
-
-:)
+++ /dev/null
-%
-% Official text received on October 6, 2004
-%
-\vfill{\bf Copyright }\copyright{\bf Members of the EGEE Collaboration. 2004.
-See http://eu-egee.org/partners for details on the copyright holders.
-
-EGEE (``Enabling Grids for E-science in Europe'') is a project funded by
-the European Union. For more information on the project, its partners
-and contributors please see http://www.eu-egee.org.
-
-You are permitted to copy and distribute verbatim copies of this
-document containing this copyright notice, but modifying this document
-is not allowed. You are permitted to copy this document in whole or in
-part into other documents if you attach the following reference to the
-copied elements: ``Copyright }\copyright{\bf 2004. Members of the EGEE
-Collaboration. http://www.eu-egee.org''
-
-The information contained in this document represents the views of
-EGEE as of the date they are published. EGEE does not guarantee that
-any information contained herein is error-free, or up to date.
-
-EGEE MAKES NO WARRANTIES, EXPRESS, IMPLIED, OR STATUTORY, BY
-PUBLISHING THIS DOCUMENT.}
-
+++ /dev/null
-\begin{center}
-{\bf Delivery Slip}
-\end{center}
-\begin{tabularx}{\textwidth}{|l|l|l|X|X|}
-\hline
- & {\bf Name} & {\bf Partner} & {\bf Date} & {\bf Signature} \\
-\hline
-{\bf From} & Ale\v s K\v{r}enek et al.& CESNET & May 28, 2005 & \\
-\hline
-{\bf Reviewed by} & & & & \\
-
-\hline
-{\bf Approved by} & & & & \\
-\hline
-\end{tabularx}
-
-\begin{center}
-{\bf Document Change Log}
-\end{center}
-
-\begin{tabularx}{\textwidth}{|l|l|X|X|}
-\hline
-{\bf Issue } & {\bf Date } & {\bf Comment } & {\bf Author } \\ \hline
-Initial version & Feb 28, 2005 & & A. K\v{r}enek \\ \hline
-Reviewer's comments & Mar 25, 2005 & comments reflected & A. K\v{r}enek \\
-\hline
-\end{tabularx}
-
-\begin{center}
-{\bf Document Change Record}
-\end{center}
-
-\begin{tabularx}{\textwidth}{|l|l|X|}
-\hline
-{\bf Issue } & {\bf Item } & {\bf Reason for Change } \\ \hline
-
-
-\hline
-\end{tabularx}
-
-\input{copyright}
+++ /dev/null
-CLPR=1; for jobid in `./stage/sbin/glite-lb-perftest_logjobs -m scientific.civ.zcu.cz:10000 -f stage/examples/perftest/perf_simple_avg_events.log -n 1000 -p /tmp/perftest_michal.log -s /tmp/proxy_michal.perf|grep https`; do stage/bin/glite-lb-logevent -x -S /tmp/proxy_michal.perfstore.sock -c $SEQCODE -j $jobid -s UserInterface -e Abort --reason Purge; done
+++ /dev/null
-./stage/sbin/glite-lb-purge -j /tmp/perftest_1000.jobids -m scientific.civ.zcu.cz:10000 -s
+++ /dev/null
- REG=1; for jobid in `./stage/sbin/glite-lb-perftest_logjobs -m scientific.civ.zcu.cz:10000 -f stage/examples/perftest/perf_simple_avg_events.log -n 1000 -p /tmp/perftest_michal.log -s /tmp/proxy_michal.perf|grep https`; do stage/examples/glite-lb-job_reg -j $jobid -s UserInterface ; done
+++ /dev/null
-./shared/egee/jra1-head/stage/sbin/perftest_il.sh 10
--------------------------------------------
-Logging test:
- - events sent through IPC and/or files
- - events discarded by IL immediately
--------------------------------------------
-a) events sent only by IPC
-b) events stored to files and sent by IPC
-
- small_job big_job small_dag big_dag
-a) 154727793 11240340 101479915 621678
-[jobs/day]
-b) 11540156 594389 10416164 402240
-[jobs/day]
------------------------------------
-Interlogger test:
- - events sent through IPC & files
- - events discarded in IL
------------------------------------
-a) disabled event parsing, the server address (jobid) is hardcoded
-b) disabled event synchronization from files
-c) disabled recovery thread
-x) disabled sync and recovery
-d) lazy bkserver connection close
-e) normal operation
-
- small_job big_job small_dag big_dag
-a) 14323607 547755 10158371 375594
-[jobs/day]
-b) 6284230 364547 4554967 300055
-[jobs/day]
-c) 7540122 412971 3186381 300417
-[jobs/day]
-x) 9672327 418137 2567653 297477
-[jobs/day]
-d) this test is not yet implemented
-e) 9650719 410507 3651840 301687
-[jobs/day]
------------------------------------
-Interlogger test:
- - events sent through IPC & files
- - events consumed by empty BS
------------------------------------
-a) disabled event parsing, the server address (jobid) is hardcoded
-b) disabled event synchronization from files
-c) disabled recovery thread
-x) disabled sync and recovery
-d) lazy bkserver connection close
-e) normal operation
-
- small_job big_job small_dag big_dag
-a) 2639788 182196 2035014 246654
-[jobs/day]
-b) 1170308 45973 759842 74898
-[jobs/day]
-c) 1060595 42047 921386 76638
-[jobs/day]
-x) 1091863 42247 518302 82129
-[jobs/day]
-d) this test is not yet implemented
-e) 1147040 41790 489257 76627
-[jobs/day]
-
+++ /dev/null
-[michal@scientific jra1-head]$ ./stage/sbin/perftest_il.sh 10
--------------------------------------------
-Logging test:
- - events sent through IPC and/or files
- - events discarded by IL immediately
--------------------------------------------
-a) events sent only by IPC
-b) events stored to files and sent by IPC
-
- small_job big_job small_dag big_dag
-a) 149765990 10933663 100162299 619924
-[jobs/day]
-b) 11857056 479615 2753618 277679
-[jobs/day]
------------------------------------
-Interlogger test:
- - events sent through IPC & files
- - events discarded in IL
------------------------------------
-a) disabled event parsing, the server address (jobid) is hardcoded
-b) disabled event synchronization from files
-c) disabled recovery thread
-x) disabled sync and recovery
-d) lazy bkserver connection close
-e) normal operation
-
- small_job big_job small_dag big_dag
-a) 13813170 268900 6448242 244203
-[jobs/day]
-b) 4525621 255055 6147103 241153
-[jobs/day]
-c) 9338319 217855 5497442 248429
-[jobs/day]
-x) 9335090 232292 3989195 236341
-[jobs/day]
-d) this test is not yet implemented
-e) 3283323 216013 7284868 256479
-[jobs/day]
------------------------------------
-Interlogger test:
- - events sent through IPC & files
- - events consumed by empty BS
------------------------------------
-a) disabled event parsing, the server address (jobid) is hardcoded
-b) disabled event synchronization from files
-c) disabled recovery thread
-x) disabled sync and recovery
-d) lazy bkserver connection close
-e) normal operation
-
- small_job big_job small_dag big_dag
-a) 4019651 44496 766972 95556
-[jobs/day]
-b) 1366885 47501 564779 90055
-[jobs/day]
-c) 1152594 47656 603774 97465
-[jobs/day]
-x) 1049069 48779 607913 88692
-[jobs/day]
-d) this test is not yet implemented
-e) 942509 46271 523129 91103
-[jobs/day]
-
-
-*************************************************************************
-
-
-[michal@scientific jra1-head]$ ./stage/sbin/perftest_il.sh 100
--------------------------------------------
-Logging test:
- - events sent through IPC and/or files
- - events discarded by IL immediately
--------------------------------------------
-a) events sent only by IPC
-b) events stored to files and sent by IPC
-
- small_job big_job small_dag big_dag
-a) 157966907 0 0 620546
-[jobs/day]
-b) 13833450 558487 10210340 283454
-[jobs/day]
------------------------------------
-Interlogger test:
- - events sent through IPC & files
- - events discarded in IL
------------------------------------
-a) disabled event parsing, the server address (jobid) is hardcoded
-b) disabled event synchronization from files
-c) disabled recovery thread
-x) disabled sync and recovery
-d) lazy bkserver connection close
-e) normal operation
-
- small_job big_job small_dag big_dag
-a) 12884330 316703 4447489 151870
-[jobs/day]
-b) 7980713 469667 4641283 244463
-[jobs/day]
-c) 8458472 556919 5657712 253640
-[jobs/day]
-x) 8149836 549678 4765300 257375
-[jobs/day]
-d) this test is not yet implemented
-e) 9687868 503933 4461079 247092
-[jobs/day]
------------------------------------
-Interlogger test:
- - events sent through IPC & files
- - events consumed by empty BS
------------------------------------
-a) disabled event parsing, the server address (jobid) is hardcoded
-b) disabled event synchronization from files
-c) disabled recovery thread
-x) disabled sync and recovery
-d) lazy bkserver connection close
-e) normal operation
-
- small_job big_job small_dag big_dag
-a) 9389344 97159 450483 68610
-[jobs/day]
-b) 1195400 82681 560118 88216
-[jobs/day]
-c) 1351879 88207 830072 102285
-[jobs/day]
-x) 1173835 85897 562648 0
-[jobs/day]
-d) this test is not yet implemented
-e) 1205291 78355 567658 87770
-[jobs/day]
+++ /dev/null
-[michal@scientific jra1-head]$ ./stage/sbin/perftest_il.sh 10
--------------------------------------------
-Logging test:
- - events sent through IPC and/or files
- - events discarded by IL immediately
--------------------------------------------
-a) events sent only by IPC
-b) events stored to files and sent by IPC
-
- small_job big_job small_dag big_dag
-a) 153599999 11157889 101479915 539075
-[jobs/day]
-b) 10835893 1059003 2577803 351095
-[jobs/day]
------------------------------------
-Interlogger test:
- - events sent through IPC & files
- - events discarded in IL
------------------------------------
-a) disabled event parsing, the server address (jobid) is hardcoded
-b) disabled event synchronization from files
-c) disabled recovery thread
-x) disabled sync and recovery
-d) lazy bkserver connection close
-e) normal operation
-
- small_job big_job small_dag big_dag
-a) 14148626 772362 11498383 376986
-[jobs/day]
-b) 5348851 489142 5558879 292071
-[jobs/day]
-c) 9042670 441000 5911613 287842
-[jobs/day]
-x) 7730298 414784 6579748 289834
-[jobs/day]
-d) this test is not applicable
-e) 9288325 365701 7189156 299604
-[jobs/day]
------------------------------------
-Interlogger test:
- - events sent through IPC & files
- - events consumed by empty BS
------------------------------------
-a) disabled event parsing, the server address (jobid) is hardcoded
-b) disabled event synchronization from files
-c) disabled recovery thread
-x) disabled sync and recovery
-d) lazy bkserver connection close
-e) normal operation
-
- small_job big_job small_dag big_dag
-a) 2219003 185867 1785164 258615
-[jobs/day]
-b) 1795503 48283 309380 77422
-[jobs/day]
-c) 1201618 39001 850436 74771
-[jobs/day]
-x) 1134249 48039 447017 74244
-[jobs/day]
-d) 5335078 207059 2438095 96295
-[jobs/day]
-e) 1019269 36465 875966 65565
-[jobs/day]
-
-
+++ /dev/null
-michal:~/shared/egee/jra1-head> ./stage/sbin/perftest_ll.sh 10
-----------------
-Locallogger test
-----------------
-a) glite-lb-logd-perf-nofile --noParse --noIPC
-b) glite-lb-logd-perf-nofile --noIPC
-c) glite-lb-logd-perf --noIPC
-d) glite-lb-logd-perf
-
-Number of jobs: 10
-
- small_job big_job small_dag big_dag
-a) 14.544066 14.590504 14.681760 9.264801 [events/sec]
- 125660 8404 97577 25821 [jobs/day]
-b) 14.614844 14.408043 14.279216 9.600877 [events/sec]
- 126272 8298 94901 26758 [jobs/day]
-c) 0.000000 0.000000 0.000000 0.000000 [events/sec]
- 0 0 0 0 [jobs/day]
-d) 13.331568 13.530218 13.420780 8.363152 [events/sec]
- 115184 7793 89196 23308 [jobs/day]
+++ /dev/null
--------------------
-LB chain test
--------------------
-- proxy & interlogger (lazy variant) running at umbar
-- bkserver running at sci
-- test variants:
- a) 10 jobs
- b) 100 jobs
- c) 1000 jobs
-
-
-Results:
-
- small_job big_job small_dag big_dag
----------------------------------------------------------------
-a) 3.0 x x x [mjobs/day]
-b) 1.0 x x x [mjobs/day]
-c) 0.6 x x x [mjobs/day]
-
-
+++ /dev/null
--------------------
-LB chain test
--------------------
-- proxy & interlogger (lazy variant) running at umbar
-- bkserver running at sci
-- test variants:
- a) 100 jobs, no background queries
- b) 1000 jobs, no background queries
- c) 10000 jobs, no background queries
- d) 100 jobs, 10 parallel queries
- e) 1000 jobs, 10 parallel queries, perf interlogger
- f) 1000 jobs, 10 parallel queries, normal interlogger
-- in d)-f) the server was queried by 10 independent clients for states
- of all jobs periodically with random sleep between queries (0-5sec)
-
-Results:
-
- small_job big_job small_dag big_dag
----------------------------------------------------------------
-a) 1.0 x x x [mjobs/day]
-b) 0.6 x x x [mjobs/day]
-c) 0.5 x x x [mjobs/day]
-d) 0.8 x x x [mjobs/day]
-e) 0.45 x x x [mjobs/day]
-f) 0.4 x x x [mjobs/day]
+++ /dev/null
-----------------------------------
-LB Proxy test
-----------------------------------
-Events are consumed:
-1) before parsing
-2) after parsing, before storing into database
-3) after storing into db, before computing state
-4) after computing state, before sending to IL
-5) by IL
-
- small_job big_job small_dag big_dag
-1) 43005186.489600 2852512.156800 31859581.824000 502823.721600
-[jobs/day]
-2) 37764713.548800 2438483.961600 26108871.523200 340065.648000
-[jobs/day]
-3) 1754530.243200 272980.540800 2051218.684800 0.000000
-[jobs/day]
-4) 1267110.000000 176052.182400 1506470.486400 0.000000
-[jobs/day]
-5) 329471.452800 48787.747200 318152.275200 0.000000
-[jobs/day]
+++ /dev/null
- ./stage/bin/glite-lb-interlogd -d -s /tmp/perftest_michal.sock --file-prefix=/tmp/perftest_michal.log --lazy
+++ /dev/null
-./stage/bin/glite-lb-proxy -d --silent -p /tmp/proxy_michal.perf --proxy-il-sock /tmp/perftest_michal.sock --proxy-il-fprefix /tmp/perftest_michal.log
+++ /dev/null
-./stage/bin/glite-lb-bkserverd -d --perf-sink=4 -p 10000 -w 10003 -S /tmp/purge_michal -D /tmp/dump_michal --silent
+++ /dev/null
-TEST=1; ./stage/sbin/glite-lb-perftest_logjobs -d proxy -m scientific.civ.zcu.cz:10000 -f stage/examples/perftest/perf_simple_avg_events.log -n 1000 -p /tmp/perftest_michal.log -s /tmp/proxy_michal.perf
+++ /dev/null
-\documentclass{egee}
-\usepackage{comment}
-
-\def\LB{L\&B}
-
-\title{\LB\ Performance Test Plan}
-\author{CESNET EGEE JRA1 team}
-\DocIdentifier{EGEE-JRA1-??}
-\Date{\today}
-\Activity{JRA1: Middleware Engineering and Integration}
-\DocStatus{DRAFT}
-\Dissemination{PUBLIC}
-\DocumentLink{}
-
-%\def\req{\noindent\textbf{Prerequisities:}}
-%\def\how{\noindent\textbf{How to run:}}
-%\def\result{\noindent\textbf{Expected result:}}
-
-\def\path#1{{\normalfont\textsf{#1}}}
-\def\code#1{\texttt{#1}}
-\def\todo#1{\textbf{TODO:} #1}
-
-\begin{document}
-
-\input{frontmatter}
-\newpage
-\tableofcontents
-\newpage
-
-\section{Rationale}
-\todo{}
-
-\begin{verbatim}
-
-L&B Performance Testing
-=======================
-
-- all source modifications for tests are in CVS, conditionaly compiled
- only with appropriate symbol
-
-- binaries for all tests are built using special property
- for ant target (or environment variable for Makefile), which
- compiles sources using the right #define combinations
-
-- component tests are run by shell scripts located under component
- directories, these tests may require binaries from other components,
- though
-
-- all tests use sequence of events for typical jobs (small job, big
- job, small DAG, big DAG) prepared beforehand. These events are
- stored in files in ULM format in CVS.
-
-- events are generated by stresslog program, which reads ULM text of
- events for particular test job and logs the event sequence directly
- by calling *_DoLogEvent<variant>. The number of test jobs is
- configurable. Stresslog inserts into every event timestamp when the
- event was generated and sent.*
-
-- event are consumed by breaking normal event processing either in the
- component being tested or the next component in chain, that is
- instrumented to read and discard events immediately. The consumption
- itself is done by calling special function which takes current time,
- extracts timestamp from event and prints the difference (ie. the
- event processing time).* These "break points" are chosen to measure
- throughput of the various component parts and to identify possible
- bottlenecks within the components.
-
- * the only exception is test of the logging library itself
-
-- test jobs are preregistered within the LB if the test includes
- bookkeeping server and/or proxy by the test script program and
- their id's are stored in separate file to enable re-use by other
- load-generating tools (status queries, for example)
-
-- test results:
- - some numbers must be reported by component themselves, not by
- the event generator (due to the asynchronous LB nature). The
- test script collects those numbers and presents them as the test
- result at the end of testing.
-
- - after completion test scripts print the table described for the
- respective tests filled in with measured values (ie. the table
- is not filled in manually by human tester)
-
- - event throughput = 1/(time_delivered - time_arrived)
- * only if next event is sent after previous was delivered
-
-? measure job throughput for event patterns of typical jobs or deduce
-job throughput from throughput of selected types of events?
-
-
-I) Component tests
- ***************
-
-- tests of the isolated components on one node
-- may require binaries from other components to produce/consume events
-
---------------------
-Logging library test
---------------------
-
-* component:
- org.glite.lb.client
-
-* binaries required:
- logevent_libtest
-
-* test shell script:
- perftest_loglib
-
-* input required:
- - events
-
-* test description:
- - measures time required to format given events into ULM. Events
- are read from file, parsed into components, timestamped and
- produced.
-
- - events produced:
- - by calling logging function edg_wll_LogEvent*()
-
- - events consumed:
- - discarded by logging function instead of sending via
- appropriate protocol (LogEventMaster)
-
-* results:
-
- job type (size) throughput (100k jobs)
- -----------------------------------------
- small job
- big job
- small DAG
- big DAG
-
-
-
-----------------
-Locallogger test
-----------------
-
-* component:
- org.glite.lb.logger
-
-* binaries required:
- stresslog
- glite_lb_logd_perf
- glite_lb_logd_perf_nofile
- - does not store events in file
- glite_lb_interlogd_perf_empty
- - consumes immediately after reading event
-
-* test shell script:
- perftest_logd
-
-* input required:
- - client and host certificates
- - events
-
-* test description:
- - measures time required for event to be sent from client to
- local logger and processed by locallogger. Localloger is
- either instructed (by option) or instrumented to skip some
- parts of event processing:
- a) no parse, no file, no ipc
- glite_lb_logd_perf_nofile --noParse --noIPC
- b) no file, no ipc
- glite_lb_logd_perf_nofile --noIPC
- c) no ipc
- glite_lb_logd_perf --noIPC
- d) normal operation
- glite_lb_logd_perf
-
- no parse - LL does not parse events
- no file - LL does not store events into files
- no ipc - LL does not send events through socket to IL
-
- - events produced:
- - stresslog sends events to logd using client->logd
- protocol (*_DoLogEvent())
-
- - events consumed:
- i) after storing into files
- ii) by "empty" IL
-
-* results:
-
-
-
-i) events stored in files
-
- throughput: small big small big
- job job DAG DAG
- -------------------------------------------------
- a)
- b)
- c)
- d)
-
-ii) events sent to IL
-
- throughput: small big small big
- job job DAG DAG
- -------------------------------------------------
- a)
- b)
- c)
- d)
-
-
-
-----------------
-Interlogger test
-----------------
-
-* component:
- org.glite.lb.logger
-
-* binaries required:
- stresslog
- glite_lb_interlogd_perf
- glite_lb_interlogd_perf_noparse
- - does not parse events, server address is hardcoded
- glite_lb_interlogd_perf_nosync
- - does not call event_store_sync()
- glite_lb_interlogd_perf_norecover
- - recovery thread disabled
- glite_lb_interlogd_perf_nosend
- - events are consumed instead of sending
- glite_lb_interlogd_perf_lazy
- - lazy closing connection to bkserver
- glite_lb_bkserverd_perf_empty
- - consumes event immediately after receiving
-
-* test shell script:
- perftest_interlogd
-
-* input required:
- - host certificate
- - events
-
-* test description:
- - measures time the event travels through interlogger.
- Interlogger is instrumented to skip some parts of eventh
- processing for particular test, specifically tests include
- these variants:
- a) disabled event parsing. The server address
- (eg. jobid) is hardcoded.
- b) disabled event synchronization from files
- c) disabled recovery thread
- d) lazy bkserver connection close
- e) normal operation
-
- - events produced:
- 1) stresslog sends events to interlogger using the unix
- domain socket and logd->interlogger protocol, events are
- stored in files (stresslog behaves like logd)
- TODO: pro toto neni funkce v producerske knihovne
- 2) interlogger reads events from event files created by
- stresslog (by recovery thread)
- 3) stresslog stores events to files and every n-th
- (optional argument) is sent also through the unix socket
-
- - events consumed:
- i) discarded instead of being sent
- ii) by "empty" bkserver
-
-* results:
-
-
-i) events discarded
-1) events received on socket
-(options 2 and 3 are not tested)
-
- throughput: small big small big
- job job DAG DAG
- -------------------------------------------------
- a)
- b)
- c)
- e)
-
-
-ii) events sent to empty bkserver
-1) events received on socket
-
- throughput: small big small big
- job job DAG DAG
- -------------------------------------------------
- a)
- b)
- c)
- d)
- e)
-
-
-2) events recovered from files
-
- throughput: small big small big
- job job DAG DAG
- -------------------------------------------------
- d)
- e)
-
-
-3) events synced from files, every 10th event sent on socket
-
- throughput: small big small big
- job job DAG DAG
- -------------------------------------------------
- a)
- b)
- c)
- d)
- e)
-
-
-------------
-LBProxy test
-------------
-
-* component:
- org.glite.lb.proxy
-
-* binaries required:
- stresslog
- glite_lb_proxy_perf_noparse
- - consumes events before parsing
- glite_lb_proxy_perf_nostore
- - consumes events before storing into database
- glite_lb_proxy_perf_nostate
- - consumes events before computing job status
- glite_lb_proxy_perf_nosend
- - consumes events before sending to interlogger
- glite_lb_interlogd_perf_empty
- - consumes immediately after reading event
-
-* test shell script:
- perftest_proxy
-
-* input required:
- - events
-
-* test description:
- - measures time required for processing event by LB proxy. Test
- is performed with (a)) and without (b)) checking for duplicit
- events.
-
- - events produced:
- - stresslog sends events using the IL protokol on local
- socket (using DoLogEventProxy())
-
- - events consumed:
- i) before parsing
- ii) before storing into database
- iii) after storing into database
- iv) after job status computation
- v) normal operation
-
-
-
-
-* results:
-
-a) with duplicity check:
-
- throughput: small big small big
- job job DAG DAG
- -------------------------------------------------
- i)
- ii)
- iii)
- iv)
- v)
-
-
-b) without duplicity check:
-
- throughput: small big small big
- job job DAG DAG
- -------------------------------------------------
- i)
- ii)
- iii)
- iv)
- v)
-
-
---------------
-LB server test
---------------
-
-* component:
- org.glite.lb.server
-
-* binaries required:
- stresslog
- glite_lb_server_perf_noparse
- - consumes events before parsing
- glite_lb_server_perf_nostore
- - consumes events before storing into database
- glite_lb_server_perf_nostate
- - consumes events before computing job status
-
-* test shell script:
- perftest_server
-
-* input required:
- - host certificates
- - events
-
-* test description:
- - measures time required for processing event by LB server. Test
- is performed with (a)) and without (b)) checking for duplicit
- events.
-
- - events produced:
- - stresslog sends events using the IL protokol (using DoLogEventDirect())
-
- - events consumed:
- i) before parsing
- ii) before storing into database
- iii) after storing into database
- iv) normal operation
-
-* results:
-
-a) with duplicity check:
-
- throughput: small big small big
- job job DAG DAG
- -------------------------------------------------
- i)
- ii)
- iii)
- iv)
-
-
-b) without duplicity check:
-
- throughput: small big small big
- job job DAG DAG
- -------------------------------------------------
- i)
- ii)
- iii)
- iv)
-
-
-
----------------------
-Job registration test
----------------------
-
-* component:
- org.glite.lb.server
- org.glite.lb.proxy
-
-* binaries required:
- stressreg
- - generates registration events
- glite_lb_bkserverd
- glite_lb_proxy
- glite_lb_bkserverd_perf_empty
- glite_lb_proxy_perf_empty
-
-* test shell script:
- perftest_jobreg
-
-* input required:
- - host & user certificates
-
-* test description:
- - measures time required to register given number of jobs (time
- to process registration event). The registration event is
- synchronous in principle, so it is possible to get results just
- from the client (stressreg). Test variants include:
- a) current implementation
- b) implementation of connection pool at the client
- c) parallel communication with server and proxy
-
-
- - events produced:
- - stressreg sends registration events by calling
- edg_wll_RegisterJob*()
-
- - events consumed:
- i) normally processed by server & proxy
- ii) server replies immediate success
- iii) proxy replies immediate success
-
-* results:
-
-a) current implementation
-
- throughput: one DAG DAG DAG
- job (1000 nodes) (5000 nodes) (10000 nodes)
- -----------------------------------------------------------------
- i)
- ii)
- iii)
-
-
-b) connection pool
-
- throughput: one DAG DAG DAG
- job (1000 nodes) (5000 nodes) (10000 nodes)
- -----------------------------------------------------------------
- i)
- ii)
- iii)
-
-
-c) parallel communication
-
- throughput: one DAG DAG DAG
- job (1000 nodes) (5000 nodes) (10000 nodes)
- -----------------------------------------------------------------
- i)
-
-
-
-\end{verbatim}
-
-\end{document}
\ No newline at end of file
+++ /dev/null
-\documentclass{egee}
-\usepackage{comment}
-
-\def\LB{L\&B}
-
-\title{\LB\ Test Plan}
-\author{CESNET EGEE JRA1 team}
-\DocIdentifier{EGEE-JRA1-??}
-\Date{\today}
-\Activity{JRA1: Middleware Engineering and Integration}
-\DocStatus{DRAFT}
-\Dissemination{PUBLIC}
-\DocumentLink{}
-
-\def\req{\noindent\textbf{Prerequisities:}}
-\def\how{\noindent\textbf{How to run:}}
-\def\result{\noindent\textbf{Expected result:}}
-
-\def\path#1{{\normalfont\textsf{#1}}}
-\def\code#1{\texttt{#1}}
-
-\def\todo#1{\textbf{TODO:} #1}
-
-
-\specialcomment{hints}{\par\noindent\textbf{Hints: }\begingroup\slshape}{\endgroup}
-%\includecomment{hints}
-
-\begin{document}
-
-\input{frontmatter}
-\newpage
-\tableofcontents
-\newpage
-
-\section{Rationale}
-\todo{}
-
-\section{Test Coverage}
-\todo{}
-
-\section{Test Cases}
-
-\subsection{Event delivery}
-
-% locallogger
-% bez dalsich demonu, registrovat job, vrati EAGAIN, objevi se fajly
-\subsubsection{Standalone locallogger -- job registration}
-\label{reg}
-\req\ running \path{glite-lb-logd} on the test node, don't start either
-\path{glite-lb-interlogd} or \path{glite-lb-bkserverd}
-
-\how\ call \code{edg\_wll\_RegisterJob}. Jobid's should preferably point
-to a~remote \LB\ server.
-
-\result\ The API call returns EAGAIN, but locallogger creates an event file
-in its storage.
-The file should contain single line RegJob event.
-
-\begin{hints}
-\path{glite-lb-regjob} example can be used. It generates a~unique jobid,
-prints it and calls \LB\ API appropriately.
-\end{hints}
-
-% async -- prida do fajlu, OK
-% logevent
-\subsubsection{Standalone locallogger -- log event}
-\label{log}
-\req\ running \path{glite-lb-logd} only, files generated in test~\ref{reg}.
-
-\how\ call \code{edg\_wll\_Log*} for various event types in a~sequence
-resebmling real \LB\ usage, using the same jobid's as in test~\ref{reg}
-
-\result\ API calls return 0, events are added one per line to the locallogger files
-
-\begin{hints}
-\path{glite-lb-logev} client program can be used.
-
-\path{glite-lb-*.sh} examples may be adapted to produce reasonable seqences
-of events.
-\end{hints}
-
-\subsubsection{Interlogger recovery}
-\label{recover}
-% recover interloggeru
-% il & server (remote)
-% spustit, protlaci soubory na server, soubory zmizi, lze se dotazat na stav
-\req\ running \path{glite-lb-bkserverd} on the machine and port where
-jobid's from \ref{reg} point to; files generated in~\ref{log}.
-
-\how\ Make a~copy of the files created in~\ref{log}, then start
-\path{glite-lb-interlogd}. After approx. 10s check the jobs
-with \code{edg\_wll\_JobLog} call.
-
-\result \code{edg\_wll\_JobLog} should return the same events that were
-contained in the locallogger files. The files should be removed by
-interlogger after approx. 1 min.
-
-\begin{hints}
-\path{glite-lb-joblog} example outputs the events in (almost) the same
-format as the locallogger files.
-\end{hints}
-
-% event delivery
-% poslat .sh, job log vrati to, co bylo ve fajlech
-\subsubsection{Normal event delivery}
-\label{normal}
-\req\ all \LB\ daemons running (\path{glite-lb-logd}, \path{glite-lb-interlogd},
-\path{glite-lb-bkserverd}
-
-\how\
-\begin{enumerate}
-
-\item Register jobs with \code{edg\_wll\_RegsterJob}
-\item Log reasonable sequences of events with \code{edg\_wll\_Log*}.
-\item Check with \code{edg\_wll\_JobLog}
-that the events got delivered afterwards (approx. 10s).
-\end{enumerate}
-
-\result\ API calls should return 0. The same events that were logged must be returned.
-
-\begin{hints}
-\path{glite-lb-*.sh} scripts produce reasonable seqences of events, including
-the job initial registration.
-
-There is approx. 1min time window in which the locallogger files exist.
-They can be grabbed and used for comparing the events as in~\ref{recover}.
-
-\end{hints}
-
-\subsection{Job state computation}
-
-% normal event delivery & job state machine
-% .sh, dotaz na stav
-\subsubsection{Normal job states}
-\label{state}
-\req\ \path{glite-lb-bkserverd} running, events from \ref{normal} logged.
-
-\how\ Check state of the jobs with \code{edg\_wll\_JobStatus}.
-
-\result\ The API call should return 0, the jobs should be in the expected
-states. Thorough tests may also cross check the values supplied in the
-events (e.g. destination computing element) wrt. the values reported in the job states.
-
-\begin{hints}
-\path{glite-lb-*.sh} scripts produce sequences of events resultning
-in the job state same as the `*' part of the script name.
-\end{hints}
-
-\subsubsection{DAG job states}
-\todo{}
-% specialni stav DAGu, histogram potomku
-
-\subsection{LB proxy}
-\req\ running \path{glite-lb-proxy}, \path{glite-lb-interlogd} and
-\path{glite-lb-bkserverd}
-
-\how\ Register jobs with \code{edg\_wll\_RegisterJobProxy}, log events
-using \code{edg\_wll\_LogEventProxy} and check the job states against
-both lbproxy (using \code{edg\_wll\_JobStatusProxy}) and bkserver
-(using \code{edg\_wll\_JobStatus}).
-
-\result\ A new job state should be available immediately at the
-lbproxy and probably with a small delay also at the bkserver.
-
-\begin{hints}
-There is already a script \path{test.sh} in
-\path{org.glite.lb.proxy/examples} that can be used together with
-above mentioned scripts \path{glite-lb-*.sh} (they are called from
-\path{test.sh}) to test all this.
-\end{hints}
-
-\subsection{WS interface}
-\req\ \path{glite-lb-bkserverd} running, events from \ref{normal} logged
-
-\how\ retrieve both events and job states with the \LB\ WS interface
-(operations \code{JobStatus}, \code{QueryEvents}).
-
-\result\ the returened data should match those returned by the legacy
-API calls.
-
-\begin{hints}
-Examples \path{org.glite.lb.server/examples/ws\_*.c} convert the WS
-responses back to the legacy \LB\ data structures and print them in
-the same form as e.g. \path{glite-lb-jobstat}.
-\end{hints}
-
-\subsection{Notifications}
-
-% notifikace
-% regjob, reg notifikace na vsechno, poslat udalosti, hlidat notif
-\subsubsection{Single job, any state change}
-\label{notif1}
-\req\ All \LB\ services running
-
-\how
-\begin{enumerate}
-\item Register a job.
-\item Start a~notification client (preferably on another machine),
-register with \code{edg\_wll\_NotifNew} for any state changes of the job,
-and repeatedly invoke \code{edg\_wll\_NotifReceive}.
-\item One by one send events triggering job state change.
-\end{enumerate}
-
-\result\ All the events should trigger notification reported by the running
-notification client.
-
-\begin{hints}
-\path{glite-lb-notify} example can be used with its \path{test} command.
-\end{hints}
-
-\subsubsection{Additional notification criteria}
-\label{notif-complex}
-\req\ All \LB\ services running
-
-\how\ Like~\ref{notif1} but include additional criteria,
-e.g. job is scheduled for a~specific destination.
-
-\result\ Only notifications matching the criteria should be delivered.
-
-% rozsireni dotazu o dalsi job
-\subsubsection{Include another job}
-\label{notif2}
-\req\ All \LB\ services running, notification from \ref{notif1} still active
-
-\how\
-\begin{enumerate}
-\item Register another job.
-\item Augment the notification registration with the new jobid using
-\code{edg\_wll\_NotifChange}.
-\item Start notification client, bind to the registration with
-\code{edg\_wll\_NotifBind}.
-\item Send events for the new job.
-\end{enumerate}
-
-\result\ Notifications should be received by the client.
-
-\begin{hints}
-Commands \path{change} and \path{receive} of \path{glite-lb-notify}
-can be used.
-\end{hints}
-
-% notifikace -- zmena adresy/portu
-% pak poslat udalost, musi dojit
-% uz je v predchozim implicitne
-
-\subsubsection{Delayed delivery}
-% notifikace -- zpozdene doruceni
-% registrovat, odpojit, poslat udalosti, pripojit se
-
-\req\ All \LB\ services running
-
-\how\
-\begin{enumerate}
-\item Register another job.
-\item Register a~notification as in~\ref{notif1} but terminate the client
-immediately.
-\item Log events for the job.
-\item Restart the client, binding to the notification and call
-\code{edg\_wll\_NotifReceive} repeatedly.
-\end{enumerate}
-
-\result\ Delayed notifications should be received by the client almost
-immediately.
-
-\subsection{Server purge}
-
-\textbf{WARNING: This test is destructive, it destroys ALL data in an
-existing \LB\ database.}
-
-The test is fairly complex but it does not make too much sense to split it
-artificially.
-
-\req\ All \LB services running, preferably a~dedicated server for this test.
-
-\how
-\begin{enumerate}
-\item Purge all data on the server with \path{glite-lb-purge}
-\item Log two sets of jobs, separated with delay of at least 60s so
-that the sets can be distinguished from each other.
-\item \label{purgel}
-Using \code{edg\_wll\_JobLog} retrieve events of all the jobs
-\item \label{purge1}
-Purge the first set of jobs (by specifying appropriate timestamp),
-letting the server dump the purged events.
-\item \label{purge2} Purge the other set of jobs, also dumping the events.
-\item \label{purge3} Run purge once more.
-\end{enumerate}
-
-\result\ The data dumped in steps \ref{purge1}, \ref{purge2} should be the
-same as retrieved in~\ref{purgel}. The final purge invocation should
-do nothing (i.e. nothing was left in the database).
-
-% test_purge
-\begin{hints}
-The example \path{glite-lb-test\_purge} does exactly this sequence of steps,
-including the checks.
-\end{hints}
-
-
-\end{document}
+++ /dev/null
-#!/bin/sh
-
-set -e
-
-#OFFLINE=true
-TOPDIR=${PWD}
-
-export LB4VDTDIR=${TOPDIR}/org.glite.lb/lb4vdt
-export STAGEDIR=${TOPDIR}/stage
-mkdir -p ${STAGEDIR}
-
-if [ ! -f ${LB4VDTDIR}/Makefile.inc ]; then
- echo "Error: There is no ${LB4VDTDIR}/Makefile.inc. Exiting."
- exit 1
-fi
-
-if [ -z "${CVSROOT}" ]; then
- export CVSROOT=:pserver:anonymous@jra1mw.cvs.cern.ch:/cvs/jra1mw
-# export CVSROOT=:ext:jpospi@jra1mw.cvs.cern.ch:/cvs/jra1mw
- echo "Using CVSROOT=${CVSROOT}"
-fi
-
-dep_modules="org.glite.wms-utils.jobid
-org.gridsite.core"
-
-modules="org.glite.security.gsoap-plugin
-org.glite.lb.client-interface
-org.glite.lb.common
-org.glite.lb.client
-org.glite.lb.logger
-org.glite.lb.ws-interface
-org.glite.lb.server-bones
-org.glite.lb.server
-org.glite.lb.proxy"
-#org.glite.lb.utils
-
-for i in $dep_modules;
-do
- echo "*********************************************************"
- echo "* Module $i"
- echo "*********************************************************"
- cd ${TOPDIR}
- if [ -n "${OFFLINE}" ]; then
- echo "Working offline"
- else
- echo "Getting sources from CVS"
- cvs co -A $i;
- fi
- if [ -d $i -a -f ${LB4VDTDIR}/patches/$i.patch -a ! -f .$i.patched ]; then
- echo "Patching $i"
- patch -p0 < ${LB4VDTDIR}/patches/$i.patch
- touch .$i.patched
- fi
- if [ -d $i ]; then
- touch .$i.timestamp
- if [ -f ${LB4VDTDIR}/scripts/$i.build ]; then
- echo "Building"
- sh -x ${LB4VDTDIR}/scripts/$i.build
- fi
- cd ${TOPDIR}
- find ${STAGEDIR} -newer .$i.timestamp > .$i.filelist
- else
- echo "WARNING: directory $i not found"
- fi
-done
-
-for i in $modules;
-do
- echo "*********************************************************"
- echo "* Module $i"
- echo "*********************************************************"
- cd ${TOPDIR}
- if [ -n "${OFFLINE}" ]; then
- echo "Working offline"
- else
- echo "Getting sources from CVS"
- cvs co -A $i;
- fi
- if [ -d $i -a -f ${LB4VDTDIR}/patches/$i.patch -a ! -f .$i.patched ]; then
- echo "Patching $i"
- patch -p0 < ${LB4VDTDIR}/patches/$i.patch
- touch .$i.patched
- fi
- if [ -d $i ]; then
- touch .$i.timestamp
- echo "Entering directory ${TOPDIR}/$i"
- cd ${TOPDIR}/$i
- echo "Copying supporting files"
- cp -rv ${TOPDIR}/org.glite.lb/project/{at3,*.T,*.pm} ./project/
- mkdir -p build
- echo "Entering directory ${TOPDIR}/$i/build"
- cd build
- ln -fsv ../Makefile
-# ln -fsv ../../Makefile.inc Makefile.inc
- ln -fsv ${LB4VDTDIR}/Makefile.inc
- echo "Building"
- make LB_STANDALONE=yes
- make stage LB_STANDALONE=yes
- cd ${TOPDIR}
- find ${STAGEDIR} -newer .$i.timestamp > .$i.filelist
- else
- echo "WARNING: directory $i not found"
- fi
- echo "Done"
-done
-
-cd ${TOPDIR}
-echo "Creating filelists"
-cat .org.glite.wms-utils.jobid.filelist .org.gridsite.core.filelist .org.glite.security.gsoap-plugin.filelist .org.glite.lb.common.filelist | sort | uniq > LB-common.filelist
-cat .org.glite.lb.client-interface.filelist .org.glite.lb.client.filelist | sort | uniq > LB-client.filelist
-cat .org.glite.lb.logger.filelist | sort | uniq > LB-logger.filelist
-cat .org.glite.lb.logger.filelist .org.glite.lb.server-bones.filelist .org.glite.lb.proxy.filelist | sort | uniq > LB-proxy.filelist
-cat .org.glite.lb.ws-interface.filelist .org.glite.lb.server-bones.filelist .org.glite.lb.server.filelist | sort | uniq > LB-server.filelist
+++ /dev/null
-#
-# common setting
-#
-
-#vdt_location=/home/honik/egee/vdt-1.5.0
-vdt_location=${VDT_LOCATION}
-
-# missing packages could be for example downloaded to repository from
-# http://eticssoft.web.cern.ch/eticssoft/repository/externals
-
-repository=/home/honik/egee/repository/externals/
-platform=slc3_ia32_gcc323
-
-
-#
-# external dependencies that are already part of VDT (vdt-1.5.0):
-#
-
-#classads_prefix=${repository}/classads/0.9.8/${platform}
-classads_prefix=${vdt_location}/classads
-
-#globus_prefix=${repository}/globus/2.4.3-VDT-1.2.5/${platform}
-globus_prefix=${vdt_location}/globus
-
-#expat_prefix=/usr
-expat_prefix=${vdt_location}/expat
-
-#mysql_prefix=${repository}/mysql-devel/4.1.11/${platform}
-mysql_prefix=${vdt_location}/mysql
-mysql_version=4.1.21
-
-voms_prefix=${vdt_location}/glite
-#voms_prefix=/home/honik/egee/glite/stage
-
-
-#
-# external dependencies that are NOT (yet) part of VDT (vdt-1.5.0):
-#
-
-#cares_prefix=${repository}/c-ares/1.3.0/${platform}
-cares_prefix=/software/cares-1.3
-
-# probably not needed (used "only" for unit tests - 'make check'):
-#cppunit_prefix=${repository}/cppunit/1.10.2/${platform}
-cppunit_prefix=/software/cppunit-1.10.2
-
-# probably not needed:
-#gridsite_prefix=${stagedir}
-
-gsoap_default_version=2.7.6b
-gsoap_versions=${gsoap_default_version}
-#gsoap_prefix=${repository}/gsoap/${gsoap_default_version}/${platform}
-gsoap_prefix=/software/gsoap-${gsoap_default_version}
-
-
-#
-# some other defaults:
-#
-
-#PREFIX=${vdt_location}/glite
-PREFIX=/tmp/lb4vdt
-globalprefix=glite
-lbprefix=lb
-
-builddir=build
-distdir=${STAGEDIR}/../dist
-stagedir=${STAGEDIR}
-top_srcdir=..
-
-#thrflavour=gcc64dbgpthr
-#nothrflavour=gcc64dbg
-thrflavour=gcc32dbgpthr
-nothrflavour=gcc32dbg
-
-# needed by org.glite.lb.client:
-glite_location=${stagedir}
-
+++ /dev/null
-#!/bin/sh
-
-set -e
-
-TOPDIR=${PWD}
-source ${LB4VDTDIR}/Makefile.inc
-cd org.gridsite.core/src
-make build-lib OPENSSL_FLAGS=-I${globus_prefix}/include/${nothrflavour} OPENSSL_LIBS=-L${globus_prefix}/lib FLAVOR_EXT=_${nothrflavour}
-make install-lib prefix=${STAGEDIR}
-cd ${TOPDIR}
-
+++ /dev/null
-package MultiStruct;
-
-use StructField;
-
-sub new {
- shift;
- my $self = {};
- $self->{comments} = {}; # typ->comment
- $self->{fields} = {}; # typ->{ name->StructField, ... }
- $self->{order} = {};
-
- bless $self;
-}
-
-sub selectType {
- my $self = shift;
- my $type = shift;
- $self->{type} = $type;
- 1;
-}
-
-sub addType {
- my $self = shift;
- my $type = shift;
- my $comment = shift;
- $self->selectType($type);
- $self->{comments}->{$type} = $comment;
- $self->{fields}->{$type} = {};
- 1;
-}
-
-sub selectField {
- my $self = shift;
- $self->{field} = shift;
- $self->getField;
-}
-
-sub addField {
- my $self = shift;
- my $field = shift;
-
- die "unselected type" unless $self->{type};
- $self->{fields}->{$self->{type}}->{$field->{name}} = $field;
- $self->selectField($field->{name});
- 1;
-}
-
-sub getField {
- my $self = shift;
- my $f = $self->{fields}->{$self->{type}}->{$self->{field}};
- return $f ? $f : $self->{fields}->{_common_}->{$self->{field}};
-}
-
-sub load {
- my $self = shift;
- my $fh = shift;
- local $_;
-
- while ($_ = <$fh>) {
-
- chomp;
- s/#.*$//;
- next if /^\s*$/;
-
- if (/^\@type\s+(\S+)\s*(.*$)$/) {
- $self->addType($1,$2);
- $self->{order}->{$1} = $.;
- next;
- }
-
- s/^\s*//;
- my ($ftype,$fname,$comment) = split /\s+/,$_,3;
- if ($ftype eq '_code_') {
- my $f = $self->getField();
- addCode $f $fname,$comment;
- }
- elsif ($ftype eq '_alias_') {
- my $f = $self->getField();
- addAlias $f $fname,$comment;
- }
- elsif ($ftype eq '_special_') {
- my $f = $self->getField();
- addSpecial $f $fname;
- }
- elsif ($ftype eq '_null_') {
- my $f = $self->getField();
- setNull $f $fname;
- }
- elsif ($ftype eq '_optional_') {
- my $f = $self->getField();
- $f->{optional} = 1;
- }
- elsif ($ftype eq '_index_') {
- my $f = $self->getField();
- $f->{index} = 1;
- }
- else {
- my $f = new StructField $fname,$ftype,$comment,$.;
- $self->addField($f);
- }
- }
-}
-
-sub getTypes {
- my $self = shift;
- my @out;
- local $_;
-
- for (keys %{$self->{fields}}) {
- push @out,$_ unless $_ eq '_common_';
- }
- @out;
-}
-
-sub getTypesOrdered {
- my $self = shift;
- my @names = getTypes $self;
-
- sort {
- my $oa = $self->{order}->{$a};
- my $ob = $self->{order}->{$b};
- $oa <=> $ob;
- } @names;
-}
-
-sub getTypeComment {
- my $self = shift;
- my $type = shift || $self->{type};
- $self->{comments}->{$type};
-}
-
-sub getFieldComment {
- my $self = shift;
- my $fname = shift;
- $self->{fields}->{$self->{type}}->{$fname}->{comment};
-}
-
-sub getFields {
- my $self = shift;
- keys %{$self->{fields}->{$self->{type}}};
-}
-
-sub getFieldsOrdered {
- my $self = shift;
- my @names = $self->getFields;
- sort {
- my $oa = $self->selectField($a)->{order};
- my $ob = $self->selectField($b)->{order};
- $oa <=> $ob;
- } @names;
-}
-
-sub getFieldOccurence {
- my $self = shift;
- my $fname = shift;
- my @out;
- local $_;
-
- for (keys %{$self->{fields}}) {
- push @out,$_ if $self->{fields}->{$_}->{$fname};
- }
- @out;
-}
-
-sub getAllFields {
- my $self = shift;
- my %out;
- local $_;
-
- for my $t (values %{$self->{fields}}) {
- $out{$_->{name}} = 1 for (values %$t);
- }
- keys %out;
-}
-
-sub getAllFieldsOrdered {
- my $self = shift;
- my @names = getAllFields $self;
-
- sort {
- my @occ = $self->getFieldOccurence($a);
- $self->selectType($occ[0]);
- my $oa = $self->selectField($a)->{order};
- @occ = $self->getFieldOccurence($b);
- $self->selectType($occ[0]);
- my $ob = $self->selectField($b)->{order};
- $oa <=> $ob;
- } @names;
-}
-
-1;
+++ /dev/null
-package StructField;
-
-$lang = 'C';
-1;
-
-sub new {
- shift;
- my $self = {};
- $self->{name} = shift;
- $self->{type} = shift;
- $self->{comment} = shift;
- $self->{order} = shift;
- $self->{null} = $main::DefaultNullValue{$self->{type}};
- bless $self;
-}
-
-sub addCode {
- my $self = shift;
- my $code = shift;
- my $comment = shift;
- push @{$self->{codes}},{name=>$code,comment=>$comment};
- 1;
-}
-
-sub addSpecial {
- my $self = shift;
- my $special = shift;
- $self->{special} = $special;
- 1;
-}
-
-sub addAlias {
- my $self = shift;
- my $name = shift;
- my $lang = shift;
- $self->{aliases}->{$lang} = $name;
- 1;
-}
-
-sub hasAlias {
- my $self = shift;
- my $lang = shift;
- return $self->{aliases}->{$lang} ? 1 : 0;
-}
-
-sub getName {
- my $self = shift;
- my $lang = shift || $lang;
- $self->{aliases}->{$lang} || $self->{name};
-# return $self->{aliases}->{$lang} ? $self->{aliases}->{$lang} : $self->{name};
-}
-
-sub getComment {
- my $self = shift;
- $self->{comment};
-}
-
-sub getDefaultNullValue {
- my $self = shift;
- $self->{null};
-}
-
-sub toString {
- my $self = shift;
- my $src = shift;
- my $dst = shift;
-
- eval $main::toString{$lang}->{$self->{type}};
-}
-
-sub fromString {
- my $self = shift;
- my $src = shift;
- my $dst = shift;
-
- eval $main::fromString{$lang}->{$self->{type}};
-}
-
-sub isNULL {
- my $self = shift;
- my $a = shift;
- my $b = $self->{null};
-
- eval $main::compare{$lang}->{$self->{type}};
-}
-
-sub isnotNULL {
- my $self = shift;
- my $src = shift;
-
- '!('.$self->isNULL($src).')';
-}
-
-sub compare {
- my $self = shift;
- my $a = shift;
- my $b = shift;
- eval $main::compare{$lang}->{$self->{type}};
-}
-
-sub toFormatString {
- my $self = shift;
-
- eval $main::toFormatString{$lang}->{$self->{type}};
-}
-
-sub setNull {
- my $self = shift;
- $self->{null} = shift;
-}
-
-sub getType {
- my $self = shift;
-
- eval $main::types{$lang}->{$self->{type}};
-}
+++ /dev/null
-#!/usr/bin/perl -w
-
-use File::Basename;
-my $dir;
-BEGIN{
- $dir = dirname $0;
-}
-
-my $lines = $ENV{AT3_LINES};
-
-use lib $dir;
-use MultiStruct;
-require 'types.T';
-
-my $eventsn;
-for (@INC) {
- if (-f "$_/events.T") {
- $eventsn="$_/events.T";
- last;
- }
-}
-
-my $statusn;
-for (@INC) {
- if (-f "$_/status.T") {
- $statusn = "$_/status.T";
- last;
- }
-}
-
-my $indent = '';
-
-my $event = new MultiStruct;
-my $status = new MultiStruct;
-
-sub gen {
- local $_ = shift;
-
- s/^\n!//;
- s/\n!/\n/g;
- print $_;
-}
-
-
-open EVENTS,$eventsn or die "$eventsn: $!\n";
-$event->load(\*EVENTS);
-close EVENTS;
-
-open STATUS,$statusn or die "$statusn: $!\n";
-$status->load(\*STATUS);
-close STATUS;
-
-my $code;
-my $startcode;
-while (<>) {
- chomp;
- if (/^\@\@\@LANG: (\S+)$/) {
- $StructField::lang = $1;
- next;
- }
-
- if ($code) {
- if (/^\@\@\@}$/) {
- $code .= "1;\n";
- print "#line $startcode \"$ARGV\"\n/* begin */\n" if $lines;
- eval $code or warn "eval: $@ at $ARGV:$.\n";
- my $nxtline = $.+1;
- print "/* end */\n#line $nxtline \"$ARGV\"\n" if $lines;
- undef $code;
- }
- else { $code .= $_."\n"; }
- }
- else {
- if (/^\@\@\@{$/) {
- $startcode = $.;
- $code = "\n";
- }
- elsif (/^\@\@\@AUTO$/) {
- print qq{
- !! Automatically generated file
- !! Do not edit, your changes will be discarded upon build
- !! Change the corresponding template file $ARGV
-
-};
- print "#line $. \"$ARGV\"\n" if $lines;
- }
- else {
- print "$_\n";
- }
- }
-}
-
-# print $event_common{prog}->copy('bla','hu');
+++ /dev/null
-#Fri Aug 18 12:35:01 CEST 2006
-module.build=0242
+++ /dev/null
-ext.gsoap.version=2.7.6b
+++ /dev/null
-#!/usr/bin/perl
-
-# check_version script to be used to compare client-interface and other modules versions
-# Usage:
-# - set environment variables VERSION and VERSION_AHEAD of the module
-# - run against ${stagedir}/include/glite/lb/interface_version.h
-# Example:
-# ./check_version.pl interface_version.h
-
-my $version = $ENV{VERSION};
-if ($version =~ /(\d+)\.\d+\.\d+/) {
- $version = $1;
-} else {
- print "error: wrong version format ($version)\n";
- exit 1;
-}
-
-my $ahead = $ENV{VERSION_AHEAD};
-if ($ahead =~ /(\d+)/) {
- $ahead = $1;
-} else {
- print "error: wrong version_ahead format ($ahead)\n";
- exit 1;
-}
-
-my $iface;
-
-while (<>) {
- /#define GLITE_LB_CLIENT_INTERFACE "(\d+)\.\d+\.\d+"/;
- $iface = $1;
-}
-
-if ($iface + $ahead != $version) {
- print "error: Major version of the interface ($iface + $ahead ahead) DOES NOT match implementation ($version)\n" ;
- exit 1;
-}
+++ /dev/null
-
-###################################################################
-# System dependencies
-###################################################################
-
-org.glite.version = HEAD
-org.glite.lb.version = glite-lb_R_1_5_2_1
-
-# Component dependencies tag = do not remove this line =
-org.glite.lb.client-interface.version = glite-lb-client-interface_R_2_3_3_1
-org.glite.lb.ws-interface.version = glite-lb-ws-interface_R_2_3_0_3
-org.glite.lb.common.version = glite-lb-common_R_5_1_2_1
-org.glite.lb.client.version = glite-lb-client_R_2_3_4_1
-org.glite.lb.server.version = glite-lb-server_R_1_6_1_1
-org.glite.lb.proxy.version = glite-lb-proxy_R_1_4_1_4
-org.glite.lb.server-bones.version = glite-lb-server-bones_R_2_2_5_1
-org.glite.lb.logger.version = glite-lb-logger_R_1_4_3_1
-org.glite.lb.utils.version = glite-lb-utils_R_1_1_1_3
-
-ext.gsoap.version = 2.7.6b
+++ /dev/null
-@type _common_
- timeval timestamp Time the event was generated.
- _alias_ date ULM
- timeval arrived Time the event was stored into the bookkeeping server database.
- _alias_ arr_date ULM
- _optional_
- string host Hostname of the machine where the event was generated.
- _alias_ host ULM
- int level Logging level (in the range from DEBUG to EMERGENCY).
- _alias_ lvl ULM
- _code_ EMERGENCY emergency
- _code_ ALERT alert
- _code_ ERROR error
- _code_ WARNING warning
- _code_ AUTH authentication
- _code_ SECURITY security
- _code_ USAGE usage
- _code_ SYSTEM system
- _code_ IMPORTANT important
- _code_ DEBUG debug
- int priority Message priority (yet 0 for asynchronous and 1 for synchronous transfers).
- _null_ -1
- jobid jobId Grid job id of the job the event belongs to.
- string seqcode Sequence code assigned to the event.
- string user Identity (certificate subject) of the event sender.
- logsrc source Source (software component) which generated this event.
-# string prog name of program ("EDG WMS" of name of the application).
- string src_instance Instance of source component (e.g. service communication endpoint).
- _optional_
-
-@type Transfer Start, success, or failure of job transfer to another component.
- logsrc destination Destination where the job is being transfered to.
- string dest_host Hostname of server that takes over control of the job.
- string dest_instance Service (instance) that takes over control of the job.
- _optional_
- string job Job description in receiver's language.
- int result Result code of the transfer attempt (START, OK, REFUSED or FAIL).
- _code_ START The sending component has started or is about to start the transfer.
- _code_ OK The job was sent successfully.
- _code_ REFUSED The job was refused by the other component.
- _code_ FAIL The transfer failed for other reason than explicit refusal (eg. network timeout).
- string reason Detailed description of the transfer, especially reason of failure.
- _optional_
- string dest_jobid Job id as assigned by the receiving software component.
- _optional_
-
-@type Accepted Accepting job (successful counterpart to Transfer).
- logsrc from The software component the job was received from.
- string from_host Hostname of the component the job was received from.
- string from_instance Instance of the component the job was received from.
- _optional_
- string local_jobid New job id as assigned by the receiving component.
-
-@type Refused Refusing job (unsuccessful counterpart to Transfer).
- logsrc from The software component that tried to send the job.
- string from_host Hostname of the component that tried to send the job.
- string from_instance Instance of the component that tried to send the job.
- _optional_
- string reason Description of the reason why the job was refused.
-
-@type EnQueued The job has been enqueued in an inter-component queue.
- string queue Queue into which the job has been stored for retrieval by another component.
- string job Job description in the receiver's language.
- int result Result code of the attempt to put job into the queue (START, OK, REFUSED or FAIL).
- _code_ START The sending component has started or is about to start enqueuing the job.
- _code_ OK The job was enqueued successfully.
- _code_ REFUSED The job was refused by the other component.
- _code_ FAIL The transfer failed for other reason than explicit refusal.
- string reason Detailed description of the attempt to enqueue the job, especially the reason of failure.
-
-@type DeQueued The job has been dequeued from an inter-component queue.
- string queue Name of the queue the job was obtained from.
- string local_jobid New job id as assigned by the retreiving component.
-
-@type HelperCall Helper component is called.
- string helper_name Name of the called helper component.
- string helper_params Parameters of the call to the helper component.
- int src_role The role the event sender is playing in the helper call (CALLING or CALLEE).
- _code_ CALLING The logging component is caller.
- _code_ CALLED The logging component is callee.
-
-@type HelperReturn Helper component is returning the control.
- string helper_name Name of the called helper component.
- string retval Data returned by the call to the helper component.
- int src_role The role the event sender is playing in the helper call (CALLING or CALLEE).
- _code_ CALLING The logging component is caller.
- _code_ CALLED The logging component is callee.
-
-@type Running Job wrapper started.
- string node Worker node on which the job executable is being run.
-
-@type Resubmission Result of resubmission decision.
- int result Result code of the resubmission decision (WILLRESUB or WONTRESUB or SHALLOW).
- _code_ WILLRESUB The job will be resubmitted (deep resubmission).
- _code_ WONTRESUB The job will not be resubmitted.
- _code_ SHALLOW Shallow resubmission (user payload has not started yet)
- string reason Reason why the job will or will not be resubmitted.
- string tag Value of the attribute on which the decision to resubmit the job was based.
-
-@type Done Execution terminated (normally or abnormally).
- int status_code Reason code for the termination of the job (OK, FAILED or CANCELLED).
- _code_ OK The job terminated by itself.
- _code_ FAILED The job disappeared from LRMS.
- _code_ CANCELLED The job was cancelled by user request.
- string reason Detailed description why the job was terminated.
- int exit_code Exit code of the job's process.
- _null_ -1
-
-@type Cancel Cancel operation has been attempted on the job.
- int status_code Classification of the attempt to cancel the job (REQ, REFUSE, DONE or ABORT).
- _code_ REQ The request was acknowledged.
- _code_ REFUSE The request was declined by this component.
- _code_ DONE The request was completed by whole WMS.
- _code_ ABORT The request was refused by whole WMS.
- string reason Detailed description of the attempt to cancel the job, especially the reason of failure.
-
-@type Abort Job aborted by system.
- string reason Reason why the job was aborted by the system.
-
-@type Clear Job cleared, output sandbox removed
- int reason Description of the reason why the job was cleared and the output sandbox removed (USER, TIMEOUT or NOOUTPUT).
- _code_ USER User retrieved output sandbox.
- _code_ TIMEOUT Timed out, resource forced purge of the sandbox.
- _code_ NOOUTPUT No output was generated.
-
-@type Purge Job is purged from bookkepping server.
-
-@type Match Matching CE found.
- string dest_id Identification of the queue on the CE that the job could be send to.
-
-@type Pending No matching CE found yet.
- string reason Description why the matching CE for the job was not found (yet).
-
-@type RegJob New job registration.
- string jdl Job description of the job being registered.
- _optional_
- string ns NetworkServer handling the newly registered job.
- jobid parent Grid job id of the parent job registering this new one.
- _optional_
-
- int jobtype Type of the job being registered (SIMPLE, DAG, PARTITIONABLE or PARTITIONED).
- _code_ SIMPLE The job is simple job.
- _code_ DAG The job is dag (containing static set of subjobs).
- _code_ PARTITIONABLE The job is partitionable (may become partitioned).
- _code_ PARTITIONED The job is partitioned (dynamically created dag).
- _code_ COLLECTION The job is collection (containing static set of subjobs).
- _code_ PBS PBS job
- _code_ CONDOR Condor job
-
- int nsubjobs Number of subjobs this job plans to spawn.
- _optional_
- string seed Seed for subjob id generation.
- _optional_
-
-@type Chkpt Application-specific checkpoint record.
- string tag Application specific checkpoint tag.
- string classad Application specific checkpoint value.
-
-@type Listener Listening network port for interactive control.
- string svc_name Name of the port instance for interactive job control.
- string svc_host Hostname of the interactive job controller.
- port svc_port Port number of the interactive job controller.
-
-@type CurDescr Current state of job processing (optional event).
- string descr Description of the current job transformation (output of the helper).
-
-@type UserTag User tag -- arbitrary name=value pair.
- string name Arbitrary user tag name.
- string value Arbitrary user tag value.
-
-@type ChangeACL Management of ACL stored on bookkepping server.
- string user_id DN or VOMS parameter (in format VO:group).
- int user_id_type Type of information given in user_id (DN or VOMS).
- _null_ -1
- int permission ACL permission to change (currently only READ).
- _null_ -1
- int permission_type Type of permission requested ('allow', 'deny').
- _null_ -1
- int operation Operation requested to perform with ACL (add, remove).
- _null_ -1
-
-@type Notification Management of notification service.
- notifid notifId Notification id.
- string owner Identification of the job owner (certificate subject).
- string dest_host Hostname the notification is sent to.
- port dest_port Port number the notification is sent to.
- string jobstat Status of the job (the notification content).
-
-
-@type ResourceUsage Resource (CPU, memory etc.) consumption.
- string resource Resource's name.
- double quantity Resources's quantity (how much).
- string unit Units (sec, kB, etc.).
-
-@type ReallyRunning User payload started.
- _optional_
- string wn_seq Sequence code on the worker node.
-
-@type Suspend Job execution (queuing) was suspended.
- _optional_
- string reason Reason for the suspend.
-
-@type Resume Job execution (queuing) was resumed.
- _optional_
- string reason Reason for the resume.
-
-@type CollectionState State of the collection.
- string state New collection state.
- _optional_
- int done_code In case of (state == Done) contains done code
- _null_ -1
- string histogram User readable histogram; useful for debugging.
- jobid child JobId of subjob, which triggered the state change.
- string child_event Event which triggered the state change.
-
-
-@type PBSQueued Job enqued
- string queue Queue name
- string owner Job owner
- string name Job name
-
-@type PBSMatch Scheduler created exec_host
- string dest_host Aka exec_host
-
-@type PBSPending Scheduler is not able to find exec_host, or some error occured
- string reason Reasons of job pendation or errors
-
-@type PBSRun Job attempted to be run by the logging component
- string scheduler Scheduler ID
- _optional_
- string dest_host Where to run the job
- _optional_
- int pid Actual process ID
- _optional_
-
-@type PBSRerun Job rerun requested
-
-@type PBSDone Job terminated
- int exit_status Exit status
- _optional_ Bypass need of 'null value'
-
-@type PBSDequeued Job dequeued
-
-@type PBSResourceUsage Resources requested/consumed
- int usage Type of record
- _code_ REQUESTED Requested value
- _code_ USED Consumed quantity
- string name Name of resource
- double quantity The quantity
- _optional_ Bypass need of 'null value'
- string unit Units (sec, kB, etc.)
-
-@type PBSError Any error occured
- string error_desc Error reason
-
-@type CondorMatch Job MATCHed
- string owner Owner
- string dest_host Matched host
- string preempting Preempting
- _optional_
-
-@type CondorReject Job REJECTed
- string owner Owner
- int status_code Reason code for the rejection of the job
- _code_ NOMATCH No match found
- _code_ OTHER Other reason
-
-@type CondorShadowStarted Condor Shadow Started
- string shadow_host Shadow host
- port shadow_port Shadow port
- int shadow_pid PID of shadow process
- string shadow_status Shadow status
- _optional_
-
-@type CondorShadowExited Condor Shadow Exited
- int shadow_pid PID of shadow process
- int shadow_exit_status Exit status of shadow process
- _null_ -1
-
-@type CondorStarterStarted Condor Starter Started
- int starter_pid PID of starter process
- _optional_
- string universe Condor Universe
- _optional_
-
-@type CondorStarterExited Condor Starter Exited
- int starter_pid PID of starter process
- _optional_
- int starter_exit_status Exit status of starter process
- _null_ -1
- _optional_
- int job_pid PID of running job
- _optional_
- int job_exit_status Job exit status
- _null_ -1
- _optional_
-
-@type CondorResourceUsage Resources requested/consumed
- int usage Type of record
- _code_ REQUESTED Requested value
- _code_ USED Consumed quantity
- string name Name of resource
- double quantity The quantity
- _optional_ Bypass need of 'null value'
- string unit Units (sec, kB, etc.)
-
-@type CondorError Any Error occured
- string error_desc Error reason
-
+++ /dev/null
-<?xml version="1.0"?>
-<!--
- Copyright (c) 2004 on behalf of the EU EGEE Project:
- The European Organization for Nuclear Research (CERN),
- Istituto Nazionale di Fisica Nucleare (INFN), Italy
- Datamat Spa, Italy
- Centre National de la Recherche Scientifique (CNRS), France
- CS Systeme d'Information (CSSI), France
- Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden
- Universiteit van Amsterdam (UvA), Netherlands
- University of Helsinki (UH.HIP), Finland
- University of Bergen (UiB), Norway
- Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom
-
- gLite Middleware Logging and Bookkeping Configuration Specification File
-
- Authors: Alberto Di Meglio <alberto.di.meglio@cern.ch>
- Joachim Flammer <Joachim.Flammer@cern.ch>
- Ales Krenek <ljocha@ics.muni.cz>
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
- Revision 1.16 2006/03/15 17:33:24 akrenek
- merge of 1.5 branch
-
- Revision 1.15 2005/11/27 21:51:18 eronchie
- Applied fix for bug 13928
-
- Revision 1.14 2005/10/15 20:14:55 jpospi
- remove duplicate lb.utils section
-
- Revision 1.13.2.1.2.1 2005/11/28 10:39:08 akrenek
- merge bug #13928 fix on the pre_cares branch
-
- Revision 1.13.2.1 2005/10/17 16:27:48 akrenek
- merged in the duplicate utils targed patch
-
- Revision 1.15 2005/11/27 21:51:18 eronchie
- Applied fix for bug 13928
-
- Revision 1.14 2005/10/15 20:14:55 jpospi
- remove duplicate lb.utils section
-
- Revision 1.13 2005/10/15 13:36:26 akrenek
- added lb.utils
-
- Revision 1.12 2005/03/16 10:02:52 zsalvet
- proxy component added
-
- Revision 1.11 2004/12/01 18:01:55 zsalvet
- LB here, not R-GMA
-
- Revision 1.10 2004/11/29 16:01:21 zsalvet
- Evaluate component.{head,tag} conditions before use of get.* targets.
-
- Revision 1.9 2004/11/29 15:16:26 zsalvet
- Add ws-interface to checkout/build machinery.
-
- Revision 1.8 2004/10/18 22:55:14 dimeglio
- Added oscheck to various targets
-
- Revision 1.7 2004/10/15 12:30:01 akrenek
- build with lb.sever-bones
-
- Revision 1.6 2004/08/27 10:03:41 zurek
- typo problem
-
- Revision 1.5 2004/08/27 09:13:11 zurek
- changing thee order for build
-
- Revision 1.4 2004/07/29 10:47:46 dimeglio
- Added server and logger
-
- Revision 1.3 2004/07/16 16:25:43 flammer
- Added tags for automated adding of components.
-
- Revision 1.2 2004/06/23 00:22:11 dimeglio
- Added client and client-interface components
-
- Revision 1.1 2004/06/18 23:05:53 dimeglio
- Added/upgraded default build scripts
-
--->
-
-
-<project name="GLite Middleware Logging and Bookkeping CSF" default="all">
-
- <!-- ===============================================
- Determine workspace directory
- =============================================== -->
-
- <!-- Relative workspace root directory -->
- <property name="workspace.dir" value="../.." />
-
- <!-- ===============================================
- Load properties
- =============================================== -->
-
- <!-- load baseline and user properties -->
- <import file="${workspace.dir}/org.glite/project/baseline.properties.xml" />
-
- <!-- define build properties file location since we are already in project dir -->
- <property name="subsystem.build.properties.file" value="./build.properties" />
-
- <!-- Load subsystem-specific property file -->
- <property file="./properties.xml"/>
-
- <!-- load global properties -->
- <import file="${global.properties.file}" />
-
- <!-- ===============================================
- Load dependencies
- =============================================== -->
-
- <!-- Load user dependencies file -->
- <property file="${user.dependencies.file}" />
-
- <!-- Load subsystem dependencies file -->
- <property file="./dependencies.properties" />
-
- <!-- Load global dependencies file -->
- <property file="${global.dependencies.file}" />
-
- <!-- ===============================================
- Load targets
- =============================================== -->
- <import file="${global.targets-envchecks.file}" />
- <import file="${global.targets-external-dependencies.file}" />
-
- <!-- ===============================================
- Evaluate CVS tags
- =============================================== -->
-
- <target name="evaluate.cvs.tags" description="Figure out if we need tagged CVS checkout">
- <condition property="glite.head">
- <and>
- <equals arg1="${org.glite.version}" arg2="HEAD" />
- <or>
- <istrue value="${update}" />
- <not>
- <available file="${global.dependencies.file}" type="file" />
- </not>
- </or>
- </and>
- </condition>
- <condition property="glite.tag">
- <and>
- <not>
- <equals arg1="${org.glite.version}" arg2="HEAD" />
- </not>
- <or>
- <istrue value="${update}" />
- <not>
- <available file="${global.dependencies.file}" type="file" />
- </not>
- </or>
- </and>
- </condition>
- <condition property="glite-lb.head">
- <and>
- <equals arg1="${org.glite.lb.version}" arg2="HEAD" />
- <istrue value="${update}" />
- </and>
- </condition>
- <condition property="glite-lb.tag">
- <and>
- <not>
- <equals arg1="${org.glite.lb.version}" arg2="HEAD" />
- </not>
- <istrue value="${update}" />
- </and>
- </condition>
-
- <!-- condition property tag = do not remove = -->
-
- <condition property="utils.head">
- <equals arg1="${org.glite.lb.utils.version}" arg2="HEAD" />
- </condition>
-
- <condition property="common.head">
- <equals arg1="${org.glite.lb.common.version}" arg2="HEAD" />
- </condition>
-
- <condition property="server-bones.head">
- <equals arg1="${org.glite.lb.server-bones.version}" arg2="HEAD" />
- </condition>
-
- <condition property="client-interface.head">
- <equals arg1="${org.glite.lb.client-interface.version}" arg2="HEAD" />
- </condition>
-
- <condition property="ws-interface.head">
- <equals arg1="${org.glite.lb.ws-interface.version}" arg2="HEAD" />
- </condition>
-
- <condition property="client.head">
- <equals arg1="${org.glite.lb.client.version}" arg2="HEAD" />
- </condition>
-
- <condition property="server.head">
- <equals arg1="${org.glite.lb.server.version}" arg2="HEAD" />
- </condition>
-
- <condition property="proxy.head">
- <equals arg1="${org.glite.lb.proxy.version}" arg2="HEAD" />
- </condition>
-
- <condition property="logger.head">
- <equals arg1="${org.glite.lb.logger.version}" arg2="HEAD" />
- </condition>
-
- </target>
-
- <presetdef name="cvs-co">
- <cvs command="checkout" dest="${workspace.dir}" />
- </presetdef>
-
- <!-- =====================================================
- Self-update if required
- ===================================================== -->
-
- <!-- Update main GLite module -->
- <target name="org.glite" depends="evaluate.cvs.tags, get.glite.head, get.glite.tag"/>
- <target name="get.glite.head" if="glite.head">
- <cvs-co package="org.glite" />
- </target>
- <target name="get.glite.tag" if="glite.tag">
- <cvs-co package="org.glite"
- tag="${org.glite.version}" />
- </target>
-
- <!-- Update the current module -->
- <target name="org.glite.lb" depends="evaluate.cvs.tags, get.glite-lb.head, get.glite-lb.tag"/>
- <target name="get.glite-lb.head" if="glite-lb.head">
- <cvs-co package="org.glite.lb" />
- <fail>The org.glite and org.glite.lb modules have been updated, please rerun the configuration file</fail>
- </target>
- <target name="get.glite-lb.tag" if="glite-lb.tag">
- <cvs-co package="org.glite.lb"
- tag="${org.glite.lb.version}" />
- <fail>The org.glite and org.glite.lb modules have been updated, please rerun the configuration file</fail>
- </target>
-
- <!-- *****************************************************-->
- <!-- Development tools -->
- <!-- *****************************************************-->
-
- <!-- All development tools -->
- <target name="devtools" depends="oscheck,
- evaluate.cvs.tags,
- junitcheck,
- junit,
- chkstyle,
- jalopy,
- ant-contrib,
- cpptasks,
- egee-ant-ext"
- description="Get development tools into repository."/>
-
- <!-- =====================================================
- External libraries
- ===================================================== -->
-
- <!-- All external libraries -->
- <target name="external" depends="oscheck,
- evaluate.cvs.tags,
- classads,
- globus"
- description="Install external packages"/>
-
- <!-- =====================================================
- GLite Middleware LB modules
- ===================================================== -->
-
- <!-- component targets tag = do not remove = -->
-
- <!-- common -->
- <target name="common" depends="evaluate.cvs.tags, get.common.head, get.common.tag"/>
- <target name="get.common.head" if="common.head">
- <cvs-co package="org.glite.lb.common" />
- </target>
- <target name="get.common.tag" unless="common.head">
- <cvs-co package="org.glite.lb.common"
- tag="${org.glite.lb.common.version}" />
- </target>
-
- <!-- server-bones -->
- <target name="server-bones" depends="evaluate.cvs.tags, get.server-bones.head, get.server-bones.tag"/>
- <target name="get.server-bones.head" if="server-bones.head">
- <cvs-co package="org.glite.lb.server-bones" />
- </target>
- <target name="get.server-bones.tag" unless="server-bones.head">
- <cvs-co package="org.glite.lb.server-bones"
- tag="${org.glite.lb.server-bones.version}" />
- </target>
-
- <!-- client-interface -->
- <target name="client-interface" depends="evaluate.cvs.tags, get.client-interface.head, get.client-interface.tag"/>
- <target name="get.client-interface.head" if="client-interface.head">
- <cvs-co package="org.glite.lb.client-interface" />
- </target>
- <target name="get.client-interface.tag" unless="client-interface.head">
- <cvs-co package="org.glite.lb.client-interface"
- tag="${org.glite.lb.client-interface.version}" />
- </target>
-
- <!-- WS interface -->
- <target name="ws-interface" depends="evaluate.cvs.tags, get.ws-interface.head, get.ws-interface.tag"/>
- <target name="get.ws-interface.head" if="ws-interface.head">
- <cvs-co package="org.glite.lb.ws-interface" />
- </target>
- <target name="get.ws-interface.tag" unless="ws-interface.head">
- <cvs-co package="org.glite.lb.ws-interface"
- tag="${org.glite.lb.ws-interface.version}" />
- </target>
-
- <!-- client -->
- <target name="client" depends="evaluate.cvs.tags, get.client.head, get.client.tag"/>
- <target name="get.client.head" if="client.head">
- <cvs-co package="org.glite.lb.client" />
- </target>
- <target name="get.client.tag" unless="client.head">
- <cvs-co package="org.glite.lb.client"
- tag="${org.glite.lb.client.version}" />
- </target>
-
- <!-- server -->
- <target name="server" depends="evaluate.cvs.tags, get.server.head, get.server.tag"/>
- <target name="get.server.head" if="server.head">
- <cvs-co package="org.glite.lb.server" />
- </target>
- <target name="get.server.tag" unless="server.head">
- <cvs-co package="org.glite.lb.server"
- tag="${org.glite.lb.server.version}" />
- </target>
-
- <!-- proxy -->
- <target name="proxy" depends="evaluate.cvs.tags, get.proxy.head, get.proxy.tag"/>
- <target name="get.proxy.head" if="proxy.head">
- <cvs-co package="org.glite.lb.proxy" />
- </target>
- <target name="get.proxy.tag" unless="proxy.head">
- <cvs-co package="org.glite.lb.proxy"
- tag="${org.glite.lb.proxy.version}" />
- </target>
-
- <!-- logger -->
- <target name="logger" depends="evaluate.cvs.tags, get.logger.head, get.logger.tag"/>
- <target name="get.logger.head" if="logger.head">
- <cvs-co package="org.glite.lb.logger" />
- </target>
- <target name="get.logger.tag" unless="logger.head">
- <cvs-co package="org.glite.lb.logger"
- tag="${org.glite.lb.logger.version}" />
- </target>
-
- <!-- utils -->
- <target name="utils" depends="get.utils.head, get.utils.tag"/>
- <target name="get.utils.head" if="utils.head">
- <cvs-co package="org.glite.lb.utils" />
- </target>
- <target name="get.utils.tag" unless="utils.head">
- <cvs-co package="org.glite.lb.utils"
- tag="${org.glite.lb.utils.version}" />
- </target>
-
- <!-- All project modules -->
- <target name="project" depends="utils,
- client-interface,
- ws-interface,
- common,
- server-bones,
- client,
- server,
- proxy,
- logger"/>
-
-
- <!-- ====================================================
- Checkout all
- ==================================================== -->
-
- <!-- All libraries -->
- <target name="all" depends="oscheck,evaluate.cvs.tags, defaultenvchecks, org.glite, org.glite.lb, devtools, external, project" />
-
- <!-- ====================================================
- Print dependecies to console
- ==================================================== -->
-
- <target name="dependencies">
- <concat>
- <fileset dir="." includes="dependencies.properties" />
- </concat>
- </target>
-
-</project>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2004 on behalf of the EU EGEE Project:
- The European Organization for Nuclear Research (CERN),
- Istituto Nazionale di Fisica Nucleare (INFN), Italy
- Datamat Spa, Italy
- Centre National de la Recherche Scientifique (CNRS), France
- CS Systeme d'Information (CSSI), France
- Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden
- Universiteit van Amsterdam (UvA), Netherlands
- University of Helsinki (UH.HIP), Finland
- University of Bergen (UiB), Norway
- Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom
-
- Common build properties file for the gLite LB modules
-
- Authors: Ales Krenek <ljocha@ics.muni.cz>
- Alberto Di Meglio <alberto.di.meglio@cern.ch>
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
--->
-
-<project name="Logging and Bookkeping subsystem common properties">
-
- <!-- Include build properties to allow overwriting
- of properties for subsystem -->
- <property name="subsystem.build.properties.file" value="./project/build.properties" />
- <property file="${subsystem.build.properties.file}" />
-
- <!-- ======================================================
- Define subsystem properties
- ====================================================== -->
-
- <!-- Subsystem name -->
- <property name="subsystem.name" value="${lb.subsystem.name}"/>
-
- <!-- Subsystem prefix -->
- <property name="subsystem.prefix" value="${lb.subsystem.prefix}"/>
-
- <!-- ======================================================
- Define general subsystem properties
- ====================================================== -->
-
- <!-- Include common subsystem properties -->
- <import file="${subsystem.general.properties.file}" />
-
- <!-- ======================================================
- Define extra properties here ...
- ====================================================== -->
-
-
-</project>
\ No newline at end of file
+++ /dev/null
-#!/bin/sh
-
-cd ../..
-
-cvs co org.glite
-cvs co org.glite.lb
-
-cd org.glite.lb/project
-ant -f glite.lb.csf.xml
-
+++ /dev/null
-@type _common_
-jobid jobId Id of the job
-string owner Job owner
-_index_
-
-int jobtype Type of job
- _null_ -1
- _code_ SIMPLE simple job
- _code_ DAG composite job
- _code_ COLLECTION parent of collection of jobs
- _code_ PBS PBS job
- _code_ CONDOR Condor job
-jobid parent_job parent job of subjob
-
-string seed string used for generation of subjob IDs
-int children_num number of subjobs
-strlist children list of subjob IDs
- _special_ XMLstructured
-intlist children_hist summary (histogram) of children job states
- _special_ XMLstructured
-stslist children_states full status information of the children
- _special_ XMLstructured
-
-string condorId Id within Condor-G
-string globusId Globus allocated Id
-string localId Id within LRMS
-
-string jdl User submitted job description
-string matched_jdl Full job description after matchmaking
-string destination ID of CE where the job is being sent
-_index_
-string condor_jdl ClassAd passed to Condor-G for last job execution
-string rsl Job RSL sent to Globus
-
-string reason Reason of being in this status, if any
-
-string location Where the job is being processed
-_index_
-string ce_node Worker node where the job is executed
-string network_server Network server handling the job
-
-bool subjob_failed Subjob failed (the parent job will fail too)
-int done_code Return code
- _null_ -1
- _code_ OK Finished correctly
- _code_ FAILED Execution failed
- _code_ CANCELLED Cancelled by user
-int exit_code Unix exit code
-bool resubmitted The job was resubmitted
-
-bool cancelling Cancellation request in progress
-string cancelReason Reason of cancel
-
-int cpuTime Consumed CPU time
- _null_ -1
-
-taglist user_tags List of pairs (user_tag, user_value)
- _special_ XMLstructured
-
-timeval stateEnterTime When entered this status
-timeval lastUpdateTime Last known event of the job
-
-intlist stateEnterTimes When all previous states were entered
- _special_ XMLstructured
-
-bool expectUpdate Some logged information has not arrived yet
-string expectFrom Sources of the missing information
-string acl ACL of the job
-
-bool payload_running User payload started
-strlist possible_destinations Possible job destinations
- _special_ XMLstructured
-strlist possible_ce_nodes CE nodes matching to possible_destinations
- _special_ XMLstructured
-
-bool suspended Job is suspended
-string suspend_reason Reason for the suspend
-
-string pbs_state Job state which would probably return PBS qstat (Q/R/C/....)
-string pbs_queue Name of queue in which is job queued
-string pbs_owner Owner of job
-string pbs_name Name of job
-string pbs_reason Glued reasons/errors leading to pending events
-string pbs_scheduler Name of pbs scheduler
-string pbs_dest_host Hostname of node where job is running
-int pbs_pid PID of running job
-string pbs_resource_usage Glued resource usage
-int pbs_exit_status Job exit status
-string pbs_error_desc Glued error descriptions from error events
-
-string condor_status Condor job status
-string condor_universe Condor job Universe (in job ClassAds)
-string condor_owner Job owner
-int condor_shadow_pid PID of Shadow
-int condor_shadow_exit_status Condor shadow exit status (see h/exit.h)
-int condor_starter_pid PID of Starter
-int condor_starter_exit_status Condor starter exit status
-int condor_job_pid PID of running job
-int condor_job_exit_status Job exit status
-string condor_dest_host Hostname of node where job is running
-string condor_reason Glued reasons/errors leading to pending events
-string condor_error_desc Glued error descriptions from error events
-
-
-@type Submitted Entered by the user to the User Interface or registered by Job Partitioner.
-@type Waiting Accepted by WMS, waiting for resource allocation.
-@type Ready Matching resources found.
-@type Scheduled Accepted by LRMS queue.
-@type Running Executable is running.
-@type Done Execution finished, output is available.
-@type Cleared Output transfered back to user and freed.
-@type Aborted Aborted by system (at any stage).
-@type Cancelled Cancelled by user.
-@type Unknown Status cannot be determined.
-@type Purged Job has been purged from bookkeeping server (for LB->RGMA interface).
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2004 on behalf of the EU EGEE Project:
- The European Organization for Nuclear Research (CERN),
- Istituto Nazionale di Fisica Nucleare (INFN), Italy
- Datamat Spa, Italy
- Centre National de la Recherche Scientifique (CNRS), France
- CS Systeme d'Information (CSSI), France
- Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden
- Universiteit van Amsterdam (UvA), Netherlands
- University of Helsinki (UH.HIP), Finland
- University of Bergen (UiB), Norway
- Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom
-
- Common Ant task definition file for the gLite Logging and Bookeeping modules
-
- Authors: Ales Krenek <ljocha@ics.muni.cz>
- Alberto Di Meglio <alberto.di.meglio@cern.ch>
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
--->
-
-<project name="Logging and Bookeeping subsystem common tasks and types definitions">
-
- <!-- ======================================================
- Subsystem task definitions
- ====================================================== -->
-
-</project>
\ No newline at end of file
+++ /dev/null
-%types = (
- C=>{
- bool=>'"int"',
- string=>'"char *"',
- strlist=>'"char **"',
- intlist=>'"int *"',
- taglist=>'"edg_wll_TagValue *"',
- stslist=>'"struct _edg_wll_JobStat *"',
- timeval=>'"struct timeval"',
- jobid=>'"edg_wlc_JobId"',
- notifid=>'"edg_wll_NotifId"',
- logsrc=>'"edg_wll_Source"',
- port=>'"uint16_t"',
-# level=>'"enum edg_wll_Level"',
- int=>'"int"',
- float=>'"float"',
- double=>'"double"',
- },
- 'C++'=>{
- string=>'"std::string"',
- timeval=>'"struct timeval"',
- jobid=>'"edg::workload::common::jobid::JobId"',
- bool=>'"int"',
- intlist=>'"std::vector<int>"',
- strlist=>'"std::vector<std::string>"',
- taglist=>'"std::vector<std::pair<std::string>>"',
- stslist=>'"std::vector<JobStatus>"',
- logsrc=>'"int"',
- port=>'"int"',
- int=>'"int"',
- float=>'"float"',
- double=>'"double"',
- },
- 'wsdl'=>{
- bool=>'"xsd:boolean"',
- string=>'"xsd:string"',
- int=>'"xsd:int"',
- jobid=>'"xsd:string"',
- jobstat=>'"jobStatus"',
- usertag=>'"tagValue"',
- timeval=>'"timeval"',
- logsrc=>'"eventSource"',
- notifid=>'"xsd:string"',
- port=>'"xsd:int"',
- float=>'"xsd:float"',
- double=>'"xsd:double"',
- }
-);
-
-%baseTypes = (
- intlist=>'int',
- floatlist=>'float',
- doublelist=>'double',
- strlist=>'string',
- stslist=>'jobstat',
- taglist=>'usertag'
-);
-
-%toString = (
- C=>{
- int=>'qq{asprintf(&$dst,"%d",$src);}',
- float=>'qq{asprintf(&$dst,"%f",$src);}',
- double=>'qq{asprintf(&$dst,"%f",$src);}',
- port=>'qq{asprintf(&$dst,"%d",(int) $src);}',
- bool=>'qq{asprintf(&$dst,"%d",$src);}',
- string=>'qq{$dst = $src?strdup($src):NULL;}',
- timeval=>'qq{edg_wll_ULMTimevalToDate(($src).tv_sec,($src).tv_usec,$dst);}',
- jobid=>'qq{$dst = edg_wlc_JobIdUnparse($src);}',
- notifid=>'qq{$dst = edg_wll_NotifIdUnparse($src);}',
-# level=>'qq{$dst = edg_wll_LevelToString($src);}',
- logsrc=>'qq{$dst = edg_wll_SourceToString($src);}',
-# strlist, intlist, stslist are used only in consumer API, they don't need toString method
- }
-);
-
-%ULMasString = (
- logsrc=>1
-);
-
-%fromString = (
- C=>{
- int=>'qq{$dst = atoi($src);}',
- float=>'qq{$dst = strtof($src,NULL);}',
- double=>'qq{$dst = strtod($src,NULL);}',
- port=>'qq{$dst = (uint16_t) atoi($src);}',
- bool=>'qq{$dst = atoi($src);}',
- string=>'qq{$dst = strdup($src);}',
- timeval=>'qq{edg_wll_ULMDateToTimeval($src,&$dst);}',
- jobid=>'qq{edg_wlc_JobIdParse($src,&$dst);}',
- notifid=>'qq{edg_wll_NotifIdParse($src,&$dst);}',
-# level=>'qq{$dst = edg_wll_StringToLevel($src);}',
- logsrc=>'qq{$dst = edg_wll_StringToSource($src);}',
-# strlist, intlist, stslist are used only in consumer API, they don't need fromString method
- }
-);
-
-%DefaultNullValue = (
- int=>0,
- float=>0.0,
- double=>0.0,
- port=>0,
-# level=>'EDG_WLL_LEVEL_UNDEFINED',
- bool=>0,
- string=>'NULL',
- jobid=>'NULL',
- notifid=>'NULL',
- logsrc=>'EDG_WLL_SOURCE_NONE',
- timeval=>'null_timeval',
- strlist=>'NULL',
- intlist=>'NULL',
- taglist=>'NULL',
- stslist=>'NULL',
-);
-
-%compare = (
- C=>{
- int=>'"($a == $b)"',
- float=>'"($a == $b)"',
- double=>'"($a == $b)"',
- port=>'"($a == $b)"',
-# level=>'"($a == $b)"',
- bool=>'"(($a || !$b) && ($b || !$a))"',
-# string=>'"(($a) == NULL && ($b) == NULL) || (($a)&&($b)&& !strcmp($a,$b))"',
- string=>'if ($b eq \'NULL\') { qq{(($a) == NULL)}; }
- else { qq{(($a) == NULL && ($b) == NULL) || (($a)&&($b)&& !strcmp($a,$b))}; } ',
-# jobid=>'"(($a) == NULL && ($b) == NULL) || (($a)&&($b)&& !strcmp(edg_wlc_JobIdUnparse($a),edg_wlc_JobIdUnparse($b)))"',
- jobid=>'if ($b eq \'NULL\') { qq{(($a) == NULL) }; }
- else { qq{(($a) == NULL && ($b) == NULL) || (($a)&&($b)&& !strcmp(edg_wlc_JobIdUnparse($a),edg_wlc_JobIdUnparse($b)))}; }',
- notifid=>'"($a) == ($b)"',
- logsrc=>'"($a) == ($b)"',
- timeval=>'"($a).tv_sec == ($b).tv_sec && ($a).tv_usec == ($b).tv_usec"',
- }
-);
-
-%toFormatString = (
- C=>{
- int=>'"%d"',
- float=>'"%f"',
- double=>'"%f"',
- port=>'"%d"',
- bool=>'"%d"',
-# level=>'"%s"',
- string=>'"%|Us"',
- jobid=>'"%s"',
- notifid=>'"%s"',
- logsrc=>'"%s"',
- timeval=>'"%s"',
- }
-);
+++ /dev/null
-# $Header$
-module.version=1.5.2
-module.age=2