mirror of https://github.com/BOINC/boinc.git
move file structure handling into separate source
move condor specific functions into separate source git-svn-id: svn+ssh://cvs.lpds.sztaki.hu/var/lib/svn/szdg/dcapi/trunk@592 a7169a2c-3604-0410-bc95-c702d8d87f7a
This commit is contained in:
parent
e8a7404f72
commit
eaeb57a7ae
|
@ -11,14 +11,20 @@ endif
|
||||||
pkgconfigdir = ${libdir}/pkgconfig
|
pkgconfigdir = ${libdir}/pkgconfig
|
||||||
pkgconfig_DATA = dcapi-condor-client.pc dcapi-condor-master.pc
|
pkgconfig_DATA = dcapi-condor-client.pc dcapi-condor-master.pc
|
||||||
|
|
||||||
AM_CPPFLAGS = -I$(top_srcdir)/common $(GLIB_CFLAGS)
|
AM_CPPFLAGS = -I$(top_srcdir)/common $(GLIB_CFLAGS)
|
||||||
AM_LDFLAGS = $(BOINC_LDFLAGS) $(GLIB_LIBS)
|
AM_LDFLAGS = $(BOINC_LDFLAGS) $(GLIB_LIBS)
|
||||||
|
AM_CFLAGS = -O0 -g
|
||||||
|
AM_CXXFLAGS = -O0 -g
|
||||||
|
|
||||||
noinst_HEADERS = condor_common.h condor_defs.h condor_master.h condor_wu.h
|
noinst_HEADERS = condor_common.h condor_defs.h condor_master.h condor_wu.h
|
||||||
|
|
||||||
libdc_condor_la_SOURCES = condor_master.cc \
|
libdc_condor_la_SOURCES = condor_master.cc \
|
||||||
condor_common.c \
|
condor_common.c \
|
||||||
condor_wu.c
|
condor_file.c \
|
||||||
|
condor_wu.c \
|
||||||
|
condor_managewu.c
|
||||||
|
condor_file.c
|
||||||
|
|
||||||
libdc_condor_la_LIBADD = ../common/libdc-common-master.la \
|
libdc_condor_la_LIBADD = ../common/libdc-common-master.la \
|
||||||
$(GLIB_LIBS)
|
$(GLIB_LIBS)
|
||||||
|
|
||||||
|
@ -37,3 +43,4 @@ tm_SOURCES = tm.c
|
||||||
tm_LDADD = ../common/libdc-common-master.la \
|
tm_LDADD = ../common/libdc-common-master.la \
|
||||||
libdc-condor.la \
|
libdc-condor.la \
|
||||||
-luuid -lstdc++
|
-luuid -lstdc++
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
/* Local variables: */
|
||||||
|
/* c-file-style: "linux" */
|
||||||
|
/* End: */
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
|
||||||
|
#include "dc.h"
|
||||||
|
|
||||||
|
#include "condor_file.h"
|
||||||
|
|
||||||
|
|
||||||
|
DC_PhysicalFile *
|
||||||
|
_DC_createPhysicalFile(const char *label, const char *path)
|
||||||
|
{
|
||||||
|
DC_PhysicalFile *file;
|
||||||
|
|
||||||
|
file= g_new(DC_PhysicalFile, 1);
|
||||||
|
file->label= g_strdup(label);
|
||||||
|
file->path= g_strdup(path);
|
||||||
|
file->mode= DC_FILE_REGULAR;
|
||||||
|
DC_log(LOG_DEBUG, "Phisical file %s created for %s",
|
||||||
|
path, label);
|
||||||
|
|
||||||
|
return(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
_DC_destroyPhysicalFile(DC_PhysicalFile *file)
|
||||||
|
{
|
||||||
|
if (!file)
|
||||||
|
return;
|
||||||
|
|
||||||
|
DC_log(LOG_DEBUG, "Phisical file %s destroying",
|
||||||
|
file->label);
|
||||||
|
g_free(file->label);
|
||||||
|
g_free(file->path);
|
||||||
|
g_free(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* End of condor/condor_file.c */
|
|
@ -0,0 +1,26 @@
|
||||||
|
/* Local variables: */
|
||||||
|
/* c-file-style: "linux" */
|
||||||
|
/* End: */
|
||||||
|
|
||||||
|
#ifndef _DC_API_CONDOR_FILE_H_
|
||||||
|
#define _DC_API_CONDOR_FILE_H_
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "dc.h"
|
||||||
|
|
||||||
|
|
||||||
|
extern DC_PhysicalFile *_DC_createPhysicalFile(const char *label,
|
||||||
|
const char *path);
|
||||||
|
extern void _DC_destroyPhysicalFile(DC_PhysicalFile * file);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* End of condor/condor_file.h */
|
|
@ -0,0 +1,77 @@
|
||||||
|
/* Local variables: */
|
||||||
|
/* c-file-style: "linux" */
|
||||||
|
/* End: */
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
|
||||||
|
#include "dc.h"
|
||||||
|
|
||||||
|
#include "condor_wu.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************** Manage WUs */
|
||||||
|
|
||||||
|
/* Submits a work unit. */
|
||||||
|
int
|
||||||
|
DC_submitWU (DC_Workunit * wu)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
//GString *fn;
|
||||||
|
GString *cmd;
|
||||||
|
gchar *act, *act2;
|
||||||
|
|
||||||
|
ret= wu_gen_condor_submit(wu);
|
||||||
|
if (ret)
|
||||||
|
{
|
||||||
|
DC_log(LOG_ERR, "Submit file generation failed");
|
||||||
|
return(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
//fn= g_string_new(wu->workdir);
|
||||||
|
//fn= g_string_append(fn, "/condor_submit.txt");
|
||||||
|
cmd= g_string_new("condor_submit");
|
||||||
|
cmd= g_string_append(cmd, " condor_submit.txt");
|
||||||
|
act= getcwd(NULL, 0);
|
||||||
|
chdir(wu->workdir);
|
||||||
|
act2= getcwd(NULL, 0);
|
||||||
|
DC_log(LOG_DEBUG, "Calling \"%s\" in %s...",
|
||||||
|
cmd->str, act2);
|
||||||
|
ret= system(cmd->str);
|
||||||
|
DC_log(LOG_DEBUG, "Returned %d", ret);
|
||||||
|
chdir(act);
|
||||||
|
g_free(act);
|
||||||
|
g_free(act2);
|
||||||
|
g_string_free(cmd, TRUE);
|
||||||
|
|
||||||
|
return (DC_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Cancels all computations for a given work unit. */
|
||||||
|
int
|
||||||
|
DC_cancelWU (DC_Workunit * wu)
|
||||||
|
{
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Temporarily suspends the execution of a work unit. */
|
||||||
|
int
|
||||||
|
DC_suspendWU (DC_Workunit * wu)
|
||||||
|
{
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Resumes computation of a previously suspended work unit. */
|
||||||
|
int
|
||||||
|
DC_resumeWU (DC_Workunit * wu)
|
||||||
|
{
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* End of condor/condor_managewu.c */
|
Loading…
Reference in New Issue