From 9868fbda6be54c3d018d14c7a6c7d794d5a3257c Mon Sep 17 00:00:00 2001 From: drdani Date: Fri, 23 Jun 2006 08:11:54 +0000 Subject: [PATCH] impl of sending subresult git-svn-id: svn+ssh://cvs.lpds.sztaki.hu/var/lib/svn/szdg/dcapi/trunk@754 a7169a2c-3604-0410-bc95-c702d8d87f7a --- dcapi/condor/condor_slave.c | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/dcapi/condor/condor_slave.c b/dcapi/condor/condor_slave.c index fd5a64ab08..7b0d2fd462 100644 --- a/dcapi/condor/condor_slave.c +++ b/dcapi/condor/condor_slave.c @@ -8,6 +8,7 @@ #include #include #include +#include #include "dc_common.h" #include "dc_client.h" @@ -15,6 +16,7 @@ #include "condor_common.h" #include "condor_slave.h" +#include "condor_utils.h" /* Initializes the client API. */ @@ -48,22 +50,44 @@ int DC_sendResult(const char *logicalFileName, const char *path, DC_FileMode fileMode) { + char *fn; + int ret; + DC_log(LOG_DEBUG, "DC_sendResult(%s,%s,%d)", logicalFileName, path, fileMode); - return(DC_ERR_NOTIMPL); + fn= malloc(strlen(logicalFileName)+100); + strcpy(fn, "client_subresults"); + strcat(fn, "/real_files"); + if ((ret= _DC_mkdir_with_parents(fn, S_IRWXU| + S_IRGRP|S_IXGRP| + S_IROTH|S_IXOTH)) != DC_OK) + { + DC_log(LOG_ERR, "Failed to create dir for subresult (%s): %s", + fn, strerror(errno)); + free(fn); + return(ret); + } + strcat(fn, "/"); + strcat(fn, logicalFileName); + if ((ret= _DC_copyFile(path, fn)) != DC_OK) + { + DC_log(LOG_ERR, "Failed to copy subresult file %s to " + "%s: %s", path, fn, strerror(errno)); + free(fn); + return(ret); + } + ret= _DC_create_message("client_subresults", "logical_name", + logicalFileName, NULL); + free(fn); + return(ret); } -static int _DC_message_id= 0; - /* Sends a message to the master. */ int DC_sendMessage(const char *message) { - char fn[254]; - FILE *f; - DC_log(LOG_DEBUG, "DC_sendMessage(%s)", message); return _DC_create_message("client_messages", "message", message, NULL); }