[interchange-cvs] interchange - racke modified lib/Vend/Dispatch.pm
interchange-cvs at icdevgroup.org
interchange-cvs at icdevgroup.org
Thu Jul 27 06:34:26 EDT 2006
User: racke
Date: 2006-07-27 10:34:26 GMT
Modified: lib/Vend Dispatch.pm
Log:
enclose job(s) execution in an eval to catch any fatal errors
Revision Changes Path
1.72 +31 -21 interchange/lib/Vend/Dispatch.pm
rev 1.72, prev_rev 1.71
Index: Dispatch.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Dispatch.pm,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -r1.71 -r1.72
--- Dispatch.pm 26 Jul 2006 15:24:49 -0000 1.71
+++ Dispatch.pm 27 Jul 2006 10:34:26 -0000 1.72
@@ -1,6 +1,6 @@
# Vend::Dispatch - Handle Interchange page requests
#
-# $Id: Dispatch.pm,v 1.71 2006/07/26 15:24:49 jon Exp $
+# $Id: Dispatch.pm,v 1.72 2006/07/27 10:34:26 racke Exp $
#
# Copyright (C) 2002-2006 Interchange Development Group
# Copyright (C) 2002 Mike Heins <mike at perusion.net>
@@ -26,7 +26,7 @@
package Vend::Dispatch;
use vars qw($VERSION);
-$VERSION = substr(q$Revision: 1.71 $, 10);
+$VERSION = substr(q$Revision: 1.72 $, 10);
use POSIX qw(strftime);
use Vend::Util;
@@ -764,7 +764,7 @@
push @itl, ["Passed ITL", $itl];
}
- my @out;
+ my (@out, $errors);
# remove bogus session created by logError
undef $Vend::Session;
@@ -782,30 +782,40 @@
::logError ("Invalid jobs tracking database $jobscfg->{trackdb}");
}
}
-
- # Run once at beginning
- run_macro($jobscfg->{initialize});
- # initialize or autoload can create session
- # but must handle all aspects
- unless ($Vend::Session) {
- $CGI::values{mv_tmp_session} = 1;
- init_session();
- }
+ eval {
+ # Run once at beginning
+ run_macro($jobscfg->{initialize});
+
+ # initialize or autoload can create session
+ # but must handle all aspects
+ unless ($Vend::Session) {
+ $CGI::values{mv_tmp_session} = 1;
+ init_session();
+ }
- $CGI::remote_addr ||= 'none';
- $CGI::useragent ||= 'commandline';
+ $CGI::remote_addr ||= 'none';
+ $CGI::useragent ||= 'commandline';
- for(@itl) {
- # Run once at beginning of each job
- run_macro($jobscfg->{autoload});
+ for(@itl) {
+ # Run once at beginning of each job
+ run_macro($jobscfg->{autoload});
- push @out, interpolate_html($_->[1]);
+ push @out, interpolate_html($_->[1]);
- # Run once at end of each job
- run_macro($jobscfg->{autoend});
- }
+ # Run once at end of each job
+ run_macro($jobscfg->{autoend});
+ }
+ };
+ if ($@) {
+ # job terminated due to an error
+ $errors = 1;
+ # remove flag for this job
+ Vend::Server::flag_job($$, $cat, 'furl');
+ logError ("Job group=%s pid=$$ terminated with an error: %s", $job || 'INTERNAL', $@);
+ }
+
if ($trackid) {
$trackdb->set_field($trackid, 'end_run',
Vend::Interpolate::mvtime(undef, {}, '%Y-%m-%d %H:%M'));
More information about the interchange-cvs
mailing list