mirror of https://github.com/BOINC/boinc.git
trac history of condor events in wu structure
git-svn-id: svn+ssh://cvs.lpds.sztaki.hu/var/lib/svn/szdg/dcapi/trunk@648 a7169a2c-3604-0410-bc95-c702d8d87f7a
This commit is contained in:
parent
e9788c0bcf
commit
51790cfb61
|
@ -9,6 +9,8 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <uuid/uuid.h>
|
||||
|
||||
#include "dc.h"
|
||||
|
@ -16,6 +18,15 @@ extern "C" {
|
|||
|
||||
extern char project_uuid_str[37];
|
||||
|
||||
struct _DC_condor_event
|
||||
{
|
||||
int event;
|
||||
int cluster;
|
||||
int proc;
|
||||
int subproc;
|
||||
struct tm time;
|
||||
};
|
||||
|
||||
struct _DC_Workunit
|
||||
{
|
||||
char *client_name;
|
||||
|
@ -29,7 +40,8 @@ struct _DC_Workunit
|
|||
char *uuid_str;
|
||||
DC_WUState state;
|
||||
|
||||
char *condor_id;
|
||||
/*char *condor_id;*/
|
||||
GArray *condor_events;
|
||||
char *workdir;
|
||||
|
||||
GList *input_files;
|
||||
|
|
|
@ -1,5 +1,81 @@
|
|||
/* Local variables: */
|
||||
/* c-file-style: "linux" */
|
||||
/* End: */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <glib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "user_log.c++.h"
|
||||
|
||||
#include "dc.h"
|
||||
#include "dc_common.h"
|
||||
|
||||
#include "condor_defs.h"
|
||||
#include "condor_log.h"
|
||||
|
||||
|
||||
char *
|
||||
_DC_wu_update_condor_events(DC_Workunit *wu)
|
||||
{
|
||||
ReadUserLog log;
|
||||
GString *fn_org, *fn_tmp;
|
||||
char t[100];
|
||||
int res;
|
||||
unsigned int i;
|
||||
|
||||
if (!wu)
|
||||
return(0);
|
||||
|
||||
fn_org= g_string_new(wu->workdir);
|
||||
fn_org= g_string_append(fn_org, "/internal_log.txt");
|
||||
strcpy(t, "/tmp/condor_dc_api_XXXXXX");
|
||||
res= mkstemp(t);
|
||||
fn_tmp= g_string_new(t);
|
||||
close(res);
|
||||
_DC_copyFile(fn_org->str, fn_tmp->str);
|
||||
res= log.initialize(fn_tmp->str);
|
||||
if (!res)
|
||||
{
|
||||
DC_log(LOG_ERR, "Condor user log file reader "
|
||||
"initialization failed for %s", fn_tmp->str);
|
||||
g_string_free(fn_org, TRUE);
|
||||
g_string_free(fn_tmp, TRUE);
|
||||
return(0);
|
||||
}
|
||||
|
||||
i= 1;
|
||||
ULogEvent *event;
|
||||
while (log.readEvent(event) == ULOG_OK)
|
||||
{
|
||||
printf("%d %s\n", event->eventNumber,
|
||||
ULogEventNumberNames[event->eventNumber]);
|
||||
if (wu->condor_events->len < i)
|
||||
{
|
||||
struct _DC_condor_event e;
|
||||
e.event= event->eventNumber;
|
||||
e.cluster= event->cluster;
|
||||
e.proc= event->proc;
|
||||
e.subproc= event->subproc;
|
||||
e.time= event->eventTime;
|
||||
g_array_append_val(wu->condor_events, e);
|
||||
DC_log(LOG_DEBUG, "Condor event %d %s",
|
||||
event->eventNumber,
|
||||
ULogEventNumberNames[event->eventNumber]);
|
||||
}
|
||||
delete event;
|
||||
i++;
|
||||
}
|
||||
|
||||
unlink(fn_tmp->str);
|
||||
g_string_free(fn_org, TRUE);
|
||||
g_string_free(fn_tmp, TRUE);
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
/* End of condor_log.cc */
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
/* Local variables: */
|
||||
/* c-file-style: "linux" */
|
||||
/* End: */
|
||||
|
||||
#ifndef _DC_API_CONDOR_LOG_H_
|
||||
#define _DC_API_CONDOR_LOG_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "dc.h"
|
||||
|
||||
|
||||
extern char *_DC_wu_update_condor_events(DC_Workunit *wu);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/* End of condor/condor_log.h */
|
Loading…
Reference in New Issue