From eaeb57a7ae8d2bb7813eb964ddd63447a3c90c13 Mon Sep 17 00:00:00 2001 From: drdani Date: Tue, 23 May 2006 11:33:17 +0000 Subject: [PATCH] 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 --- dcapi/condor/Makefile.am | 13 ++++-- dcapi/condor/condor_file.c | 42 +++++++++++++++++++ dcapi/condor/condor_file.h | 26 ++++++++++++ dcapi/condor/condor_managewu.c | 77 ++++++++++++++++++++++++++++++++++ 4 files changed, 155 insertions(+), 3 deletions(-) create mode 100644 dcapi/condor/condor_file.c create mode 100644 dcapi/condor/condor_file.h create mode 100644 dcapi/condor/condor_managewu.c diff --git a/dcapi/condor/Makefile.am b/dcapi/condor/Makefile.am index 4aab2f3d10..f735e6b453 100644 --- a/dcapi/condor/Makefile.am +++ b/dcapi/condor/Makefile.am @@ -11,14 +11,20 @@ endif pkgconfigdir = ${libdir}/pkgconfig pkgconfig_DATA = dcapi-condor-client.pc dcapi-condor-master.pc -AM_CPPFLAGS = -I$(top_srcdir)/common $(GLIB_CFLAGS) -AM_LDFLAGS = $(BOINC_LDFLAGS) $(GLIB_LIBS) +AM_CPPFLAGS = -I$(top_srcdir)/common $(GLIB_CFLAGS) +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 libdc_condor_la_SOURCES = condor_master.cc \ 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 \ $(GLIB_LIBS) @@ -37,3 +43,4 @@ tm_SOURCES = tm.c tm_LDADD = ../common/libdc-common-master.la \ libdc-condor.la \ -luuid -lstdc++ + diff --git a/dcapi/condor/condor_file.c b/dcapi/condor/condor_file.c new file mode 100644 index 0000000000..63822ce20c --- /dev/null +++ b/dcapi/condor/condor_file.c @@ -0,0 +1,42 @@ +/* Local variables: */ +/* c-file-style: "linux" */ +/* End: */ + +#include + +#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 */ diff --git a/dcapi/condor/condor_file.h b/dcapi/condor/condor_file.h new file mode 100644 index 0000000000..43668a9c4d --- /dev/null +++ b/dcapi/condor/condor_file.h @@ -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 */ diff --git a/dcapi/condor/condor_managewu.c b/dcapi/condor/condor_managewu.c new file mode 100644 index 0000000000..d770e2a4ed --- /dev/null +++ b/dcapi/condor/condor_managewu.c @@ -0,0 +1,77 @@ +/* Local variables: */ +/* c-file-style: "linux" */ +/* End: */ + +#include +#include + +#include + +#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 */