Rename "events summary" to "job history".
authorFrantišek Dvořák <valtri@civ.zcu.cz>
Tue, 13 Sep 2011 14:47:39 +0000 (14:47 +0000)
committerFrantišek Dvořák <valtri@civ.zcu.cz>
Tue, 13 Sep 2011 14:47:39 +0000 (14:47 +0000)
org.glite.lb.client/doc/glite-lb-notify.1
org.glite.lb.client/src/StatusAttrNames.pl
org.glite.lb.client/src/notify.c
org.glite.lb.common/interface/jobstat.h.T
org.glite.lb.common/src/xml_conversions.c
org.glite.lb.logger-msg/src/activemq_cpp_plugin.cpp
org.glite.lb.server/src/notif_match.c
org.glite.lb.types/status.T

index deeb602..74a478c 100644 (file)
@@ -154,8 +154,8 @@ bootstrap -- send past events matching conditions.
 .B -T
 match only on reaching a terminal state.
 .TP
-.B -E
-match only on reaching a terminal state and pack a summary of all events for that job.
+.B -H
+match only on reaching a terminal state and pack all events for that job.
 
 .SH EXAMPLE
 Installed with the package as share/examples/glite-lb-notify.pl.
index 2b72a7f..db266d0 100644 (file)
        CREAM_ID
        PAYLOAD_OWNER
        ACCESS_RIGHTS
-       SUMMARY
+       HISTORY
 /;
index 5641f30..cf35d5b 100644 (file)
@@ -211,7 +211,7 @@ int main(int argc,char **argv)
                        case 'T':
                                flags |= EDG_WLL_NOTIF_TERMINAL_STATES; break;
                        case 'H':
-                               flags |= EDG_WLL_NOTIF_TERMINAL_STATES | EDG_WLL_NOTIF_EVENT_SUMMARY; break;
+                               flags |= EDG_WLL_NOTIF_TERMINAL_STATES | EDG_WLL_NOTIF_HISTORY; break;
                        case 'c':
                                conditions[i] = (edg_wll_QueryRec *)calloc(2,sizeof(edg_wll_QueryRec));
                                conditions[i][0].attr = EDG_WLL_QUERY_ATTR_STATUS;
index a147269..278cd86 100644 (file)
@@ -173,7 +173,7 @@ typedef struct _edg_wll_JobStat {
 #define EDG_WLL_STAT_CHILDHIST_FAST 8          /**< partially complete histogram of child job states */
 #define EDG_WLL_STAT_CHILDHIST_THOROUGH 16     /**< full and up-to date histogram of child job states */
 #define EDG_WLL_NOTIF_TERMINAL_STATES 64       /**< Generate notifications on terminal states */
-#define EDG_WLL_NOTIF_EVENT_SUMMARY 128        /**< Attach all job's events to the notification */
+#define EDG_WLL_NOTIF_HISTORY 128      /**< Attach all job's events to the notification */
 #define EDG_WLL_NOTIF_BOOTSTRAP 256    /**< send the state of the all already existing jobs too */
 #define EDG_WLL_NOTIF_VOLATILE 512     /**< (not used yet) send the notifications directly, without reliability and persistency */
 /* starting from bit 10 private flags begins - do not add 1024 and more! */
index adb88d4..f3df3a3 100644 (file)
@@ -774,7 +774,7 @@ char *edg_wll_stat_flags_to_string(int flags)
         if (flags & EDG_WLL_STAT_CHILDHIST_FAST) append_flag(&cflags, "childhist_fast");
         if (flags & EDG_WLL_STAT_CHILDHIST_THOROUGH) append_flag(&cflags, "childhist_thorough");
         if (flags & EDG_WLL_NOTIF_TERMINAL_STATES)     append_flag(&cflags, "terminal_states");
-        if (flags & EDG_WLL_NOTIF_EVENT_SUMMARY)     append_flag(&cflags, "event_summary");
+        if (flags & EDG_WLL_NOTIF_HISTORY)       append_flag(&cflags, "history");
         if (flags & EDG_WLL_NOTIF_BOOTSTRAP)     append_flag(&cflags, "bootstrap");
         if (flags & EDG_WLL_NOTIF_VOLATILE)      append_flag(&cflags, "volatile");
         if (!cflags) cflags = strdup("");
@@ -800,7 +800,7 @@ int edg_wll_string_to_stat_flags(char *cflags)
                 if (!strcmp(sflag,"childhist_fast")) flags = flags | EDG_WLL_STAT_CHILDHIST_FAST;
                 if (!strcmp(sflag,"childhist_thorough")) flags = flags | EDG_WLL_STAT_CHILDHIST_THOROUGH;
                if (!strcmp(sflag,"terminal_states")) flags = flags | EDG_WLL_NOTIF_TERMINAL_STATES;
-               if (!strcmp(sflag,"event_summary")) flags = flags | EDG_WLL_NOTIF_EVENT_SUMMARY;
+               if (!strcmp(sflag,"history")) flags = flags | EDG_WLL_NOTIF_HISTORY;
                if (!strcmp(sflag,"bootstrap")) flags = flags | EDG_WLL_NOTIF_BOOTSTRAP;
                if (!strcmp(sflag,"volatile")) flags = flags | EDG_WLL_NOTIF_VOLATILE;
                sflag = strtok_r(NULL, "+", &last);
index 7247eac..bde46e2 100644 (file)
@@ -185,8 +185,8 @@ OutputPlugin::createMessage(edg_wll_JobStat &state_out)
                body << "statusReason: \"" << state_out.reason << "\", ";
        }
        /* summaries */
