From c6114d38fcbfefb4078c60051b03a107c0f3106e Mon Sep 17 00:00:00 2001 From: vida Date: Thu, 16 Feb 2006 15:30:10 +0000 Subject: [PATCH] Implementation of dc_local to Miskolc for the University. Now the implementation level of the dc_local is the same as the boinc section. git-svn-id: svn+ssh://cvs.lpds.sztaki.hu/var/lib/svn/szdg/dcapi/trunk@338 a7169a2c-3604-0410-bc95-c702d8d87f7a --- dcapi/local/dc.c | 10 +++++++ dcapi/local/dc_client.c | 59 +++++++++++++++++++++++++++++++++++++ dcapi/local/rm.c | 10 +++++++ dcapi/local/rm.h | 6 ++++ dcapi/local/test/local.conf | 2 +- 5 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 dcapi/local/dc_client.c diff --git a/dcapi/local/dc.c b/dcapi/local/dc.c index 71c0220e84..74bd728ba3 100644 --- a/dcapi/local/dc.c +++ b/dcapi/local/dc.c @@ -79,6 +79,16 @@ int DC_cancelWU (DC_Workunit wu) return 1; } +int DC_suspendWU (DC_Workunit wu) +{ + return dc_rm_suspendWU(wu); +} + +int DC_resubmitWU(DC_Workunit wu) +{ + return dc_rm_resubmitWU(wu); +} + int DC_destroyWU(DC_Workunit wu) { dc_rm_destroyWU(wu); diff --git a/dcapi/local/dc_client.c b/dcapi/local/dc_client.c new file mode 100644 index 0000000000..d5f20d1924 --- /dev/null +++ b/dcapi/local/dc_client.c @@ -0,0 +1,59 @@ +#include +#include +#include + +#include + +static time_t ckpt_start; +static time_t ckpt_freq = 10; /* Checkpoint frequency in seconds */ + +int DC_init(void) +{ + ckpt_start = time(NULL); + return DC_OK; +} + +int DC_resolveFileName(DC_Filetype type, const char *requestedFileName, char *actualFileName, int maxlength) +{ + snprintf(actualFileName, maxlength, requestedFileName); + return DC_OK; +} + +int DC_sendResult(char **files, int nfiles) +{ + // not implemented yet!! + + return DC_OK; +} + +int DC_timeToCheckpoint(void) +{ + time_t current; + current = time(NULL); + if (current - ckpt_start > ckpt_freq) + return 1; + return 0; +} + +int DC_checkpointMade(void) +{ + ckpt_start = time(NULL); + return DC_OK; +} + +int DC_continueWork(void) +{ + // not implemented yet!! + + return 1; // yes, continue work. +} + +int DC_fractionDone(double fraction) +{ + return DC_OK; +} + +void DC_finish(int exitcode) +{ + exit(exitcode); +} diff --git a/dcapi/local/rm.c b/dcapi/local/rm.c index 1ab48b02f7..141d5a044e 100644 --- a/dcapi/local/rm.c +++ b/dcapi/local/rm.c @@ -205,6 +205,16 @@ int dc_rm_submitWU (DC_Workunit wu) return DC_OK; } +int dc_rm_suspendWU(DC_Workunit wu) +{ + return 0; +} + +int dc_rm_resubmitWU(DC_Workunit wu) +{ + return 0; +} + int dc_rm_destroyWU(DC_Workunit wu) { int ndx = (int)wu; diff --git a/dcapi/local/rm.h b/dcapi/local/rm.h index ba6b3f23a6..343001740c 100644 --- a/dcapi/local/rm.h +++ b/dcapi/local/rm.h @@ -17,6 +17,12 @@ int dc_rm_setInput(DC_Workunit wu, char * URL, char * localFileName); /** submit a wu */ int dc_rm_submitWU(DC_Workunit wu); +/** suspend a wu */ +int dc_rm_suspendWU(DC_Workunit wu); + +/** resubmit a wu */ +int dc_rm_resubmitWU(DC_Workunit wu); + /** free memory used by this wu */ int dc_rm_destroyWU(DC_Workunit wu); diff --git a/dcapi/local/test/local.conf b/dcapi/local/test/local.conf index 36c49aa6e4..ce82db54c1 100644 --- a/dcapi/local/test/local.conf +++ b/dcapi/local/test/local.conf @@ -6,7 +6,7 @@ # Working directory # -WorkingDirectory = /home/pnorbert/DCAPI-LOCAL-TEST +WorkingDirectory = . # # Debugging level