From 6d25f8d3ff9c07dadc9d282452f8a71bf07c5368 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zden=C4=9Bk=20=C5=A0ustr?= Date: Fri, 5 Aug 2011 14:17:35 +0000 Subject: [PATCH] Support for defining terminal job states through status.T --- org.glite.lb.common/interface/jobstat.h.T | 2 ++ org.glite.lb.common/src/status.c.T | 10 ++++++++++ org.glite.lb.types/MultiStruct.pm | 16 ++++++++++++++++ org.glite.lb.types/status.T | 4 ++++ 4 files changed, 32 insertions(+) diff --git a/org.glite.lb.common/interface/jobstat.h.T b/org.glite.lb.common/interface/jobstat.h.T index 760b6a0..a147269 100644 --- a/org.glite.lb.common/interface/jobstat.h.T +++ b/org.glite.lb.common/interface/jobstat.h.T @@ -95,6 +95,8 @@ typedef enum _edg_wll_JobStatCode { EDG_WLL_NUMBER_OF_STATCODES /**< Number of meaningful status codes */ } edg_wll_JobStatCode; +extern const int EDG_WLL_JOB_TERMINAL_STATE[EDG_WLL_NUMBER_OF_STATCODES]; + /*! * * Pair tag = value. diff --git a/org.glite.lb.common/src/status.c.T b/org.glite.lb.common/src/status.c.T index 413bd5b..32635d8 100644 --- a/org.glite.lb.common/src/status.c.T +++ b/org.glite.lb.common/src/status.c.T @@ -26,6 +26,16 @@ limitations under the License. static const struct timeval null_timeval = {0,0}; +@@@{ + my $sep = "const int EDG_WLL_JOB_TERMINAL_STATE[EDG_WLL_NUMBER_OF_STATCODES] = {0, "; + for my $term ($status->getTerminalStatusOrdered) { + gen qq{$sep $term}; + $sep = ", "; + } + $sep = ", 0};"; + gen qq{$sep}; +@@@} + void edg_wll_FreeStatus(edg_wll_JobStat *stat) { diff --git a/org.glite.lb.types/MultiStruct.pm b/org.glite.lb.types/MultiStruct.pm index 3ab6d4b..629660c 100644 --- a/org.glite.lb.types/MultiStruct.pm +++ b/org.glite.lb.types/MultiStruct.pm @@ -9,6 +9,7 @@ sub new { $self->{fields} = {}; # typ->{ name->StructField, ... } $self->{order} = {}; $self->{flesh} = {}; + $self->{terminal} = ""; bless $self; } @@ -81,6 +82,11 @@ sub load { next; } + if (/^\@terminal\s+(\S+)$/) { + $self->{terminal} = $self->{terminal} . " " . $1; + next; + } + s/^\s*//; my ($ftype,$fname,$comment) = split /\s+/,$_,3; if ($ftype eq '_code_') { @@ -145,6 +151,16 @@ sub getTypesOrdered { } @names; } +sub getTerminalStatusOrdered { + my $self = shift; + for my $stat ($self->getTypesOrdered) { + if ($self->{terminal} =~ m/\b$stat\b/) { + push(@out, 1); } + else { push(@out, 0); } + } + @out; +} + sub getTypeComment { my $self = shift; my $type = shift || $self->{type}; diff --git a/org.glite.lb.types/status.T b/org.glite.lb.types/status.T index d64f2ad..c216ee2 100644 --- a/org.glite.lb.types/status.T +++ b/org.glite.lb.types/status.T @@ -191,3 +191,7 @@ _pad_ 20 @type Unknown Status cannot be determined. @type Purged Job has been purged from bookkeeping server (for LB-RGMA interface). +@terminal Done +@terminal Running +@terminal Cleared +@terminal Purged -- 1.8.2.3