-       if(state_out.summary) {
-               body << "summary: " << state_out.summary << ", ";
+       if(state_out.history) {
+               body << "history: " << state_out.history << ", ";
        }
        body << "}";
 
index 78efe98..da19988 100644 (file)
@@ -40,7 +40,7 @@ limitations under the License.
 #include "get_events.h"
 
 static int notif_match_conditions(edg_wll_Context,const edg_wll_JobStat *,const edg_wll_JobStat *,const char *, int flags);
-static int fetch_summary(edg_wll_Context ctx, edg_wll_JobStat *stat);
+static int fetch_history(edg_wll_Context ctx, edg_wll_JobStat *stat);
 
 int edg_wll_NotifExpired(edg_wll_Context,const char *);
 
@@ -55,8 +55,8 @@ int edg_wll_NotifMatch(edg_wll_Context ctx, const edg_wll_JobStat *oldstat, cons
        
        char *cond_where = NULL;
        char *cond_and_where = NULL;
-       char *summary = NULL;
-       int  summary_fetched = 0;
+       char *history = NULL;
+       int  history_fetched = 0;
        edg_wll_JobStat newstat = *stat; // shallow copy
 
        edg_wll_ResetError(ctx);
@@ -127,16 +127,16 @@ int edg_wll_NotifMatch(edg_wll_Context ctx, const edg_wll_JobStat *oldstat, cons
                        char    *errt, *errd;
                        char    *dest;
 
-                       if (flags & EDG_WLL_NOTIF_EVENT_SUMMARY && !summary_fetched) {
-                               glite_common_log(LOG_CATEGORY_LB_SERVER, LOG_PRIORITY_DEBUG, "NOTIFY: summary for job %s", jobc[0]);
-                               if (fetch_summary(ctx, &newstat) != 0) {
+                       if (flags & EDG_WLL_NOTIF_HISTORY && !history_fetched) {
+                               glite_common_log(LOG_CATEGORY_LB_SERVER, LOG_PRIORITY_DEBUG, "NOTIFY: event history for job %s", jobc[0]);
+                               if (fetch_history(ctx, &newstat) != 0) {
                                        edg_wll_Error(ctx, &errt, &errd);
-                                       glite_common_log(LOG_CATEGORY_LB_SERVER, LOG_PRIORITY_ERROR, "NOTIFY: query summary events for %s failed, %s: %s", jobc[0], errt, errd);
+                                       glite_common_log(LOG_CATEGORY_LB_SERVER, LOG_PRIORITY_ERROR, "NOTIFY: query events for %s failed, %s: %s", jobc[0], errt, errd);
                                        free(errt);
                                        free(errd);
                                        edg_wll_ResetError(ctx);
                                }
-                               summary_fetched = 1;
+                               history_fetched = 1;
                        }
 
                        glite_common_log(LOG_CATEGORY_LB_SERVER, LOG_PRIORITY_DEBUG, "NOTIFY: %s, job %s", jobc[0], ju = edg_wlc_JobIdGetUnique(newstat.jobId));
@@ -164,7 +164,7 @@ int edg_wll_NotifMatch(edg_wll_Context ctx, const edg_wll_JobStat *oldstat, cons
        if (ret < 0) goto err;
        
 err:
-       free(summary);
+       free(history);
        free(ctx->p_instance); ctx->p_instance = NULL;
        if ( nid ) edg_wll_NotifIdFree(nid);
        free(jobq);
@@ -279,17 +279,17 @@ int edg_wll_NotifCheckACL(edg_wll_Context ctx,const edg_wll_JobStat *stat,const
 }
 
 
-#define SUMMARY_EMPTY "[]"
-#define SUMMARY_HEADER "[\n"
-#define SUMMARY_HEADER_SIZE 2
-#define SUMMARY_FOOTER "\n]"
-#define SUMMARY_FOOTER_SIZE 2
-#define SUMMARY_SEPARATOR ",\n"
-#define SUMMARY_SEPARATOR_SIZE 2
+#define HISTORY_EMPTY "[]"
+#define HISTORY_HEADER "[\n"
+#define HISTORY_HEADER_SIZE 2
+#define HISTORY_FOOTER "\n]"
+#define HISTORY_FOOTER_SIZE 2
+#define HISTORY_SEPARATOR ",\n"
+#define HISTORY_SEPARATOR_SIZE 2
 
-static int fetch_summary(edg_wll_Context ctx, edg_wll_JobStat *stat) {
+static int fetch_history(edg_wll_Context ctx, edg_wll_JobStat *stat) {
        edg_wll_QueryRec         jc0[2], *jc[2];
-       char                    *event_str = NULL, *summary = NULL;
+       char                    *event_str = NULL, *history = NULL;
        edg_wll_Event *events = NULL;
        size_t  size, len, maxsize = 1024, newsize;
        size_t i;
@@ -304,45 +304,45 @@ static int fetch_summary(edg_wll_Context ctx, edg_wll_JobStat *stat) {
 
        if (edg_wll_QueryEventsServer(ctx, 1, (const edg_wll_QueryRec **)jc, NULL, &events) == 0) {
                if (!events || !events[0].type) {
-                       summary = strdup(SUMMARY_EMPTY);
+                       history = strdup(HISTORY_EMPTY);
                } else {
-                       summary = malloc(maxsize);
-                       strcpy(summary, SUMMARY_HEADER);
-                       size = SUMMARY_HEADER_SIZE;
+                       history = malloc(maxsize);
+                       strcpy(history, HISTORY_HEADER);
+                       size = HISTORY_HEADER_SIZE;
 
                        for (i = 0; events && events[i].type; i++) {
                                if (edg_wll_UnparseEventJSON(ctx, events + i, &event_str) != 0) goto err;
                                len = strlen(event_str);
-                               newsize = size + len + SUMMARY_SEPARATOR_SIZE + SUMMARY_FOOTER_SIZE + 1;
+                               newsize = size + len + HISTORY_SEPARATOR_SIZE + HISTORY_FOOTER_SIZE + 1;
                                if (newsize > maxsize) {
                                        maxsize <<= 1;
                                        if (newsize > maxsize) maxsize = newsize;
-                                       if ((tmpptr = realloc(summary, maxsize)) == NULL) {
+                                       if ((tmpptr = realloc(history, maxsize)) == NULL) {
                                                edg_wll_SetError(ctx, ENOMEM, NULL);
                                                goto err;
                                        }
-                                       summary = tmpptr;
+                                       history = tmpptr;
                                }
-                               strncpy(summary + size, event_str, len + 1);
+                               strncpy(history + size, event_str, len + 1);
                                size += len;
                                if (events[i+1].type) {
-                                       strcpy(summary + size, SUMMARY_SEPARATOR);
-                                       size += SUMMARY_SEPARATOR_SIZE;
+                                       strcpy(history + size, HISTORY_SEPARATOR);
+                                       size += HISTORY_SEPARATOR_SIZE;
                                }
                                free(event_str);
                                event_str = NULL;
                        }
-                       strcpy(summary + size, SUMMARY_FOOTER);
-                       size += SUMMARY_FOOTER_SIZE;
+                       strcpy(history + size, HISTORY_FOOTER);
+                       size += HISTORY_FOOTER_SIZE;
                }
-               glite_common_log(LOG_CATEGORY_LB_SERVER, LOG_PRIORITY_DEBUG, "NOTIFY: %zd events in summary", i);
+               glite_common_log(LOG_CATEGORY_LB_SERVER, LOG_PRIORITY_DEBUG, "NOTIFY: fetched %zd events", i);
 
-               stat->summary = summary;
-               summary = NULL;
+               stat->history = history;
+               history = NULL;
        }
 
 err:
-       free(summary);
+       free(history);
        for (i = 0; events && events[i].type; i++)
                edg_wll_FreeEvent(&events[i]);
        free(events);
index 8627d90..640b1bb 100644 (file)
@@ -105,7 +105,7 @@ jobid       isb_transfer            Input sandbox corresponding to the job
 jobid  osb_transfer            Output sandbox corresponding to the job
 string payload_owner           Owner of the actual job payload (e.g., for pilot jobs)
 string access_rights                   List of access rights (human readable variant of acl)
-string summary                 Events summary.
+string history                 Job history.
 
 _pad_  55