From 9ed796742629a3a6f91c2ce094e0e440747ebb54 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Milo=C5=A1=20Mula=C4=8D?= Date: Thu, 31 Jul 2008 13:51:37 +0000 Subject: [PATCH] framework for Job Wrapper status counting - no real implemantation yet --- org.glite.lb.client/examples/job_status.c | 2 ++ org.glite.lb.client/src/StatusAttrNames.pl | 1 + org.glite.lb.common/interface/jobstat.h.T | 10 +++++++ org.glite.lb.common/src/status.c.T | 34 ++++++++++++++++++++++- org.glite.lb.server/src/jobstat_supp.c | 2 ++ org.glite.lb.state-machine/interface/intjobstat.h | 2 +- org.glite.lb.types/status.T | 5 ++++ 7 files changed, 54 insertions(+), 2 deletions(-) diff --git a/org.glite.lb.client/examples/job_status.c b/org.glite.lb.client/examples/job_status.c index e930bc1..4f0601e 100644 --- a/org.glite.lb.client/examples/job_status.c +++ b/org.glite.lb.client/examples/job_status.c @@ -11,6 +11,7 @@ #include "glite/lb/context-int.h" #include "glite/lb/consumer.h" #include "glite/lb/xml_conversions.h" +#include "glite/lb/jobstat.h" static void dgerr(edg_wll_Context,char *); static void printstat(edg_wll_JobStat,int); @@ -295,6 +296,7 @@ static void printstat(edg_wll_JobStat stat, int level) printf("%s\t%s \n", ind, stat.user_fqans[i]); } printf("%ssandbox_retrieved : %d\n", ind, stat.sandbox_retrieved); + printf("%sjw_status : %s\n", ind, edg_wll_JWStatToString(stat.jw_status)); /* PBS state section */ if (stat.jobtype == EDG_WLL_STAT_PBS) { diff --git a/org.glite.lb.client/src/StatusAttrNames.pl b/org.glite.lb.client/src/StatusAttrNames.pl index 7798b97..1c7f01b 100644 --- a/org.glite.lb.client/src/StatusAttrNames.pl +++ b/org.glite.lb.client/src/StatusAttrNames.pl @@ -71,4 +71,5 @@ UI_HOST USER_FQANS SANDBOX_RETRIEVED + JW_STATUS /; diff --git a/org.glite.lb.common/interface/jobstat.h.T b/org.glite.lb.common/interface/jobstat.h.T index 704a4e0..2875a91 100644 --- a/org.glite.lb.common/interface/jobstat.h.T +++ b/org.glite.lb.common/interface/jobstat.h.T @@ -184,6 +184,16 @@ extern edg_wll_JobStatCode edg_wll_StringToStat(const char *); */ extern char *edg_wll_StatToString(edg_wll_JobStatCode); +/** + * Convert string Job Wrapper status to numeric code. + */ +extern enum edg_wll_StatJw_status edg_wll_StringToJWStat(const char *); + +/** + * Convert numeric Job Wrapper status code to string representation + */ +extern char *edg_wll_JWStatToString(enum edg_wll_StatJw_status); + /*@}*/ /* diff --git a/org.glite.lb.common/src/status.c.T b/org.glite.lb.common/src/status.c.T index 52b89e3..4f94b1a 100644 --- a/org.glite.lb.common/src/status.c.T +++ b/org.glite.lb.common/src/status.c.T @@ -3,7 +3,7 @@ #include #include -#include "glite/lb/jobstat.h" +#include "jobstat.h" static const struct timeval null_timeval = {0,0}; @@ -170,3 +170,35 @@ char *edg_wll_StatToString(edg_wll_JobStatCode statCode) if ((int)statCode < 0 || statCode >= sizeof(statNames)/sizeof(statNames[0])) return (char *) NULL; return strdup(statNames[statCode]); } + +static const char * const jw_statNames[] = { +@@@{ + my $f = selectField $status jw_status; + if ($f->{codes}) { + for (@{$f->{codes}}) { + my $lc = lc $_->{name}; + my $uc = ucfirst $lc; + gen qq{ +! "$uc", +}; + } + } +@@@} +}; + +enum edg_wll_StatJw_status edg_wll_StringToJWStat(const char *name) +{ + unsigned int i; + + for (i=0; i= sizeof(jw_statNames)/sizeof(jw_statNames[0])) return (char *) NULL; + return strdup(jw_statNames[statCode]); +} + + diff --git a/org.glite.lb.server/src/jobstat_supp.c b/org.glite.lb.server/src/jobstat_supp.c index b7620a4..ae5842c 100644 --- a/org.glite.lb.server/src/jobstat_supp.c +++ b/org.glite.lb.server/src/jobstat_supp.c @@ -510,6 +510,7 @@ static char *enc_JobStat(char *old, edg_wll_JobStat* stat) if (ret) ret = enc_string(ret, stat->ui_host); if (ret) ret = enc_strlist(ret, stat->user_fqans); if (ret) ret = enc_int(ret, stat->sandbox_retrieved); + if (ret) ret = enc_int(ret, stat->jw_status); if (ret) ret = enc_string(ret, stat->pbs_state); if (ret) ret = enc_string(ret, stat->pbs_queue); if (ret) ret = enc_string(ret, stat->pbs_owner); @@ -594,6 +595,7 @@ static edg_wll_JobStat* dec_JobStat(char *in, char **rest) if (tmp_in != NULL) stat->ui_host = dec_string(tmp_in, &tmp_in); if (tmp_in != NULL) stat->user_fqans = dec_strlist(tmp_in, &tmp_in); if (tmp_in != NULL) stat->sandbox_retrieved = dec_int(tmp_in, &tmp_in); + if (tmp_in != NULL) stat->jw_status = dec_int(tmp_in, &tmp_in); if (tmp_in != NULL) stat->pbs_state = dec_string(tmp_in, &tmp_in); if (tmp_in != NULL) stat->pbs_queue = dec_string(tmp_in, &tmp_in); if (tmp_in != NULL) stat->pbs_owner = dec_string(tmp_in, &tmp_in); diff --git a/org.glite.lb.state-machine/interface/intjobstat.h b/org.glite.lb.state-machine/interface/intjobstat.h index d69d5a3..eb43b49 100644 --- a/org.glite.lb.state-machine/interface/intjobstat.h +++ b/org.glite.lb.state-machine/interface/intjobstat.h @@ -14,7 +14,7 @@ /* where Z.XX is version from indent + 1 (version after commit), Y = Z+1 */ /* and DESCRIPTION is short hit why version changed */ -#define INTSTAT_VERSION "revision 2.4 - proxy merge" +#define INTSTAT_VERSION "revision 2.5 - proxy merge" // Internal error codes diff --git a/org.glite.lb.types/status.T b/org.glite.lb.types/status.T index dc46a15..ecd12dc 100644 --- a/org.glite.lb.types/status.T +++ b/org.glite.lb.types/status.T @@ -91,6 +91,11 @@ int sandbox_retrieved Flag is set on incomming Clear event _code_ USER User retrieved output sandbox. _code_ TIMEOUT Timed out, resource forced purge of the sandbox. _code_ NOOUTPUT No output was generated. +int jw_status Status of Job wrapper + _code_ UNKNOWN Status of JW unknown + _code_ WRAPPER_RUNNING Wrapper started + _code_ PAYLOAD_RUNNING Payload running + _code_ DONE JW finished _pad_ 55 -- 1.8.2.3