|
From: <cs...@us...> - 2008-09-11 21:29:44
|
Revision: 52
http://bespp.svn.sourceforge.net/bespp/?rev=52&view=rev
Author: csmith
Date: 2008-09-11 21:29:53 +0000 (Thu, 11 Sep 2008)
Log Message:
-----------
- process headers in separate function
- added created/expired timestamps to WS-Security header on reply
- GetFactoryAttributesDocument now returns list of ContainedResources
Modified Paths:
--------------
trunk/besclient/libbes.c
trunk/besserver/auth.c
trunk/besserver/auth.h
trunk/besserver/besserver-typemap.dat
trunk/besserver/besserver.c
Modified: trunk/besclient/libbes.c
===================================================================
--- trunk/besclient/libbes.c 2008-05-19 15:33:33 UTC (rev 51)
+++ trunk/besclient/libbes.c 2008-09-11 21:29:53 UTC (rev 52)
@@ -47,6 +47,7 @@
struct Namespace default_namespaces[] =
{
{"SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/", "http://www.w3.org/*/soap-envelope", NULL},
+ {"wsu", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd", NULL, NULL},
{"wsse", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", NULL, NULL},
{"wsa", "http://www.w3.org/2005/08/addressing", NULL, NULL},
{"bes", "http://schemas.ggf.org/bes/2006/08/bes-factory", NULL, NULL},
@@ -145,25 +146,34 @@
setErrorString(context, context->soap, BESE_SOAP_ERR);
return BESE_SOAP_ERR;
}
+ if (soap_wsse_add_Timestamp(soap, NULL, 60)) {
+ setErrorString(context, context->soap, BESE_SOAP_ERR);
+ return BESE_SOAP_ERR;
+ }
}
if (x509cert) {
+ if (context->x509cert) free(context->x509cert);
context->x509cert = strdup(x509cert);
}
if (x509pass) {
+ if (context->x509pass) free(context->x509pass);
context->x509pass = strdup(x509pass);
}
if (capath) {
+ if (context->capath) free(context->capath);
context->capath = strdup(capath);
}
if (user) {
+ if (context->user) free(context->user);
context->user = strdup(user);
}
if (pass) {
+ if (context->pass) free(context->pass);
context->pass = strdup(pass);
}
@@ -183,6 +193,10 @@
setErrorString(context, context->soap, BESE_SOAP_ERR);
return BESE_SOAP_ERR;
}
+ if (soap_wsse_add_Timestamp(context->soap, NULL, 60)) {
+ setErrorString(context, context->soap, BESE_SOAP_ERR);
+ return BESE_SOAP_ERR;
+ }
return BESE_OK;
}
Modified: trunk/besserver/auth.c
===================================================================
--- trunk/besserver/auth.c 2008-05-19 15:33:33 UTC (rev 51)
+++ trunk/besserver/auth.c 2008-09-11 21:29:53 UTC (rev 52)
@@ -104,7 +104,7 @@
}
int
-authenticate(struct soap *s, char *username, int namelen)
+authenticate(struct soap *s, char *username, int namelen, int *sslauth)
{
static char fname[] = "authenticate";
struct _wsse__UsernameToken *token;
@@ -117,6 +117,7 @@
clientcert = SSL_get_peer_certificate(s->ssl);
if (clientcert) {
+ if (sslauth) *sslauth = 1;
if (SSL_get_verify_result(s->ssl) != X509_V_OK) {
return soap_wsse_fault(s, wsse__FailedAuthentication, NULL);
}
@@ -135,7 +136,8 @@
return SOAP_OK;
}
-
+ if (sslauth) *sslauth = 0;
+
/* no X.509 certificate ... look for WS-Security tokens */
token = soap_wsse_UsernameToken(s, NULL);
if (token) {
Modified: trunk/besserver/auth.h
===================================================================
--- trunk/besserver/auth.h 2008-05-19 15:33:33 UTC (rev 51)
+++ trunk/besserver/auth.h 2008-09-11 21:29:53 UTC (rev 52)
@@ -34,6 +34,6 @@
char *password;
};
-int authenticate(struct soap*, char *, int);
+int authenticate(struct soap*, char *, int, int*);
#endif /*AUTH_H_*/
Modified: trunk/besserver/besserver-typemap.dat
===================================================================
--- trunk/besserver/besserver-typemap.dat 2008-05-19 15:33:33 UTC (rev 51)
+++ trunk/besserver/besserver-typemap.dat 2008-09-11 21:29:53 UTC (rev 52)
@@ -76,7 +76,7 @@
SOAP_ENV__Header =\
struct SOAP_ENV__Header\n\
{\n\
- mustUnderstand _wsse__Security *wsse__Security 0;\n\
+ _wsse__Security *wsse__Security 0;\n\
_wsa__MessageID wsa__MessageID 0;\n\
_wsa__RelatesTo *wsa__RelatesTo 0;\n\
_wsa__From *wsa__From 0;\n\
Modified: trunk/besserver/besserver.c
===================================================================
--- trunk/besserver/besserver.c 2008-05-19 15:33:33 UTC (rev 51)
+++ trunk/besserver/besserver.c 2008-09-11 21:29:53 UTC (rev 52)
@@ -59,6 +59,7 @@
int isRemoteApplication(struct jobcard*);
int getRemoteEPR(struct soap*, int, struct soap_dom_element**);
int getContainedResources(struct soap*, struct bes__FactoryResourceAttributesDocumentType*, int);
+int processHeaders(struct soap*, char*, int);
char *service_endpoint = NULL;
@@ -271,13 +272,10 @@
fprintf(stderr, "In %s...\n", fname);
- if ((rc = authenticate(s, username, USERNAMELEN))) {
- clear_header(s);
+ if ((rc = processHeaders(s, username, USERNAMELEN))) {
return rc;
}
- clear_header(s);
-
jc = (struct jobcard*)soap_malloc(s, sizeof(struct jobcard));
if (jc == NULL) {
return soap_receiver_fault(s, MEM_ALLOC, NULL);
@@ -340,12 +338,10 @@
fprintf(stderr, "In %s...\n", fname);
- if ((rc = authenticate(s, username, USERNAMELEN))) {
+ if ((rc = processHeaders(s, username, USERNAMELEN))) {
return rc;
}
- clear_header(s);
-
if (req->__sizeActivityIdentifier == 0) {
resp->__sizeResponse = 0;
resp->Response = NULL;
@@ -420,12 +416,10 @@
fprintf(stderr, "In %s...\n", fname);
- if ((rc = authenticate(s, username, USERNAMELEN))) {
+ if ((rc = processHeaders(s, username, USERNAMELEN))) {
return rc;
}
- clear_header(s);
-
if (req->__sizeActivityIdentifier == 0) {
resp->__sizeResponse = 0;
resp->Response = NULL;
@@ -524,12 +518,10 @@
fprintf(stderr, "In %s...\n", fname);
- if ((rc = authenticate(s, username, USERNAMELEN))) {
+ if ((rc = processHeaders(s, username, USERNAMELEN))) {
return rc;
}
- clear_header(s);
-
if (req->__sizeActivityIdentifier == 0) {
resp->__sizeResponse = 0;
resp->Response = NULL;
@@ -608,7 +600,7 @@
{
static char fname[] = "__bes__GetFactoryAttributesDocument";
struct bes__FactoryResourceAttributesDocumentType *attrs;
- struct wsa_EndpointReferenceType *epr;
+ struct wsa_EndpointReferenceType *epr;
struct jobInfoEnt *jinfo;
char *clustername;
int num_jobs, i, rc;
@@ -616,12 +608,10 @@
fprintf(stderr, "In %s....\n", fname);
- if ((rc = authenticate(s, username, USERNAMELEN))) {
+ if ((rc = processHeaders(s, username, USERNAMELEN))) {
return rc;
}
- clear_header(s);
-
attrs = (struct bes__FactoryResourceAttributesDocumentType*)soap_malloc(s,
sizeof(struct bes__FactoryResourceAttributesDocumentType));
if (attrs == NULL) {
@@ -680,7 +670,7 @@
}
/* TotalNumberOfContainedResources and ContainedResource */
- if ((rc = getContainedResources(s, attrs, 0))) {
+ if ((rc = getContainedResources(s, attrs, 1))) {
if (rc == BESE_MEM_ALLOC) {
return soap_receiver_fault(s, MEM_ALLOC, NULL);
}
@@ -716,8 +706,6 @@
resp->bes__FactoryResourceAttributesDocument = attrs;
- clear_header(s);
-
return SOAP_OK;
}
@@ -853,6 +841,9 @@
memset(contained_resources, 0, sizeof(struct soap_dom_element)
*num_contained_resources);
for (j = 0, i = 0; i < numhosts; i++) {
+ if (hinfo[i].maxCpus == 0) {
+ continue;
+ }
resource = (struct bes__BasicResourceAttributesDocumentType*)soap_malloc(
s, sizeof(struct bes__BasicResourceAttributesDocumentType));
if (!resource) {
@@ -990,6 +981,21 @@
return SOAP_OK;
}
+int
+processHeaders(struct soap *s, char *username, int usernamelen)
+{
+ int rc = SOAP_OK;
+ int sslauth = 0;
+
+ rc = authenticate(s, username, usernamelen, &sslauth);
+ clear_header(s);
+ if (!sslauth) {
+ soap_wsse_add_Timestamp(s, NULL, 30);
+ }
+
+ return rc;
+}
+
/*
* Don't know why these aren't being generated, but ....
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cs...@us...> - 2008-09-23 01:13:30
|
Revision: 54
http://bespp.svn.sourceforge.net/bespp/?rev=54&view=rev
Author: csmith
Date: 2008-09-23 01:13:18 +0000 (Tue, 23 Sep 2008)
Log Message:
-----------
- changed job ids to strings in preparation for RM independent interface
- implemented new RM independent interface (rm.h)
- moved LSF-specific code to LSF module (rm_lsf.c)
Modified Paths:
--------------
trunk/Make.config
trunk/besserver/Makefile
trunk/besserver/besserver.c
trunk/besserver/faults.h
trunk/besserver/job.c
trunk/besserver/job.h
Added Paths:
-----------
trunk/besserver/rm.h
trunk/besserver/rm_lsf.c
Modified: trunk/Make.config
===================================================================
--- trunk/Make.config 2008-09-11 23:22:27 UTC (rev 53)
+++ trunk/Make.config 2008-09-23 01:13:18 UTC (rev 54)
@@ -7,6 +7,17 @@
GSOAP_TOP = /home/csmith/src/gsoap-2.7/gsoap
#
+# Which resource manager back end to use. Also need to set the
+# locations of resource manager specific includes and libraries
+#
+RM = rm_lsf
+#RM = rm_pbs
+#RM = rm_sge
+
+RM_INC = $(LSF_INC)
+RM_LIBS = $(LSF_LIBS)
+
+#
# LSF related variables
#
# LSF_LOC is where the 'include' and architecture specific
Modified: trunk/besserver/Makefile
===================================================================
--- trunk/besserver/Makefile 2008-09-11 23:22:27 UTC (rev 53)
+++ trunk/besserver/Makefile 2008-09-23 01:13:18 UTC (rev 54)
@@ -11,14 +11,14 @@
# http://schemas.ggf.org/jsdl/2005/11/jsdl-posix
CC = gcc
-CFLAGS = -g $(GSOAP_DEF) -I. $(GSOAP_INC) $(LSF_INC) $(EXTRA_INC)
+CFLAGS = -g $(GSOAP_DEF) -I. $(GSOAP_INC) $(RM_INC) $(EXTRA_INC)
LDFLAGS = -g $(EXTRA_LIB)
-LIBS = -lssl -lcrypto -lpam $(LSF_LIBS) $(EXTRA_LIBS)
+LIBS = -lssl -lcrypto -lpam $(RM_LIBS) $(EXTRA_LIBS)
BES_WSDL = bes-factory.wsdl
BES_HEADER = bes-factory.h
-BES_H_FILES = job.h namespaces.h faults.h auth.h
-BES_OBJ = besserver.o job.o faults.o auth.o
+BES_H_FILES = job.h namespaces.h faults.h auth.h rm.h
+BES_OBJ = besserver.o job.o faults.o auth.o $(RM).o
SOAP_NS = BESFactoryBinding.nsmap
SOAP_H_FILES = soapH.h soapStub.h
@@ -37,6 +37,7 @@
job.o: job.c $(BES_H_FILES) $(SOAP_NS)
faults.o: faults.c $(BES_H_FILES) $(SOAP_NS)
auth.o: auth.c $(BES_H_FILES) $(SOAP_NS)
+$(RM).o: $(RM).c $(BES_H_FILES) $(SOAP_NS)
soapServer.o: soapServer.c
soapClient.o: soapClient.c
Modified: trunk/besserver/besserver.c
===================================================================
--- trunk/besserver/besserver.c 2008-09-11 23:22:27 UTC (rev 53)
+++ trunk/besserver/besserver.c 2008-09-23 01:13:18 UTC (rev 54)
@@ -35,9 +35,6 @@
#include <paths.h>
#include <time.h>
-#include <lsf/lsf.h>
-#include <lsf/lsbatch.h>
-
#include "wsseapi.h"
#include "BESFactoryBinding.nsmap"
@@ -45,6 +42,7 @@
#include "job.h"
#include "namespaces.h"
#include "faults.h"
+#include "rm.h"
#define USERNAMELEN 256
@@ -52,11 +50,10 @@
#define clear_header(x) if (x->header) memset(x->header, 0, sizeof(struct SOAP_ENV__Header));
-int isElement(struct soap_dom_element *, char *, char *);
-int makeActivityEPR(struct soap*, char *, int, struct wsa__EndpointReferenceType*);
-int makeActivityDomEPR(struct soap*, char *, int, struct soap_dom_element**);
-int getJobIdFromEPR(struct soap*, struct wsa__EndpointReferenceType*, int*);
-int getContainedResources(struct soap*, struct bes__FactoryResourceAttributesDocumentType*, int);
+int isElement(struct soap_dom_element*, char*, char*);
+int makeActivityEPR(struct soap*, char*, char*, struct wsa__EndpointReferenceType*);
+int makeActivityDomEPR(struct soap*, char*, char*, struct soap_dom_element**);
+int getJobIdFromEPR(struct soap*, struct wsa__EndpointReferenceType*, char**);
int processHeaders(struct soap*, char*, int);
@@ -174,15 +171,8 @@
exit(1);
}
- if (lsb_init("besserver")) {
- lsb_perror("main: lsb_init");
- exit(1);
- }
-
soap_ssl_init();
-
soap_init(&soap);
-
soap_set_mode(&soap, SOAP_C_UTFSTRING|SOAP_IO_STORE);
soap_register_plugin(&soap, soap_wsse);
@@ -202,6 +192,11 @@
sprintf(service_endpoint, "https://%s%s%s", host, strlen(portstr)?":":"", portstr);
}
+ if (rm_initialize(&soap, NULL)) {
+ fprintf(stderr, "Couldn't initialize the resource manager\n");
+ exit(1);
+ }
+
m = soap_bind(&soap, host, port, 100);
if (m < 0) {
soap_print_fault(&soap, stderr);
@@ -259,9 +254,9 @@
static char fname[] = "__bes__CreateActivity";
struct jobcard *jc;
struct soap_dom_element *dom;
- int rc, jobid;
+ int rc;
struct SOAP_ENV__Fault *fault;
- char username[USERNAMELEN];
+ char username[USERNAMELEN], *jobid;
fprintf(stderr, "In %s...\n", fname);
@@ -287,13 +282,13 @@
return bes_send_fault(s, fault);
}
- rc = submitLSFJob(jc, &jobid, username);
+ rc = rm_submitJob(s, jc, username, &jobid);
if (rc != BESE_OK) {
if (rc == BESE_PERMISSION) {
fault = bes_NotAuthorizedFault(s, lsb_sysmsg());
return bes_send_fault(s, fault);
} else {
- return soap_receiver_fault(s, LSF_LIB_ERROR, NULL);
+ return soap_receiver_fault(s, BACKEND_ERROR, NULL);
}
}
@@ -317,8 +312,8 @@
struct wsa__EndpointReferenceType *cur;
struct bes__TerminateActivityResponseType *resp_array;
struct soap_dom_element *fault;
- int i, rc, jobid;
- char username[USERNAMELEN];
+ int i, rc;
+ char username[USERNAMELEN], *jobid;
fprintf(stderr, "In %s...\n", fname);
@@ -345,7 +340,8 @@
cur = &(req->ActivityIdentifier[0]);
resp_array[i].ActivityIdentifier = cur;
- if (rc = getJobIdFromEPR(s, cur, &jobid)) {
+ jobid = NULL;
+ if (getJobIdFromEPR(s, cur, &jobid) || !jobid) {
resp_array[i].__any = bes_InvalidActivityFaultDOM(s, "Malformed EPR", "Malformed EPR");
if (resp_array[i].__any == NULL) {
return soap_receiver_fault(s, MEM_ALLOC, NULL);
@@ -355,9 +351,9 @@
continue;
}
- fprintf(stderr, "Terminating job %d\n", jobid);
+ fprintf(stderr, "Terminating job %s\n", jobid);
- rc = terminateLSFJob(jobid, username);
+ rc = rm_terminateJob(s, jobid, username);
if (rc != BESE_OK) {
if (rc == BESE_NO_ACTIVITY) {
fault = bes_InvalidActivityFaultDOM(s, "Unknown Activity", "Unknown Activity");
@@ -392,11 +388,9 @@
struct wsa__EndpointReferenceType *cur;
struct bes__GetActivityStatusResponseType *resp_array;
struct bes__ActivityStatusType *status;
- struct bes__ActivityStateType *state;
- struct jobInfoEnt *job;
struct soap_dom_element *fault;
- int i, rc, jobid;
- char username[USERNAMELEN];
+ int i, rc;
+ char username[USERNAMELEN], *jobid;
fprintf(stderr, "In %s...\n", fname);
@@ -423,7 +417,8 @@
cur = &(req->ActivityIdentifier[0]);
resp_array[i].ActivityIdentifier = cur;
- if (rc = getJobIdFromEPR(s, cur, &jobid)) {
+ jobid = NULL;
+ if (getJobIdFromEPR(s, cur, &jobid) || !jobid) {
resp_array[i].__any = bes_InvalidActivityFaultDOM(s, "Malformed EPR", "Malformed EPR");
if (resp_array[i].__any == NULL) {
return soap_receiver_fault(s, MEM_ALLOC, NULL);
@@ -432,14 +427,14 @@
continue;
}
- fprintf(stderr, "Getting status for job %d\n", jobid);
+ fprintf(stderr, "Getting status for job %s\n", jobid);
- rc = lsb_openjobinfo(jobid, NULL, "all", NULL, NULL, ALL_JOB);
- if (rc == -1) {
- lsb_perror("GetActivityStatuses: lsb_openjobinfo");
- if (lsberrno == LSBE_NO_JOB) {
+ rc = rm_getJobStatus(s, jobid, username, &status);
+ if (rc != BESE_OK) {
+ if (rc == BESE_NO_ACTIVITY) {
fault = bes_InvalidActivityFaultDOM(s, "Unknown Activity", "Unknown Activity");
- } else {
+ }
+ else {
fault = bes_backend_errorDOM(s);
}
if (fault == NULL) {
@@ -450,35 +445,8 @@
continue;
}
- job = lsb_readjobinfo(NULL);
- if (job == NULL) {
- lsb_perror("GetActivityStatuses: lsb_readjobinfo");
- resp_array[i].__any = bes_backend_errorDOM(s);
- if (resp_array[i].__any == NULL) {
- return soap_receiver_fault(s, MEM_ALLOC, NULL);
- }
- resp_array[i].__size = 1;
- continue;
- }
-
- status = (struct bes__ActivityStatusType*)soap_malloc(s,
- sizeof(struct bes__ActivityStatusType));
- if (status == NULL) {
- return soap_receiver_fault(s, MEM_ALLOC, NULL);
- }
- memset(status, 0, sizeof(struct bes__ActivityStatusType));
-
- if (IS_PEND(job->status)) {
- status->state = Pending;
- } else if (IS_START(job->status)) {
- status->state = Running;
- } else if (IS_FINISH(job->status)) {
- status->state = Finished;
- }
-
resp_array[i].bes__ActivityStatus = status;
- lsb_closejobinfo();
}
resp->__sizeResponse = req->__sizeActivityIdentifier;
@@ -495,10 +463,10 @@
static char fname[] = "__bes__GetActivityDocuments";
struct wsa__EndpointReferenceType *cur;
struct bes__GetActivityDocumentResponseType *resp_array;
- struct jobInfoEnt *job;
+ struct jobcard *job_info;
struct soap_dom_element *fault;
- int i, rc, jobid;
- char username[USERNAMELEN];
+ int i, rc;
+ char username[USERNAMELEN], *jobid;
fprintf(stderr, "In %s...\n", fname);
@@ -525,7 +493,8 @@
cur = &(req->ActivityIdentifier[0]);
resp_array[i].ActivityIdentifier = cur;
- if (getJobIdFromEPR(s, cur, &jobid) < 0) {
+ jobid = NULL;
+ if (getJobIdFromEPR(s, cur, &jobid) || !jobid) {
resp_array[i].__any = bes_InvalidActivityFaultDOM(s, "Malformed EPR", "Malformed EPR");
if (resp_array[i].__any == NULL) {
return soap_receiver_fault(s, MEM_ALLOC, NULL);
@@ -534,14 +503,14 @@
continue;
}
- fprintf(stderr, "Getting information for job %d\n", jobid);
+ fprintf(stderr, "Getting information for job %s\n", jobid);
- rc = lsb_openjobinfo(jobid, NULL, "all", NULL, NULL, ALL_JOB);
- if (rc == -1) {
- lsb_perror("GetActivityStatuses: lsb_openjobinfo");
- if (lsberrno == LSBE_NO_JOB) {
+ rc = rm_getJobInfo(s, jobid, username, &job_info);
+ if (rc != BESE_OK) {
+ if (rc == BESE_NO_ACTIVITY) {
fault = bes_InvalidActivityFaultDOM(s, "Unknown Activity", "Unknown Activity");
- } else {
+ }
+ else {
fault = bes_backend_errorDOM(s);
}
if (fault == NULL) {
@@ -552,23 +521,11 @@
continue;
}
- job = lsb_readjobinfo(NULL);
- if (job == NULL) {
- lsb_perror("GetActivityStatuses: lsb_readjobinfo");
- resp_array[i].__any = bes_backend_errorDOM(s);
- if (resp_array[i].__any == NULL) {
- return soap_receiver_fault(s, MEM_ALLOC, NULL);
- }
- resp_array[i].__size = 1;
- continue;
- }
-
- rc = getJSDLFromJobInfo(s, job, &resp_array[i].JobDefinition);
+ rc = getJSDLFromJobInfo(s, job_info, &resp_array[i].JobDefinition);
if (rc) {
return rc;
}
- lsb_closejobinfo();
}
resp->__sizeResponse = req->__sizeActivityIdentifier;
@@ -585,9 +542,12 @@
static char fname[] = "__bes__GetFactoryAttributesDocument";
struct bes__FactoryResourceAttributesDocumentType *attrs;
struct wsa_EndpointReferenceType *epr;
- struct jobInfoEnt *jinfo;
- char *clustername;
- int num_jobs, i, rc;
+ struct rm_clusterInfo *cinfo;
+ struct rm_job *joblist, *job;
+ struct rm_resource *resourcelist, *resource;
+ struct soap_dom_element *contained_resources;
+ struct bes__BasicResourceAttributesDocumentType *res;
+ int num_jobs, num_resources, i, rc;
char username[USERNAMELEN];
fprintf(stderr, "In %s....\n", fname);
@@ -604,89 +564,115 @@
}
memset(attrs, 0, sizeof(struct bes__FactoryResourceAttributesDocumentType));
- /* IsAcceptingNewActivities */
- attrs->IsAcceptingNewActivities = true_;
- /* CommonName */
- clustername = ls_getclustername();
- if (clustername == NULL) {
- fprintf(stderr, "%s: %s: %s", fname, "ls_getclustername", ls_sysmsg());
- return soap_receiver_fault(s, LSF_LIB_ERROR, NULL);
+ if ((rc = rm_getClusterInfo(s, &cinfo)) != BESE_OK) {
+ if (rc == BESE_MEM_ALLOC) {
+ return soap_receiver_fault(s, MEM_ALLOC, NULL);
+ }
+ else if (rc == BESE_BACKEND) {
+ return soap_receiver_fault(s, BACKEND_ERROR, NULL);
+ }
+ else {
+ return soap_receiver_fault(s, UNKNOWN_ERROR, NULL);
+ }
}
- attrs->CommonName = soap_strdup(s, clustername);
- if (attrs->CommonName == NULL) {
+
+ /* attributes from the backend */
+ attrs->IsAcceptingNewActivities = cinfo->IsAcceptingNewActivities;
+ attrs->CommonName = cinfo->CommonName;
+ attrs->LongDescription = cinfo->LongDescription;
+ attrs->__sizeBESExtension = cinfo->num_extensions;
+ attrs->BESExtension = cinfo->BESExtensions;
+ attrs->LocalResourceManagerType = cinfo->LocalResourceManagerType;
+
+ /* Only support basic EPRs, no WS-Names */
+ attrs->__sizeNamingProfile = 1;
+ attrs->NamingProfile = (char**)soap_malloc(s, sizeof(char*));
+ attrs->NamingProfile[0] = soap_strdup(s,
+ "http://schemas.ogf.org/bes/2006/08/bes/naming/BasicWSAddressing");
+ if (attrs->NamingProfile == NULL) {
soap_print_fault(s, stderr);
return soap_receiver_fault(s, MEM_ALLOC, NULL);
}
- /* LongDescription */
-
/* TotalNumberOfActivities and ActivityReference */
- num_jobs = lsb_openjobinfo(0, NULL, "all", NULL, NULL, ALL_JOB);
- if (num_jobs == -1) {
- if (lsberrno != LSBE_NO_JOB) {
- fprintf(stderr, "%s: %s: %s", fname, "lsb_openjobinfo", lsb_sysmsg());
- return soap_receiver_fault(s, LSF_LIB_ERROR, NULL);
- } else {
- num_jobs = 0;
+ rc = rm_getJobList(s, NULL, &joblist, &num_jobs);
+ if (rc != BESE_OK) {
+ if (rc == BESE_MEM_ALLOC) {
+ return soap_receiver_fault(s, MEM_ALLOC, NULL);
}
+ else if (rc == BESE_BACKEND) {
+ return soap_receiver_fault(s, BACKEND_ERROR, NULL);
+ }
+ else {
+ return soap_receiver_fault(s, UNKNOWN_ERROR, NULL);
+ }
}
attrs->TotalNumberOfActivities = num_jobs;
- attrs->__sizeActivityReference = num_jobs;
- attrs->ActivityReference = (struct wsa__EndpointReferenceType*)soap_malloc(
- s, sizeof(struct wsa__EndpointReferenceType)*num_jobs);
- if (attrs->ActivityReference == NULL) {
- soap_print_fault(s, stderr);
- return soap_receiver_fault(s, MEM_ALLOC, NULL);
- }
- for (i = 0; i < num_jobs; i++) {
- jinfo = lsb_readjobinfo(NULL);
- if (jinfo == NULL) {
- fprintf(stderr, "%s: %s: %s\n", fname, "lsb_readjobinfo", lsb_sysmsg());
- return soap_receiver_fault(s, LSF_LIB_ERROR, NULL);
- }
- rc = makeActivityEPR(s, service_endpoint, jinfo->jobId,
- &(attrs->ActivityReference[i]));
- if (rc) {
+ if (num_jobs) {
+ attrs->__sizeActivityReference = num_jobs;
+ attrs->ActivityReference = (struct wsa__EndpointReferenceType*)soap_malloc(s, sizeof(struct wsa__EndpointReferenceType)*num_jobs);
+ if (attrs->ActivityReference == NULL) {
soap_print_fault(s, stderr);
- return rc;
+ return soap_receiver_fault(s, MEM_ALLOC, NULL);
}
+ job = joblist;
+ for (i = 0; i < num_jobs; i++) {
+ rc = makeActivityEPR(s, service_endpoint, job->jobid,
+ &(attrs->ActivityReference[i]));
+ if (rc) {
+ soap_print_fault(s, stderr);
+ return rc;
+ }
+ job = job->next;
+ }
}
/* TotalNumberOfContainedResources and ContainedResource */
- if ((rc = getContainedResources(s, attrs, 1))) {
+ rc = rm_getResourceList(s, NULL, &resourcelist, &num_resources);
+ if (rc != BESE_OK) {
if (rc == BESE_MEM_ALLOC) {
return soap_receiver_fault(s, MEM_ALLOC, NULL);
}
- if (rc == BESE_BACKEND) {
- return soap_receiver_fault(s, LSF_LIB_ERROR, NULL);
+ else if (rc == BESE_BACKEND) {
+ return soap_receiver_fault(s, BACKEND_ERROR, NULL);
}
- return soap_receiver_fault(s, UNKNOWN_ERROR, NULL);
+ else {
+ return soap_receiver_fault(s, UNKNOWN_ERROR, NULL);
+ }
}
-
- /* NamingProfile */
- attrs->__sizeNamingProfile = 1;
- attrs->NamingProfile = (char**)soap_malloc(s, sizeof(char*));
- attrs->NamingProfile[0] = soap_strdup(s,
- "http://schemas.ogf.org/bes/2006/08/bes/naming/BasicWSAddressing");
- if (attrs->NamingProfile == NULL) {
- soap_print_fault(s, stderr);
- return soap_receiver_fault(s, MEM_ALLOC, NULL);
- }
+ attrs->TotalNumberOfContainedResources = num_resources;
+ if (num_resources) {
+ contained_resources = (struct soap_dom_element*)soap_malloc(s,
+ sizeof(struct soap_dom_element)*num_resources);
+ if (!contained_resources) {
+ return soap_receiver_fault(s, MEM_ALLOC, NULL);
+ }
+ memset(contained_resources, 0, sizeof(struct soap_dom_element)
+ *num_resources);
+ resource = resourcelist;
+ for (i = 0; i < num_resources; i++) {
+ res = (struct bes__BasicResourceAttributesDocumentType*)soap_malloc(s, sizeof(struct bes__BasicResourceAttributesDocumentType));
+ if (!res) {
+ return soap_receiver_fault(s, MEM_ALLOC, NULL);
+ }
+ memset(res, 0, sizeof(struct bes__BasicResourceAttributesDocumentType));
- /* BESExtension */
+ res->ResourceName = resource->ResourceName;
+ res->CPUCount = resource->CPUCount;
+ res->CPUSpeed = resource->CPUSpeed;
+ res->PhysicalMemory = resource->PhysicalMemory;
+ res->VirtualMemory = resource->VirtualMemory;
- /* LocalResourceManagerType */
- attrs->LocalResourceManagerType = (char*)soap_malloc(s,
- strlen("http://www.platform.com/bes/2006/08/resourcemanager/LSF")
- + strlen(LSF_CURRENT_VERSION)+1);
- if (attrs->LocalResourceManagerType == NULL) {
- soap_print_fault(s, stderr);
- return soap_receiver_fault(s, MEM_ALLOC, NULL);
+ contained_resources[i].type
+ = SOAP_TYPE_bes__BasicResourceAttributesDocumentType;
+ contained_resources[i].node = res;
+ contained_resources[i].soap = s;
+ resource = resource->next;
+ }
+ attrs->ContainedResource = contained_resources;
+ attrs->__sizeContainedResource = num_resources;
}
- sprintf(attrs->LocalResourceManagerType,
- "http://www.platform.com/bes/2006/08/resourcemanager/LSF%s",
- LSF_CURRENT_VERSION);
resp->bes__FactoryResourceAttributesDocument = attrs;
@@ -719,14 +705,11 @@
}
int
-makeActivityEPR(struct soap *s, char *endpoint, int jobid,
+makeActivityEPR(struct soap *s, char *endpoint, char *jobid,
struct wsa__EndpointReferenceType *epr)
{
static char fname[] = "makeActivityEPR";
- char id[64];
- sprintf(id, "%d", jobid);
-
memset(epr, 0, sizeof(wsa__EndpointReferenceType));
epr->Address = (wsa__AttributedURIType*)soap_malloc(s,
sizeof(wsa__AttributedURIType));
@@ -734,25 +717,22 @@
return soap_receiver_fault(s, MEM_ALLOC, NULL);
}
memset(epr->Address, 0, sizeof(wsa__AttributedURIType));
- epr->Address->__item = (char*)soap_malloc(s, strlen(endpoint)+strlen(id)+2);
+ epr->Address->__item = (char*)soap_malloc(s, strlen(endpoint)+strlen(jobid)+2);
if (epr->Address->__item == NULL) {
return soap_receiver_fault(s, MEM_ALLOC, NULL);
}
- sprintf(epr->Address->__item, "%s/%s", endpoint, id);
+ sprintf(epr->Address->__item, "%s/%s", endpoint, jobid);
return SOAP_OK;
}
int
-makeActivityDomEPR(struct soap *s, char *endpoint, int jobid,
+makeActivityDomEPR(struct soap *s, char *endpoint, char *jobid,
struct soap_dom_element **ret)
{
- static char fname[] = "makeActivityEPR";
+ static char fname[] = "makeActivityDomEPR";
struct soap_dom_element *activityid, *addr;
- char id[64];
- sprintf(id, "%d", jobid);
-
activityid = (struct soap_dom_element*)soap_malloc(s,
sizeof(struct soap_dom_element));
addr = (struct soap_dom_element*)soap_malloc(s,
@@ -773,11 +753,11 @@
addr->name = soap_strdup(s, "Address");
addr->nstr = soap_strdup(s, WSA_NS);
- addr->data = (char*)soap_malloc(s, strlen(endpoint) + strlen(id) + 2);
+ addr->data = (char*)soap_malloc(s, strlen(endpoint) + strlen(jobid) + 2);
if (!addr->name || !addr->nstr || !addr->data) {
return soap_receiver_fault(s, MEM_ALLOC, NULL);
}
- sprintf(addr->data, "%s/%s", endpoint, id);
+ sprintf(addr->data, "%s/%s", endpoint, jobid);
addr->soap = s;
addr->prnt = activityid;
@@ -785,99 +765,9 @@
return SOAP_OK;
}
-int
-getContainedResources(struct soap *s,
- struct bes__FactoryResourceAttributesDocumentType *attrs,
- int return_hosts)
-{
- static char fname[] = "getContainedResources";
- struct soap_dom_element *contained_resources;
- struct bes__BasicResourceAttributesDocumentType *resource;
- int num_contained_resources = 0;
- struct hostInfo *hinfo;
- char *cpuarch, *osname, *osver;
- int numhosts = 0, numres = 0;
- int i, j;
-
- if (!s || !attrs) {
- return BESE_BAD_ARG;
- }
-
- hinfo = ls_gethostinfo(NULL, &numhosts, NULL, 0, 0);
- if (hinfo == NULL) {
- fprintf(stderr, "%s: ls_gethostinfo error: %s\n", fname, ls_sysmsg());
- return BESE_BACKEND;
- }
- for (i = 0; i < numhosts; i++) {
- if (hinfo[i].maxCpus == 0) {
- /* host is unavailable at this time */
- continue;
- }
- num_contained_resources++;
- }
-
- if (return_hosts) {
- contained_resources = (struct soap_dom_element*)soap_malloc(s,
- sizeof(struct soap_dom_element)*num_contained_resources);
- if (!contained_resources) {
- return BESE_MEM_ALLOC;
- }
- memset(contained_resources, 0, sizeof(struct soap_dom_element)
- *num_contained_resources);
- for (j = 0, i = 0; i < numhosts; i++) {
- if (hinfo[i].maxCpus == 0) {
- continue;
- }
- resource = (struct bes__BasicResourceAttributesDocumentType*)soap_malloc(
- s, sizeof(struct bes__BasicResourceAttributesDocumentType));
- if (!resource) {
- return BESE_MEM_ALLOC;
- }
- memset(resource, 0,
- sizeof(struct bes__BasicResourceAttributesDocumentType));
-
- resource->ResourceName = soap_strdup(s, hinfo[i].hostName);
- if (!resource->ResourceName) {
- return BESE_MEM_ALLOC;
- }
-
- resource->CPUCount = (double*)soap_malloc(s, sizeof(double));
- if (!resource->CPUCount) {
- return BESE_MEM_ALLOC;
- }
- *resource->CPUCount = (double)hinfo[i].maxCpus;
-
- resource->PhysicalMemory = (double*)soap_malloc(s, sizeof(double));
- if (!resource->PhysicalMemory) {
- return BESE_MEM_ALLOC;
- }
- *resource->PhysicalMemory = 1024.0*1024.0*(double)hinfo[i].maxMem;
-
- resource->VirtualMemory = (double*)soap_malloc(s, sizeof(double));
- if (!resource->VirtualMemory) {
- return BESE_MEM_ALLOC;
- }
- *resource->VirtualMemory = 1024.0*1024.0*(double)hinfo[i].maxSwap;
-
- contained_resources[j].type
- = SOAP_TYPE_bes__BasicResourceAttributesDocumentType;
- contained_resources[j].node = resource;
- contained_resources[j].soap = s;
- j++;
- }
- attrs->ContainedResource = contained_resources;
- attrs->__sizeContainedResource = j;
- }
-
- attrs->TotalNumberOfContainedResources = num_contained_resources;
-
- return BESE_OK;
-}
-
-
int
getJobIdFromEPR(struct soap *s, struct wsa__EndpointReferenceType *epr,
- int *jobid)
+ char **jobid)
{
static char fname[] = "getJobIdFromEPR";
char *cp;
@@ -891,7 +781,8 @@
if (!cp) {
return -1;
}
- *jobid = atoi(++cp);
+ cp++;
+ *jobid = soap_strdup(s, cp);
return 0;
}
Modified: trunk/besserver/faults.h
===================================================================
--- trunk/besserver/faults.h 2008-09-11 23:22:27 UTC (rev 53)
+++ trunk/besserver/faults.h 2008-09-23 01:13:18 UTC (rev 54)
@@ -44,6 +44,7 @@
#define UNKNOWN_ERROR "Unknown error"
#define ELEMENT_UNSUPPORTED "Element is unsupported"
#define ELEMENT_UNKNOWN "Element is unrecognized"
+#define BACKEND_ERROR "Failed in a call to the backend resource manager"
#define BES_FAULT_NOT_AUTHORIZED "bes:NotAuthorizedFault"
#define BES_FAULT_NOT_ACCEPTING "bes:NotAcceptingNewActivitiesFault"
Modified: trunk/besserver/job.c
===================================================================
--- trunk/besserver/job.c 2008-09-11 23:22:27 UTC (rev 53)
+++ trunk/besserver/job.c 2008-09-23 01:13:18 UTC (rev 54)
@@ -753,10 +753,11 @@
}
struct soap_dom_element *
-getHPCProfileApplication(struct soap *s, struct jobInfoEnt *job)
+getHPCProfileApplication(struct soap *s, struct jobcard *job)
{
struct soap_dom_element *dom, *cur, *next;
- char *nstr, *cp, **cpp, *command;
+ char *nstr;
+ int i;
nstr = soap_strdup(s, JSDL_HPCPA_NS);
if (!nstr) {
@@ -775,10 +776,6 @@
return NULL;
}
- command = soap_strdup(s, job->submit.command);
- if (!command) {
- return NULL;
- }
cur = (struct soap_dom_element*)soap_malloc(s,
sizeof(struct soap_dom_element));
if (cur == NULL) {
@@ -791,15 +788,13 @@
if (!cur->name) {
return NULL;
}
- cpp = &command;
- cp = strsep(cpp, " \t");
- cur->data = soap_strdup(s, cp);
+ cur->data = soap_strdup(s, job->executable);
if (!cur->data) {
return NULL;
}
dom->elts = cur;
- while (cp = strsep(cpp, " \t")) {
+ for (i = 0; i < job->num_args; i++ ) {
next = (struct soap_dom_element*)soap_malloc(s,
sizeof(struct soap_dom_element));
if (next == NULL) {
@@ -812,7 +807,7 @@
if (!next->name) {
return NULL;
}
- next->data = soap_strdup(s, cp);
+ next->data = soap_strdup(s, job->args[i]);
if (!next->data) {
return NULL;
}
@@ -820,7 +815,7 @@
cur = next;
}
- if (job->submit.inFile) {
+ if (job->input) {
next = (struct soap_dom_element*)soap_malloc(s,
sizeof(struct soap_dom_element));
if (next == NULL) {
@@ -833,7 +828,7 @@
if (!next->name) {
return NULL;
}
- next->data = soap_strdup(s, job->submit.inFile);
+ next->data = soap_strdup(s, job->input);
if (!next->data) {
return NULL;
}
@@ -841,7 +836,7 @@
cur = next;
}
- if (job->submit.outFile) {
+ if (job->output) {
next = (struct soap_dom_element*)soap_malloc(s,
sizeof(struct soap_dom_element));
if (next == NULL) {
@@ -854,7 +849,7 @@
if (!next->name) {
return NULL;
}
- next->data = soap_strdup(s, job->submit.outFile);
+ next->data = soap_strdup(s, job->output);
if (!next->data) {
return NULL;
}
@@ -862,7 +857,7 @@
cur = next;
}
- if (job->submit.errFile) {
+ if (job->error) {
next = (struct soap_dom_element*)soap_malloc(s,
sizeof(struct soap_dom_element));
if (next == NULL) {
@@ -875,7 +870,7 @@
if (!next->name) {
return NULL;
}
- next->data = soap_strdup(s, job->submit.errFile);
+ next->data = soap_strdup(s, job->error);
if (!next->data) {
return NULL;
}
@@ -883,7 +878,7 @@
cur = next;
}
- if (job->execCwd) {
+ if (job->wd) {
next = (struct soap_dom_element*)soap_malloc(s,
sizeof(struct soap_dom_element));
if (next == NULL) {
@@ -896,7 +891,7 @@
if (!next->name) {
return NULL;
}
- next->data = soap_strdup(s, job->execCwd);
+ next->data = soap_strdup(s, job->wd);
if (!next->data) {
return NULL;
}
@@ -904,7 +899,7 @@
cur = next;
}
- if (job->execUsername) {
+ if (job->username) {
next = (struct soap_dom_element*)soap_malloc(s,
sizeof(struct soap_dom_element));
if (next == NULL) {
@@ -917,7 +912,7 @@
if (!next->name) {
return NULL;
}
- next->data = soap_strdup(s, job->execUsername);
+ next->data = soap_strdup(s, job->username);
if (!next->data) {
return NULL;
}
@@ -929,7 +924,7 @@
}
int
-getJSDLFromJobInfo(struct soap *s, struct jobInfoEnt *job,
+getJSDLFromJobInfo(struct soap *s, struct jobcard *job...
[truncated message content] |
|
From: <cs...@us...> - 2009-01-12 10:48:11
|
Revision: 64
http://bespp.svn.sourceforge.net/bespp/?rev=64&view=rev
Author: csmith
Date: 2009-01-12 10:48:08 +0000 (Mon, 12 Jan 2009)
Log Message:
-----------
- updated copyright dates in preparation for release
Modified Paths:
--------------
trunk/README.txt
trunk/besclient/bes.c
trunk/besclient/bes.h
trunk/besclient/besclient.c
trunk/besclient/jsdl.c
trunk/besclient/jsdl.h
trunk/besclient/namespaces.h
trunk/besserver/auth.c
trunk/besserver/auth.h
trunk/besserver/besserver.c
trunk/besserver/faults.c
trunk/besserver/faults.h
trunk/besserver/job.c
trunk/besserver/job.h
trunk/besserver/namespaces.h
trunk/besserver/rm.h
trunk/besserver/rm_lsf.c
trunk/config.h
Modified: trunk/README.txt
===================================================================
--- trunk/README.txt 2009-01-12 10:27:26 UTC (rev 63)
+++ trunk/README.txt 2009-01-12 10:48:08 UTC (rev 64)
@@ -262,6 +262,6 @@
=========
BES++ is copyrighted by Platform Computing Corp.
-Copyright (C) 2007-2008 Platform Computing Corp.
+Copyright (C) 2007-2009 Platform Computing Corp.
All Rights Reserved
Modified: trunk/besclient/bes.c
===================================================================
--- trunk/besclient/bes.c 2009-01-12 10:27:26 UTC (rev 63)
+++ trunk/besclient/bes.c 2009-01-12 10:48:08 UTC (rev 64)
@@ -3,7 +3,7 @@
*
* Client library of the OGSA Basic Execution Services
*
- * Copyright (C) 2006-2008, Platform Computing Corporation. All Rights Reserved.
+ * Copyright (C) 2006-2009, Platform Computing Corporation. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Modified: trunk/besclient/bes.h
===================================================================
--- trunk/besclient/bes.h 2009-01-12 10:27:26 UTC (rev 63)
+++ trunk/besclient/bes.h 2009-01-12 10:48:08 UTC (rev 64)
@@ -3,7 +3,7 @@
*
* Header file of BES++ client library
*
- * Copyright (C) 2006-2008, Platform Computing Corporation. All Rights Reserved.
+ * Copyright (C) 2006-2009, Platform Computing Corporation. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Modified: trunk/besclient/besclient.c
===================================================================
--- trunk/besclient/besclient.c 2009-01-12 10:27:26 UTC (rev 63)
+++ trunk/besclient/besclient.c 2009-01-12 10:48:08 UTC (rev 64)
@@ -3,7 +3,7 @@
*
* Client implementation of the OGSA Basic Execution Services
*
- * Copyright (C) 2006-2008, Platform Computing Corporation. All Rights Reserved.
+ * Copyright (C) 2006-2009, Platform Computing Corporation. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Modified: trunk/besclient/jsdl.c
===================================================================
--- trunk/besclient/jsdl.c 2009-01-12 10:27:26 UTC (rev 63)
+++ trunk/besclient/jsdl.c 2009-01-12 10:48:08 UTC (rev 64)
@@ -1,7 +1,7 @@
/* ----------------------------------------------------------------
* jsdl.c
*
- * Copyright (C) 2006-2007, Platform Computing Corporation. All Rights Reserved.
+ * Copyright (C) 2006-2009, Platform Computing Corporation. All Rights Reserved.
*
*
* Client library of the OGSA Basic Execution Services
Modified: trunk/besclient/jsdl.h
===================================================================
--- trunk/besclient/jsdl.h 2009-01-12 10:27:26 UTC (rev 63)
+++ trunk/besclient/jsdl.h 2009-01-12 10:48:08 UTC (rev 64)
@@ -3,7 +3,7 @@
*
* Header file of BES++ client library
*
- * Copyright (C) 2006-2008, Platform Computing Corporation. All Rights Reserved.
+ * Copyright (C) 2006-2009, Platform Computing Corporation. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Modified: trunk/besclient/namespaces.h
===================================================================
--- trunk/besclient/namespaces.h 2009-01-12 10:27:26 UTC (rev 63)
+++ trunk/besclient/namespaces.h 2009-01-12 10:48:08 UTC (rev 64)
@@ -3,7 +3,7 @@
*
* Header file of BES++ client library
*
- * Copyright (C) 2006-2008, Platform Computing Corporation. All Rights Reserved.
+ * Copyright (C) 2006-2009, Platform Computing Corporation. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Modified: trunk/besserver/auth.c
===================================================================
--- trunk/besserver/auth.c 2009-01-12 10:27:26 UTC (rev 63)
+++ trunk/besserver/auth.c 2009-01-12 10:48:08 UTC (rev 64)
@@ -1,3 +1,26 @@
+/* ----------------------------------------------------------------
+ * auth.c
+ *
+ * Copyright (C) 2006-2009, Platform Computing Corporation. All Rights Reserved.
+ *
+ *
+ * This file is part of BESserver.
+ *
+ * BESserver is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
#include "../config.h"
#ifdef MACOSX
Modified: trunk/besserver/auth.h
===================================================================
--- trunk/besserver/auth.h 2009-01-12 10:27:26 UTC (rev 63)
+++ trunk/besserver/auth.h 2009-01-12 10:48:08 UTC (rev 64)
@@ -1,7 +1,7 @@
/* ----------------------------------------------------------------
* auth.h
*
- * Copyright (C) 2006-2007, Platform Computing Corporation. All Rights Reserved.
+ * Copyright (C) 2006-2009, Platform Computing Corporation. All Rights Reserved.
*
*
* This file is part of BESserver.
Modified: trunk/besserver/besserver.c
===================================================================
--- trunk/besserver/besserver.c 2009-01-12 10:27:26 UTC (rev 63)
+++ trunk/besserver/besserver.c 2009-01-12 10:48:08 UTC (rev 64)
@@ -3,7 +3,7 @@
*
* Server implementation of the OGSA Basic Execution Services
*
- * Copyright (C) 2006-2007, Platform Computing Corporation. All Rights Reserved.
+ * Copyright (C) 2006-2009, Platform Computing Corporation. All Rights Reserved.
*
*
* This file is part of BESserver.
Modified: trunk/besserver/faults.c
===================================================================
--- trunk/besserver/faults.c 2009-01-12 10:27:26 UTC (rev 63)
+++ trunk/besserver/faults.c 2009-01-12 10:48:08 UTC (rev 64)
@@ -1,7 +1,7 @@
/* ----------------------------------------------------------------
* faults.c
*
- * Copyright (C) 2006-2007, Platform Computing Corporation. All Rights Reserved.
+ * Copyright (C) 2006-2009, Platform Computing Corporation. All Rights Reserved.
*
*
* This file is part of BESserver.
Modified: trunk/besserver/faults.h
===================================================================
--- trunk/besserver/faults.h 2009-01-12 10:27:26 UTC (rev 63)
+++ trunk/besserver/faults.h 2009-01-12 10:48:08 UTC (rev 64)
@@ -1,7 +1,7 @@
/* ----------------------------------------------------------------
* faults.h
*
- * Copyright (C) 2006-2007, Platform Computing Corporation. All Rights Reserved.
+ * Copyright (C) 2006-2009, Platform Computing Corporation. All Rights Reserved.
*
*
* This file is part of BESserver.
Modified: trunk/besserver/job.c
===================================================================
--- trunk/besserver/job.c 2009-01-12 10:27:26 UTC (rev 63)
+++ trunk/besserver/job.c 2009-01-12 10:48:08 UTC (rev 64)
@@ -1,7 +1,7 @@
/* ----------------------------------------------------------------
* job.c
*
- * Copyright (C) 2006-2007, Platform Computing Corporation. All Rights Reserved.
+ * Copyright (C) 2006-2009, Platform Computing Corporation. All Rights Reserved.
*
*
* This file is part of BESserver.
Modified: trunk/besserver/job.h
===================================================================
--- trunk/besserver/job.h 2009-01-12 10:27:26 UTC (rev 63)
+++ trunk/besserver/job.h 2009-01-12 10:48:08 UTC (rev 64)
@@ -1,7 +1,7 @@
/* ----------------------------------------------------------------
* job.h
*
- * Copyright (C) 2006-2007, Platform Computing Corporation. All Rights Reserved.
+ * Copyright (C) 2006-2009, Platform Computing Corporation. All Rights Reserved.
*
*
* This file is part of BESserver.
Modified: trunk/besserver/namespaces.h
===================================================================
--- trunk/besserver/namespaces.h 2009-01-12 10:27:26 UTC (rev 63)
+++ trunk/besserver/namespaces.h 2009-01-12 10:48:08 UTC (rev 64)
@@ -1,7 +1,7 @@
/* ----------------------------------------------------------------
* namespaces.h
*
- * Copyright (C) 2006-2007, Platform Computing Corporation. All Rights Reserved.
+ * Copyright (C) 2006-2009, Platform Computing Corporation. All Rights Reserved.
*
*
* This file is part of BESserver.
Modified: trunk/besserver/rm.h
===================================================================
--- trunk/besserver/rm.h 2009-01-12 10:27:26 UTC (rev 63)
+++ trunk/besserver/rm.h 2009-01-12 10:48:08 UTC (rev 64)
@@ -1,3 +1,26 @@
+/* ----------------------------------------------------------------
+ * rm.h
+ *
+ * Copyright (C) 2006-2009, Platform Computing Corporation. All Rights Reserved.
+ *
+ *
+ * This file is part of BESserver.
+ *
+ * BESserver is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
#ifndef _RM_H
#define _RM_H
Modified: trunk/besserver/rm_lsf.c
===================================================================
--- trunk/besserver/rm_lsf.c 2009-01-12 10:27:26 UTC (rev 63)
+++ trunk/besserver/rm_lsf.c 2009-01-12 10:48:08 UTC (rev 64)
@@ -1,3 +1,26 @@
+/* ----------------------------------------------------------------
+ * rm_lsf.c
+ *
+ * Copyright (C) 2006-2009, Platform Computing Corporation. All Rights Reserved.
+ *
+ *
+ * This file is part of BESserver.
+ *
+ * BESserver is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
Modified: trunk/config.h
===================================================================
--- trunk/config.h 2009-01-12 10:27:26 UTC (rev 63)
+++ trunk/config.h 2009-01-12 10:48:08 UTC (rev 64)
@@ -8,10 +8,10 @@
/* You probably don't need to change these. */
/* Setting the VERSION_STRING macro determines what is output */
/* when using the -V option to besclient and besserver */
-#define VERSION_STRING "BES++ 1.0.1, 2008-04-09"
+#define VERSION_STRING "BES++ 1.1.0, 2009-01-12"
/* Don't change this one */
-#define COPYRIGHT "Copyright (C) 2006-2008 Platform Computing Corporation"
+#define COPYRIGHT "Copyright (C) 2006-2009 Platform Computing Corporation"
#endif /* _CONFIG_H */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ark...@us...> - 2009-09-02 16:48:02
|
Revision: 73
http://bespp.svn.sourceforge.net/bespp/?rev=73&view=rev
Author: arkaitzr
Date: 2009-09-02 16:47:49 +0000 (Wed, 02 Sep 2009)
Log Message:
-----------
Added variables from compilation of PBS and SGE
Modified Paths:
--------------
trunk/Make.config
trunk/README.txt
trunk/config.h
Modified: trunk/Make.config
===================================================================
--- trunk/Make.config 2009-09-02 16:37:28 UTC (rev 72)
+++ trunk/Make.config 2009-09-02 16:47:49 UTC (rev 73)
@@ -4,19 +4,16 @@
# You must set this to the location of your compiled gSOAP
# source distribution. This directory will contain the
# 'import', 'plugin', 'src' and 'wsdl' sub-directories.
-GSOAP_TOP = /home/csmith/src/gsoap-2.7/gsoap
+GSOAP_TOP = /home/ar5je/centurion/gsoap/gsoap
#
# Which resource manager back end to use. Also need to set the
# locations of resource manager specific includes and libraries
#
-RM = rm_lsf
-#RM = rm_pbs
+#RM = rm_lsf
+RM = rm_pbs
#RM = rm_sge
-RM_INC = $(LSF_INC)
-RM_LIBS = $(LSF_LIBS)
-
#
# LSF related variables
#
@@ -35,6 +32,17 @@
LSF_LIBS = $(LSF_LIB)/libbat.a $(LSF_LIB)/liblsf.a
#
+# PBS related variables
+#
+# PBS_LOC is where the 'include' and 'lib'
+# directories are located.
+PBS_LOC = /usr/pbs
+PBS_INC = -I$(PBS_LOC)/include
+PBS_LIB = $(PBS_LOC)/lib
+PBS_LIBS = -L $(PBS_LIB) -lpbs
+
+
+#
# Any extra include and lib directories, or libraries
#
# -lnsl needed for Linux systems
@@ -43,3 +51,16 @@
#EXTRA_LIB = -L/usr/local/lib
EXTRA_LIBS = -lnsl
+ifeq ($(RM),rm_lsf)
+ RM_INC = $(LSF_INC)
+ RM_LIBS = $(LSF_LIBS)
+endif
+ifeq ($(RM),rm_pbs)
+ RM_INC = $(PBS_INC)
+ RM_LIBS = $(PBS_LIBS)
+endif
+ifeq ($(RM),rm_sge)
+ RM_INC = $(SGE_INC)
+ RM_LIBS = $(SGE_LIBS)
+endif
+
Modified: trunk/README.txt
===================================================================
--- trunk/README.txt 2009-09-02 16:37:28 UTC (rev 72)
+++ trunk/README.txt 2009-09-02 16:47:49 UTC (rev 73)
@@ -34,9 +34,11 @@
may vary with other versions. Before building BES++, make sure and
compile the gSOAP distribution (you don't actually need to install it).
-Currently BES++ only supports the Platform LSF resource manager. Make
-sure that LSF is installed on the machine on which you are building the
-BES++ code, as you will need access to the LSF header files and libraries.
+Currently BES++ supports the Platform LSF resource manager, the Portable
+Batch System and the Sun Grid Engine. Make sure that LSF or PBS are
+installed on the machine on which you are building the BES++ code, as
+you will need access to the header files and libraries. This is not
+necessary for SGE.
Building the software
---------------------
@@ -54,7 +56,9 @@
building on. If you are not sure which architecture to use, and
your environment is already setup to use LSF, you can run a
command like 'which lsid' to see which architecture specific
- directory is appropriate for your machine.
+ directory is appropriate for your machine.
+ For PBS, the process is similar. For SGE, there are no variables
+ to adjust except for RM.
c) If you need to set any extra paths to headers files or
libraries, use the EXTRA_* macros.
@@ -63,12 +67,20 @@
in the besclient sub-directory, and a besserver binary in the
besserver sub-directory.
+4. In order to interact with PBS and SGE, a Python installation is
+ required with the pexpect module (http://sourceforge.net/projects/pexpect/).
+ This module can be downloaded and copied to the besserver/scripts
+ subdirectory.
+
Installing the software
-----------------------
-You can copy the besclient and besserver binaries wherever you wish
-as they have no components which are required to be in any particular
-directory.
+If used with an LSF resource manager, you can copy the besclient and
+besserver binaries wherever you wish as they have no components which
+are required to be in any particular directory. For PBS and SGE, however
+it is necessary that besserver can execute the Python scripts which are
+located under the besserver/scripts subdirectory. The location for these
+scripts is defined in config.h.
If you would like to support the use of user name and password authentication
using PAM, you will need to create a PAM configuration file and install
@@ -87,8 +99,8 @@
=====================
Note: in order to run the besserver, it must be able to connect to
-your LSF environment. The besserver can be run on any node in the LSF
-cluster (including a client-only machine). Make sure and have the LSF
+your LSF/PBS/SGE environment. The besserver can be run on any node in the
+cluster (including a client-only machine). Make sure and have the
environment variables properly initialized before starting the besserver.
This can be easily accomplished with a shell script wrapper. There is
a sample wrapper in the besserver/samples sub-directory.
Modified: trunk/config.h
===================================================================
--- trunk/config.h 2009-09-02 16:37:28 UTC (rev 72)
+++ trunk/config.h 2009-09-02 16:47:49 UTC (rev 73)
@@ -1,6 +1,9 @@
#ifndef _CONFIG_H
/* You can set project global definitions and includes here */
+#define BESSERVER_TOP "/home/ar5je/bes++project/trunk/besserver"
+#define QSUB "/usr/pbs/bin/qsub"
+#define QSUBEXEC "qsub"
/* Uncomment the next line if you are building on Mac OS X */
/* #define MACOSX */
@@ -9,6 +12,10 @@
/* Setting the VERSION_STRING macro determines what is output */
/* when using the -V option to besclient and besserver */
#define VERSION_STRING "BES++ 1.1.0, 2009-01-12"
+#define STAGE_SCRIPT BESSERVER_TOP "/scripts/stage.py"
+#define CRED_SCRIPT BESSERVER_TOP "/scripts/cred.py"
+#define PBS_SCRIPT BESSERVER_TOP "/scripts/pbs.py"
+#define SGE_SCRIPT BESSERVER_TOP "/scripts/sge.py"
/* Don't change this one */
#define COPYRIGHT "Copyright (C) 2006-2009 Platform Computing Corporation"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cs...@us...> - 2009-09-11 16:44:48
|
Revision: 74
http://bespp.svn.sourceforge.net/bespp/?rev=74&view=rev
Author: csmith
Date: 2009-09-11 16:44:40 +0000 (Fri, 11 Sep 2009)
Log Message:
-----------
- added support for Lava resource manager
Modified Paths:
--------------
trunk/Make.config
trunk/besserver/Makefile
Added Paths:
-----------
trunk/besserver/rm_lava.c
Modified: trunk/Make.config
===================================================================
--- trunk/Make.config 2009-09-02 16:47:49 UTC (rev 73)
+++ trunk/Make.config 2009-09-11 16:44:40 UTC (rev 74)
@@ -4,14 +4,15 @@
# You must set this to the location of your compiled gSOAP
# source distribution. This directory will contain the
# 'import', 'plugin', 'src' and 'wsdl' sub-directories.
-GSOAP_TOP = /home/ar5je/centurion/gsoap/gsoap
+GSOAP_TOP = /home/csmith/src/gsoap-2.7/gsoap
#
# Which resource manager back end to use. Also need to set the
# locations of resource manager specific includes and libraries
#
-#RM = rm_lsf
-RM = rm_pbs
+RM = rm_lsf
+#RM = rm_lava
+#RM = rm_pbs
#RM = rm_sge
#
@@ -19,7 +20,9 @@
#
# LSF_LOC is where the 'include' and architecture specific
# directories are located.
-LSF_LOC = /usr/local/lsf/7.0
+LSF_LOC = /cluster/apps/lsf/7.0
+# for lava
+#LSF_LOC = /usr
# Set to the appropriate architecture name depending on
# the machine you are building BES++ on.
LSF_ARCH = linux2.6-glibc2.3-x86_64
@@ -27,9 +30,13 @@
#LSF_ARCH = macosx
LSF_INC = -I$(LSF_LOC)/include
LSF_LIB = $(LSF_LOC)/$(LSF_ARCH)/lib
+# for lava
+#LSF_LIB = $(LSF_LOC)/lib
# need to uncomment only one of the following
#LSF_LIBS = -L$(LSF_LIB) -lbat -llsf
LSF_LIBS = $(LSF_LIB)/libbat.a $(LSF_LIB)/liblsf.a
+# for lava
+#LSF_LIBS = $(LSF_LIB)/liblsfbat.a $(LSF_LIB)/liblsf.a
#
# PBS related variables
Modified: trunk/besserver/Makefile
===================================================================
--- trunk/besserver/Makefile 2009-09-02 16:47:49 UTC (rev 73)
+++ trunk/besserver/Makefile 2009-09-11 16:44:40 UTC (rev 74)
@@ -20,6 +20,8 @@
BES_H_FILES = job.h namespaces.h faults.h auth.h rm.h
ifneq ($(RM),rm_lsf)
BES_OBJ = besserver.o job.o faults.o auth.o $(RM).o rm_util.o
+else ifneq ($(RM),rm_lava)
+ BES_OBJ = besserver.o job.o faults.o auth.o $(RM).o rm_util.o
else
BES_OBJ = besserver.o job.o faults.o auth.o $(RM).o
endif
@@ -49,6 +51,9 @@
ifneq ($(RM),rm_lsf)
rm_util.o: rm_util.c
endif
+ifneq ($(RM),rm_lava)
+ rm_util.o: rm_util.c
+endif
stdsoap2.o: $(GSOAP_TOP)/stdsoap2.c
$(CC) $(CFLAGS) -c $(GSOAP_TOP)/stdsoap2.c
Added: trunk/besserver/rm_lava.c
===================================================================
--- trunk/besserver/rm_lava.c (rev 0)
+++ trunk/besserver/rm_lava.c 2009-09-11 16:44:40 UTC (rev 74)
@@ -0,0 +1,816 @@
+/* ----------------------------------------------------------------
+ * rm_lava.c
+ *
+ * Copyright (C) 2006-2009, Platform Computing Corporation. All Rights Reserved.
+ *
+ *
+ * This file is part of BESserver.
+ *
+ * BESserver is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+#include <stdlib.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <pwd.h>
+
+#include <lsf/lsf.h>
+#include <lsf/lsbatch.h>
+
+#include "rm.h"
+
+
+int
+rm_initialize(struct soap *s, char *servername)
+{
+ if (lsb_init("besserver")) {
+ lsb_perror("rm_initialize: lsb_init");
+ return -1;
+ }
+ return 0;
+}
+
+static int
+createJobWrapperScript(struct jobcard *jc, char *osuser, char *scriptname, int namelen)
+{
+ static char fname[] = "createJobWrapperScript";
+ char wrappername[MAXPATHLEN];
+ FILE *wrapper;
+ int fd, i;
+ struct passwd *pw;
+ uid_t service_uid;
+ struct fileStage *file;
+ char *cp;
+
+ if (!jc || !osuser || !scriptname) {
+ return BESE_OTHER;
+ }
+
+ if ((pw = getpwnam(osuser)) == NULL) {
+ fprintf(stderr, "%s: couldn't get user %s from passwd\n", fname, osuser);
+ return BESE_BAD_ARG;
+ }
+
+ service_uid = geteuid();
+
+ if (seteuid(0)) {
+ perror("createJobWrapperScript: seteuid 0 (1)");
+ return BESE_SYS_ERR;
+ }
+
+ if (seteuid(pw->pw_uid)) {
+ perror("createJobWrapperScript: seteuid user");
+ return BESE_SYS_ERR;
+ }
+
+ if (strlen(pw->pw_dir) + strlen("/jobscript.XXXXXX") + 1 > MAXPATHLEN) {
+ fprintf(stderr, "%s: cannot generate wrapper script: path too long\n", fname);
+ return BESE_SYS_ERR;
+ }
+
+ sprintf(wrappername, "%s/jobscript.XXXXXX", pw->pw_dir);
+ fd = mkstemp(wrappername);
+ if (fd == -1) {
+ perror("createJobWrapperScript: mkstemp");
+ return BESE_SYS_ERR;
+ }
+
+ if (fchmod(fd, S_IRWXU)) {
+ perror("createJobWrapperScript: fchmod");
+ unlink(wrappername);
+ return BESE_SYS_ERR;
+ }
+
+ wrapper = fdopen(fd, "w");
+ if (wrapper == NULL) {
+ perror("createJobWrapperScript: fdopen");
+ unlink(wrappername);
+ return BESE_SYS_ERR;
+ }
+
+ fprintf(wrapper, "#!/bin/sh\n");
+
+ file = jc->files;
+ while (file) {
+ if (file->source) {
+ cp = strstr(file->source, "ftp://");
+ if (!cp) {
+ fprintf(stderr, "%s: malformed source URI for file transfer %s\n", fname, file->source);
+ fprintf(stderr, "%s: only support ftp URIs at this time\n", fname);
+ unlink(wrappername);
+ return BESE_OTHER;
+ }
+ cp = cp + strlen("ftp://");
+
+ fprintf(wrapper, "%s -o %s ftp://", FTP_PROGRAM, file->filename);
+ if (file->credential) {
+ fprintf(wrapper, "%s:%s@", file->credential->username, file->credential->password);
+ }
+ fprintf(wrapper, "%s\n", cp);
+ }
+ file = file->next;
+ }
+
+ if (jc->executable) {
+ fprintf(wrapper, "%s", jc->executable);
+ }
+ for (i = 0; i < jc->num_args; i++) {
+ fprintf(wrapper, " %s", jc->args[i]);
+ }
+ fprintf(wrapper, "\n");
+
+ fprintf(wrapper, "rc=$?\n");
+
+ file = jc->files;
+ while (file) {
+ if (file->target) {
+ cp = strstr(file->target, "ftp://");
+ if (!cp) {
+ fprintf(stderr, "%s: malformed target URI for file transfer %s\n", fname, file->target);
+ fprintf(stderr, "%s: only support ftp URIs at this time\n", fname);
+ unlink(wrappername);
+ return BESE_OTHER;
+ }
+ cp = cp + strlen("ftp://");
+
+ fprintf(wrapper, "%s -u ftp://", FTP_PROGRAM);
+ if (file->credential) {
+ fprintf(wrapper, "%s:%s@", file->credential->username, file->credential->password);
+ }
+ fprintf(wrapper, "%s %s\n", cp, file->filename);
+ }
+ file = file->next;
+ }
+
+ fprintf(wrapper, "rm $0\n");
+
+ fprintf(wrapper, "exit $rc\n");
+
+ fclose(wrapper);
+
+ if (seteuid(0)) {
+ perror("createJobWrapperScript: seteuid 0 (2)");
+ unlink(wrappername);
+ return BESE_SYS_ERR;
+ }
+
+ if (seteuid(service_uid)) {
+ perror("createJobWrapperScript: seteuid service_uid");
+ unlink(wrappername);
+ return BESE_SYS_ERR;
+ }
+
+ strncpy(scriptname, wrappername, namelen-1);
+
+ return BESE_OK;
+}
+
+static int
+runBsubScriptAsUser(char *scriptname, char *user)
+{
+ static char fname[] = "runBsubScriptAsUser";
+ FILE *fp;
+ pid_t pid;
+ int pfd[2], jobid = 0;
+ struct passwd *pw;
+ char *arg0, buf[512];
+
+ if (!scriptname || !user) {
+ return -1;
+ }
+
+ if ((pw = getpwnam(user)) == NULL) {
+ fprintf(stderr, "%s: couldn't get user %s from passwd\n", fname, user);
+ return -1;
+ }
+
+ if (pipe(pfd) < 0) {
+ perror("runBsubScriptAsUser: pipe");
+ return -1;
+ }
+
+ if ((pid = fork()) < 0) {
+ perror("runBsubScriptAsUser: fork");
+ return -1;
+ }
+
+ if (pid == 0) {
+ /* child process */
+ close(pfd[0]);
+ if (pfd[1] != STDOUT_FILENO) {
+ if (dup2(pfd[1], STDOUT_FILENO) != STDOUT_FILENO) {
+ perror("runBsubScriptAsUser (child): dup2");
+ _exit(1);
+ }
+ close(pfd[1]);
+ }
+ if (seteuid(0)) {
+ perror("runBsubScriptAsUser (child): seteuid 0");
+ _exit(1);
+ }
+ if (setgid(pw->pw_gid)) {
+ perror("runBsubScriptAsUser (child): setgid");
+ _exit(1);
+ }
+ if (setuid(pw->pw_uid)) {
+ perror("runBsubScriptAsUser (child): setuid");
+ _exit(1);
+ }
+ arg0 = strrchr(scriptname, '/');
+ if (arg0) arg0++;
+ execl(scriptname, arg0, NULL);
+ perror("runBsubScriptAsUser (child): execl");
+ _exit(1);
+ }
+
+ /* In the parent */
+ close(pfd[1]);
+ fp = fdopen(pfd[0], "r");
+ if (fp == NULL) {
+ perror("runBsubScriptAsUser: fdopen");
+ }
+ while (fgets(buf, 512, fp)) {
+ sscanf(buf, "Job <%d> is submitted to default queue <%*s>.\n", &jobid);
+ }
+ fclose(fp);
+
+ if (waitpid(pid, NULL, 0) < 0) {
+ perror("runBsubScriptAsUser: waitpid");
+ return -1;
+ }
+
+ return jobid;
+}
+
+int
+rm_submitJob(struct soap *s, struct jobcard *jc,
+ char *osuser, char **return_jobid)
+{
+ static char fname[] = "rm_submitJob";
+ char scriptname[MAXPATHLEN], wrappername[MAXPATHLEN];
+ char buf[512];
+ int fd, i, rc, jobid = 0, rr = 0;
+ FILE *script;
+ struct envvar *cur;
+
+ fprintf(stderr, "In rm_submitJob...\n");
+
+ if (!jc || !jc->executable) {
+ fprintf(stderr, "%s: Need to have the executable name\n", fname);
+ return BESE_OTHER;
+ }
+ if (!osuser) {
+ fprintf(stderr, "%s: Need to have the os user\n", fname);
+ return BESE_OTHER;
+ }
+
+ strcpy(scriptname, "/tmp/besserver.XXXXXX");
+ fd = mkstemp(scriptname);
+ if (fd == -1) {
+ perror("rm_submitJob: mkstemp");
+ return BESE_OTHER;
+ }
+ script = fdopen(fd, "w");
+ if (script == NULL) {
+ perror("rm_submitJob: fdopen");
+ return BESE_OTHER;
+ }
+
+ fprintf(script, "#!/bin/sh\n");
+ if (jc->wd)
+ fprintf(script, "LSB_JOB_LONG_CWD=%s; export LSB_JOB_LONG_CWD\n",
+ jc->wd);
+ for (cur = jc->environment; cur; cur = cur->next) {
+ fprintf(script, "%s=%s; export %s\n", cur->name, cur->val, cur->name);
+ }
+ fprintf(script, "bsub ");
+ if (jc->appname) {
+ fprintf(script, "-a %s ", jc->appname);
+ if (LSF_VERSION >= 17) {
+ fprintf(script, "-app %s ", jc->appname);
+ }
+ }
+ if (jc->jobname)
+ fprintf(script, "-J %s ", jc->jobname);
+ if (jc->jobproject)
+ fprintf(script, "-P %s ", jc->jobproject);
+ if (jc->num_hostnames) {
+ fprintf(script, "-m \"");
+ for (i = 0; i < jc->num_hostnames; i++)
+ fprintf(script, "%s ", jc->hostnames[i]);
+ fprintf(script, "\" ");
+ }
+ if (jc->exclusive)
+ fprintf(script, "-x ");
+ if (jc->tcpu)
+ fprintf(script, "-n %d ", jc->tcpu);
+ if (jc->input)
+ fprintf(script, "-i %s ", jc->input);
+ if (jc->output)
+ fprintf(script, "-o %s ", jc->output);
+ if (jc->error)
+ fprintf(script, "-e %s ", jc->error);
+ if (jc->osname) {
+ if (!rr) {
+ fprintf(script, "-R \"");
+ rr = 1;
+ } else {
+ fprintf(script, " && ");
+ }
+ fprintf(script, "osname == %s", jc->osname);
+ }
+ if (jc->osver) {
+ if (!rr) {
+ fprintf(script, "-R \"");
+ rr = 1;
+ } else {
+ fprintf(script, " && ");
+ }
+ fprintf(script, "osver == %s", jc->osver);
+ }
+ if (jc->cpuarch) {
+ if (!rr) {
+ fprintf(script, "-R \"");
+ rr = 1;
+ } else {
+ fprintf(script, " && ");
+ }
+ fprintf(script, "cpuarch == %s", jc->cpuarch);
+ }
+ if (rr) {
+ fprintf(script, "\" ");
+ }
+
+ if ((rc = createJobWrapperScript(jc, osuser, wrappername, MAXPATHLEN)) != BESE_OK) {
+ fclose(script);
+ unlink(scriptname);
+ return rc;
+ }
+
+ fprintf(script, "%s\n", wrappername);
+
+ fclose(script);
+
+ if (chmod(scriptname, S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH)) {
+ perror("submitLSFJob: chmod");
+ unlink(wrappername);
+ unlink(scriptname);
+ return BESE_OTHER;
+ }
+
+ jobid = runBsubScriptAsUser(scriptname, osuser);
+
+ unlink(scriptname);
+
+ if (jobid < 1) {
+ return BESE_OTHER;
+ }
+
+ sprintf(buf, "%ld", jobid);
+ *return_jobid = soap_strdup(s, buf);
+ if (!*return_jobid) {
+ return BESE_MEM_ALLOC;
+ }
+
+ return BESE_OK;
+}
+
+int
+rm_terminateJob(struct soap *s, char *job_id, char *osuser)
+{
+ static char fname[] = "rm_terminateJob";
+ struct passwd *pw;
+ pid_t pid;
+ int pfd[2], lsb_rc = LSBE_NO_ERROR;
+ LS_LONG_INT jobid;
+
+ if (!job_id) {
+ fprintf(stderr, "%s: missing job id\n", fname);
+ return BESE_BAD_ARG;
+ }
+ jobid = strtol(job_id, NULL, 0);
+ if (errno == ERANGE || errno == EINVAL) {
+ fprintf(stderr, "%s: job id should be an integer\n", fname);
+ return BESE_BAD_ARG;
+ }
+
+ if (!osuser) {
+ fprintf(stderr, "%s: need to provide os user\n", fname);
+ return BESE_BAD_ARG;
+ }
+
+ if ((pw = getpwnam(osuser)) == NULL) {
+ fprintf(stderr, "%s: couldn't get user %s from passwd\n", fname, osuser);
+ return BESE_SYS_ERR;
+ }
+
+ if (pipe(pfd) < 0) {
+ perror("rm_terminateJob: pipe");
+ return BESE_SYS_ERR;
+ }
+
+ if ((pid = fork()) < 0) {
+ perror("rm_terminateJob: fork");
+ return BESE_SYS_ERR;
+ }
+
+ if (pid == 0) {
+ /* child process */
+ close(pfd[0]);
+
+ if (seteuid(0)) {
+ perror("rm_terminateJob (child): seteuid 0");
+ _exit(1);
+ }
+ if (setgid(pw->pw_gid)) {
+ perror("rm_terminateJob (child): setgid");
+ _exit(1);
+ }
+ if (setuid(pw->pw_uid)) {
+ perror("rm_terminateJob (child): setuid");
+ _exit(1);
+ }
+
+ if (lsb_signaljob(jobid, SIGKILL)) {
+ lsb_perror("rm_terminateJob (child)");
+ lsb_rc = lsberrno;
+ }
+
+ if (write(pfd[1], (void*)&lsb_rc, sizeof(lsb_rc)) != sizeof(lsb_rc)) {
+ perror("rm_terminateJob (child): write");
+ _exit(1);
+ }
+ _exit(0);
+ }
+
+ /* In the parent */
+ close(pfd[1]);
+ if (read(pfd[0], (void*)&lsb_rc, sizeof(lsb_rc)) != sizeof(lsb_rc)) {
+ perror("rm_terminateJob: read");
+ lsb_rc = -1;
+ }
+ close(pfd[0]);
+
+ if (waitpid(pid, NULL, 0) < 0) {
+ perror("rm_terminateJob: waitpid");
+ return BESE_SYS_ERR;
+ }
+
+ switch (lsb_rc) {
+ case -1:
+ return BESE_SYS_ERR;
+ break;
+ case LSBE_NO_ERROR:
+ return BESE_OK;
+ break;
+ case LSBE_PERMISSION:
+ return BESE_PERMISSION;
+ break;
+ case LSBE_NO_JOB:
+ return BESE_NO_ACTIVITY;
+ break;
+ default:
+ return BESE_BACKEND;
+ }
+}
+
+int
+rm_getJobStatus(struct soap *s, char *job_id, char *osuser,
+ struct bes__ActivityStatusType **job_status)
+{
+ struct jobInfoEnt *job;
+ struct bes__ActivityStatusType *status;
+ int rc;
+ LS_LONG_INT jobid;
+
+ if (!job_id || !job_status) {
+ return BESE_BAD_ARG;
+ }
+ jobid = strtol(job_id, NULL, 0);
+ if (errno == ERANGE || errno == EINVAL) {
+ fprintf(stderr, "rm_getJobStatus: job id should be an integer\n");
+ return BESE_BAD_ARG;
+ }
+
+ rc = lsb_openjobinfo(jobid, NULL, "all", NULL, NULL, ALL_JOB);
+ if (rc == -1) {
+ if (lsberrno == LSBE_NO_JOB) {
+ return BESE_NO_ACTIVITY;
+ }
+ lsb_perror("rm_getJobStatus: lsb_openjobinfo");
+ return BESE_BACKEND;
+ }
+
+ job = lsb_readjobinfo(NULL);
+ if (job == NULL) {
+ lsb_perror("rm_getJobStatus: lsb_readjobinfo");
+ lsb_closejobinfo();
+ return BESE_BACKEND;
+ }
+
+ status = (struct bes__ActivityStatusType*)soap_malloc(s, sizeof(struct bes__ActivityStatusType));
+ if (status == NULL) {
+ return BESE_MEM_ALLOC;
+ }
+ memset(status, 0, sizeof(struct bes__ActivityStatusType));
+
+ if (IS_PEND(job->status)) {
+ status->state = Pending;
+ }
+ else if (IS_START(job->status)) {
+ status->state = Running;
+ }
+ else if (IS_FINISH(job->status)) {
+ status->state = Finished;
+ }
+
+ lsb_closejobinfo();
+
+ *job_status = status;
+
+ return BESE_OK;
+}
+
+int
+rm_getJobInfo(struct soap *s, char *job_id, char *osuser, struct jobcard **job_info)
+{
+ struct jobInfoEnt *job;
+ struct jobcard *jc;
+ char *command, *cp, **cpp;
+ int rc, i;
+ LS_LONG_INT jobid;
+
+ if (!job_id || !job_info) {
+ return BESE_BAD_ARG;
+ }
+ jobid = strtol(job_id, NULL, 0);
+ if (errno == ERANGE || errno == EINVAL) {
+ fprintf(stderr, "rm_getJobInfo: job id should be an integer\n");
+ return BESE_BAD_ARG;
+ }
+
+ rc = lsb_openjobinfo(jobid, NULL, "all", NULL, NULL, ALL_JOB);
+ if (rc == -1) {
+ if (lsberrno == LSBE_NO_JOB) {
+ return BESE_NO_ACTIVITY;
+ }
+ lsb_perror("rm_getJobInfo: lsb_openjobinfo");
+ return BESE_BACKEND;
+ }
+
+ job = lsb_readjobinfo(NULL);
+ if (job == NULL) {
+ lsb_perror("rm_getJobInfo: lsb_readjobinfo");
+ lsb_closejobinfo();
+ return BESE_BACKEND;
+ }
+
+ jc = (struct jobcard*)soap_malloc(s, sizeof(struct jobcard));
+ if (jc == NULL) {
+ return BESE_MEM_ALLOC;
+ }
+ memset(jc, 0, sizeof(struct jobcard));
+
+ if (job->submit.jobName) {
+ jc->jobname = soap_strdup(s, job->submit.jobName);
+ }
+ if (job->submit.projectName) {
+ jc->jobproject = soap_strdup(s, job->submit.projectName);
+ }
+ if (job->numExHosts) {
+ jc->num_hostnames = job->numExHosts;
+ jc->hostnames = (char**)soap_malloc(s, sizeof(char*)*job->numExHosts);
+ if (!jc->hostnames) {
+ return BESE_MEM_ALLOC;
+ }
+ for (i = 0; i < job->numExHosts; i++) {
+ jc->hostnames[i] = soap_strdup(s, job->exHosts[i]);
+ }
+ jc->tcpu = job->numExHosts;
+ }
+ if (job->submit.options & SUB_EXCLUSIVE) {
+ jc->exclusive = 1;
+ }
+ if (job->submit.inFile) {
+ jc->input = soap_strdup(s, job->submit.inFile);
+ }
+ if (job->submit.outFile) {
+ jc->output = soap_strdup(s, job->submit.outFile);
+ }
+ if (job->submit.errFile) {
+ jc->error = soap_strdup(s, job->submit.errFile);
+ }
+ if (job->execCwd) {
+ jc->wd = soap_strdup(s, job->execCwd);
+ }
+ if (job->execUsername) {
+ jc->username = soap_strdup(s, job->execUsername);
+ }
+
+ /* first pass copies the command and counts arguments */
+ command = soap_strdup(s, job->submit.command);
+ if (!command) {
+ return BESE_MEM_ALLOC;
+ }
+ cpp = &command;
+ cp = strsep(cpp, " \t");
+ jc->executable = soap_strdup(s, cp);
+ if (!jc->executable) {
+ return BESE_MEM_ALLOC;
+ }
+ while (cp = strsep(cpp, " \t")) {
+ jc->num_args++;
+ }
+
+ /* this second pass copies the arguments */
+ if (jc->num_args) {
+ jc->args = (char**)soap_malloc(s, sizeof(char*)*jc->num_args);
+ if (!jc->args) {
+ return BESE_MEM_ALLOC;
+ }
+ command = soap_strdup(s, job->submit.command);
+ if (!command) {
+ return BESE_MEM_ALLOC;
+ }
+ cpp = &command;
+ cp = strsep(cpp, " \t");
+ i = 0;
+ while (cp = strsep(cpp, " \t")) {
+ jc->args[i++] = soap_strdup(s, cp);
+ }
+ }
+
+ lsb_closejobinfo();
+
+ *job_info = jc;
+
+ return BESE_OK;
+}
+
+int
+rm_getResourceList(struct soap *s, struct rm_filter *filter,
+ struct rm_resource **resourcelist, int *num_resources)
+{
+ struct rm_resource *res, *end, *reslist;
+ struct hostInfo *hinfo;
+ char *cpuarch, *osname, *osver;
+ int numhosts = 0, num_res = 0, i;
+
+ hinfo = ls_gethostinfo(NULL, &numhosts, NULL, 0, 0);
+ if (hinfo == NULL) {
+ fprintf(stderr, "rm_getResourceList: ls_gethostinfo error: %s\n", ls_sysmsg());
+ return BESE_BACKEND;
+ }
+
+ reslist = end = NULL;
+ for (i = 0; i < numhosts; i++) {
+
+ if (hinfo[i].maxCpus == 0) {
+ /* host unavailable at this time */
+ continue;
+ }
+
+ res = (struct rm_resource*)soap_malloc(s, sizeof(struct rm_resource));
+ if (res == NULL) {
+ return BESE_MEM_ALLOC;
+ }
+ memset(res, 0, sizeof(struct rm_resource));
+
+ res->ResourceName = soap_strdup(s, hinfo[i].hostName);
+ if (res->ResourceName == NULL) {
+ return BESE_MEM_ALLOC;
+ }
+
+ res->CPUCount = (double*)soap_malloc(s, sizeof(double));
+ if (res->CPUCount == NULL) {
+ return BESE_MEM_ALLOC;
+ }
+ *res->CPUCount = (double)hinfo[i].maxCpus;
+
+ res->PhysicalMemory = (double*)soap_malloc(s, sizeof(double));
+ if (res->PhysicalMemory == NULL) {
+ return BESE_MEM_ALLOC;
+ }
+ *res->PhysicalMemory = 1024.0*1024.0*(double)hinfo[i].maxMem;
+
+ res->VirtualMemory = (double*)soap_malloc(s, sizeof(double));
+ if (res->VirtualMemory == NULL) {
+ return BESE_MEM_ALLOC;
+ }
+ *res->VirtualMemory = 1024.0*1024.0*(double)hinfo[i].maxSwap;
+
+ if (reslist == NULL) reslist = res;
+ if (end) end->next = res;
+ end = res;
+ num_res++;
+ }
+
+ if (resourcelist) *resourcelist = reslist;
+ if (num_resources) *num_resources = num_res;
+ return BESE_OK;
+}
+
+int
+rm_getJobList(struct soap *s, struct rm_filter *filter, struct rm_job **joblist, int *numjobs)
+{
+ struct rm_job *job, *end, *jlist;
+ struct jobInfoEnt *jinfo;
+ char jobid[128];
+ int num_jobs, i;
+
+ num_jobs = lsb_openjobinfo(0, NULL, "all", NULL, NULL, ALL_JOB);
+ if (num_jobs == -1) {
+ if (lsberrno != LSBE_NO_JOB) {
+ fprintf(stderr, "rm_getJobList: lsb_openjobinfo: %s\n", lsb_sysmsg());
+ return BESE_BACKEND;
+ }
+ else {
+ num_jobs = 0;
+ jlist = NULL;
+ }
+ }
+ jlist = end = NULL;
+ for (i = 0; i < num_jobs; i++) {
+ jinfo = lsb_readjobinfo(NULL);
+ if (jinfo == NULL) {
+ fprintf(stderr, "rm_getJobList: lsb_readjobinfo: %s\n", lsb_sysmsg());
+ lsb_closejobinfo();
+ return BESE_BACKEND;
+ }
+ job = (struct rm_job*)soap_malloc(s, sizeof(struct rm_job));
+ if (job == NULL) {
+ lsb_closejobinfo();
+ return BESE_MEM_ALLOC;
+ }
+ sprintf(jobid, "%ld", jinfo->jobId);
+ job->jobid = soap_strdup(s, jobid);
+ if (job->jobid == NULL) {
+ lsb_closejobinfo();
+ return BESE_MEM_ALLOC;
+ }
+ if (jlist == NULL) jlist = job;
+ if (end) end->next = job;
+ end = job;
+ }
+ lsb_closejobinfo();
+
+ if (joblist) *joblist = jlist;
+ if (numjobs) *numjobs = num_jobs;
+ return BESE_OK;
+}
+
+int
+rm_getClusterInfo(struct soap *s, struct rm_clusterInfo **clusterinfo)
+{
+ struct rm_clusterInfo *cinfo;
+ char *clustername;
+
+ if (!clusterinfo) {
+ return BESE_BAD_ARG;
+ }
+
+ cinfo = (struct rm_clusterInfo*)soap_malloc(s, sizeof(struct rm_clusterInfo));
+ if (cinfo == NULL) {
+ return BESE_MEM_ALLOC;
+ }
+ memset(cinfo, 0, sizeof(struct rm_clusterInfo));
+
+ cinfo->IsAcceptingNewActivities = true_;
+
+ clustername = ls_getclustername();
+ if (clustername == NULL) {
+ fprintf(stderr, "rm_getClusterInfo: ls_getclustername: %s\n", ls_sysmsg());
+ return BESE_BACKEND;
+ }
+ cinfo->CommonName = soap_strdup(s, clustername);
+ if (cinfo->CommonName == NULL) {
+ return BESE_MEM_ALLOC;
+ }
+
+ cinfo->LocalResourceManagerType = (char*)soap_malloc(s,
+ strlen("http://www.platform.com/bes/2006/08/resourcemanager/LSF")
+ + strlen(LAVA_CURRENT_VERSION)+1);
+ if (cinfo->LocalResourceManagerType == NULL) {
+ return BESE_MEM_ALLOC;
+ }
+ sprintf(cinfo->LocalResourceManagerType,
+ "http://www.platform.com/bes/2006/08/resourcemanager/LSF%s",
+ LAVA_CURRENT_VERSION);
+
+ *clusterinfo = cinfo;
+ return BESE_OK;
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cs...@us...> - 2010-02-11 19:01:32
|
Revision: 79
http://bespp.svn.sourceforge.net/bespp/?rev=79&view=rev
Author: csmith
Date: 2010-02-11 19:01:25 +0000 (Thu, 11 Feb 2010)
Log Message:
-----------
- pass extra parameters to compiler/linker
Modified Paths:
--------------
trunk/Make.config
trunk/besclient/Makefile
trunk/besserver/Makefile
Modified: trunk/Make.config
===================================================================
--- trunk/Make.config 2010-02-10 20:38:51 UTC (rev 78)
+++ trunk/Make.config 2010-02-11 19:01:25 UTC (rev 79)
@@ -50,13 +50,15 @@
#
-# Any extra include and lib directories, or libraries
+# Any extra include and lib directories, libraries, and compiler/linker flags
#
# -lnsl needed for Linux systems
#
#EXTRA_INC = -I/usr/local/include
#EXTRA_LIB = -L/usr/local/lib
EXTRA_LIBS = -lnsl
+EXTRA_CFLAGS =
+EXTRA_LDFLAGS =
ifeq ($(RM),rm_lsf)
RM_INC = $(LSF_INC)
Modified: trunk/besclient/Makefile
===================================================================
--- trunk/besclient/Makefile 2010-02-10 20:38:51 UTC (rev 78)
+++ trunk/besclient/Makefile 2010-02-11 19:01:25 UTC (rev 79)
@@ -11,8 +11,8 @@
http://schemas.ggf.org/jsdl/2005/11/jsdl-posix
CC = gcc
-CFLAGS = -g $(GSOAP_DEF) -I. $(GSOAP_INC) $(EXTRA_INC)
-LDFLAGS = -g -L. $(EXTRA_LIB)
+CFLAGS = -g $(GSOAP_DEF) -I. $(GSOAP_INC) $(EXTRA_INC) $(EXTRA_CFLAGS)
+LDFLAGS = -g -L. $(EXTRA_LIB) $(EXTRA_LDFLAGS)
LIBS = -lbes -lssl -lcrypto $(EXTRA_LIBS)
BES_WSDL = bes-factory.wsdl
Modified: trunk/besserver/Makefile
===================================================================
--- trunk/besserver/Makefile 2010-02-10 20:38:51 UTC (rev 78)
+++ trunk/besserver/Makefile 2010-02-11 19:01:25 UTC (rev 79)
@@ -11,8 +11,8 @@
# http://schemas.ggf.org/jsdl/2005/11/jsdl-posix
CC = gcc
-CFLAGS = -g $(GSOAP_DEF) -I. $(GSOAP_INC) $(RM_INC) $(EXTRA_INC)
-LDFLAGS = -g $(EXTRA_LIB)
+CFLAGS = -g $(GSOAP_DEF) -I. $(GSOAP_INC) $(RM_INC) $(EXTRA_INC) $(EXTRA_CFLAGS)
+LDFLAGS = -g $(EXTRA_LIB) $(EXTRA_LDFLAGS)
LIBS = -lssl -lcrypto -lpam $(RM_LIBS) $(EXTRA_LIBS)
BES_WSDL = bes-factory.wsdl
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cs...@us...> - 2010-04-12 18:00:52
|
Revision: 80
http://bespp.svn.sourceforge.net/bespp/?rev=80&view=rev
Author: csmith
Date: 2010-04-12 18:00:39 +0000 (Mon, 12 Apr 2010)
Log Message:
-----------
Added GCC_OPTS to compile command
Modified Paths:
--------------
trunk/Make.config
trunk/besclient/Makefile
trunk/besserver/Makefile
Modified: trunk/Make.config
===================================================================
--- trunk/Make.config 2010-02-11 19:01:25 UTC (rev 79)
+++ trunk/Make.config 2010-04-12 18:00:39 UTC (rev 80)
@@ -59,6 +59,8 @@
EXTRA_LIBS = -lnsl
EXTRA_CFLAGS =
EXTRA_LDFLAGS =
+# Use this to pass any extra compiler options needed (e.g. -arch)
+GCC_OPTS =
ifeq ($(RM),rm_lsf)
RM_INC = $(LSF_INC)
Modified: trunk/besclient/Makefile
===================================================================
--- trunk/besclient/Makefile 2010-02-11 19:01:25 UTC (rev 79)
+++ trunk/besclient/Makefile 2010-04-12 18:00:39 UTC (rev 80)
@@ -10,7 +10,7 @@
SCHEMAS = http://schemas.ggf.org/jsdl/2006/07/jsdl-hpcpa \
http://schemas.ggf.org/jsdl/2005/11/jsdl-posix
-CC = gcc
+CC = gcc $(GCC_OPTS)
CFLAGS = -g $(GSOAP_DEF) -I. $(GSOAP_INC) $(EXTRA_INC) $(EXTRA_CFLAGS)
LDFLAGS = -g -L. $(EXTRA_LIB) $(EXTRA_LDFLAGS)
LIBS = -lbes -lssl -lcrypto $(EXTRA_LIBS)
Modified: trunk/besserver/Makefile
===================================================================
--- trunk/besserver/Makefile 2010-02-11 19:01:25 UTC (rev 79)
+++ trunk/besserver/Makefile 2010-04-12 18:00:39 UTC (rev 80)
@@ -10,7 +10,7 @@
SCHEMAS = http://schemas.ggf.org/jsdl/2006/07/jsdl-hpcpa \
# http://schemas.ggf.org/jsdl/2005/11/jsdl-posix
-CC = gcc
+CC = gcc $(GCC_OPTS)
CFLAGS = -g $(GSOAP_DEF) -I. $(GSOAP_INC) $(RM_INC) $(EXTRA_INC) $(EXTRA_CFLAGS)
LDFLAGS = -g $(EXTRA_LIB) $(EXTRA_LDFLAGS)
LIBS = -lssl -lcrypto -lpam $(RM_LIBS) $(EXTRA_LIBS)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cs...@us...> - 2010-04-12 18:08:57
|
Revision: 81
http://bespp.svn.sourceforge.net/bespp/?rev=81&view=rev
Author: csmith
Date: 2010-04-12 18:08:50 +0000 (Mon, 12 Apr 2010)
Log Message:
-----------
Support for SAGA library based RM backend
Modified Paths:
--------------
trunk/Make.config
trunk/besserver/Makefile
trunk/besserver/job.c
trunk/besserver/job.h
trunk/besserver/rm.h
trunk/besserver/rm_pbs.c
trunk/config.h
Added Paths:
-----------
trunk/besserver/rm_saga.cpp
Modified: trunk/Make.config
===================================================================
--- trunk/Make.config 2010-04-12 18:00:39 UTC (rev 80)
+++ trunk/Make.config 2010-04-12 18:08:50 UTC (rev 81)
@@ -14,6 +14,7 @@
#RM = rm_lava
#RM = rm_pbs
#RM = rm_sge
+#RM = rm_saga
#
# LSF related variables
@@ -50,13 +51,29 @@
#
+# SAGA related variables
+#
+# SAGA_LOC is where the 'include' and 'lib'
+# directories are located.
+SAGA_LOC = /usr/local/packages/saga/
+SAGA_CFG = $(SAGA_LOC)/bin/saga-config
+SAGA_INC = $(shell saga-config --cxxflags)
+SAGA_LIBS = $(shell saga-config --ldflags)
+
+OSNAME = $(shell uname -s)
+
+#
# Any extra include and lib directories, libraries, and compiler/linker flags
#
# -lnsl needed for Linux systems
#
#EXTRA_INC = -I/usr/local/include
#EXTRA_LIB = -L/usr/local/lib
-EXTRA_LIBS = -lnsl
+
+ifeq "$(OSNAME)" "Linux"
+ EXTRA_LIBS = -lnsl
+endif
+
EXTRA_CFLAGS =
EXTRA_LDFLAGS =
# Use this to pass any extra compiler options needed (e.g. -arch)
@@ -74,4 +91,8 @@
RM_INC = $(SGE_INC)
RM_LIBS = $(SGE_LIBS)
endif
+ifeq ($(RM),rm_saga)
+ RM_INC = $(SAGA_INC)
+ RM_LIBS = $(SAGA_LIBS)
+endif
Modified: trunk/besserver/Makefile
===================================================================
--- trunk/besserver/Makefile 2010-04-12 18:00:39 UTC (rev 80)
+++ trunk/besserver/Makefile 2010-04-12 18:08:50 UTC (rev 81)
@@ -11,6 +11,7 @@
# http://schemas.ggf.org/jsdl/2005/11/jsdl-posix
CC = gcc $(GCC_OPTS)
+CXX = g++ $(GCC_OPTS)
CFLAGS = -g $(GSOAP_DEF) -I. $(GSOAP_INC) $(RM_INC) $(EXTRA_INC) $(EXTRA_CFLAGS)
LDFLAGS = -g $(EXTRA_LIB) $(EXTRA_LDFLAGS)
LIBS = -lssl -lcrypto -lpam $(RM_LIBS) $(EXTRA_LIBS)
@@ -37,14 +38,23 @@
all: besserver
besserver: $(BES_OBJ) $(SERVER_OBJ)
+ifneq ($(RM),rm_saga)
$(CC) $(LDFLAGS) -o besserver $(BES_OBJ) $(SERVER_OBJ) $(LSFLIBS) $(LIBS)
+else
+ $(CXX) $(LDFLAGS) -o besserver $(BES_OBJ) $(SERVER_OBJ) $(LSFLIBS) $(LIBS)
+endif
besserver.o: besserver.c $(BES_H_FILES) $(SOAP_NS)
job.o: job.c $(BES_H_FILES) $(SOAP_NS)
faults.o: faults.c $(BES_H_FILES) $(SOAP_NS)
auth.o: auth.c $(BES_H_FILES) $(SOAP_NS)
-$(RM).o: $(RM).c rm_util.o $(BES_H_FILES) $(SOAP_NS)
+ifeq ($(RM),rm_saga)
+ $(RM).o: $(RM).cpp rm_util.o $(BES_H_FILES) $(SOAP_NS)
+else
+ $(RM).o: $(RM).c rm_util.o $(BES_H_FILES) $(SOAP_NS)
+endif
+
soapServer.o: soapServer.c
soapClient.o: soapClient.c
soapC.o: soapC.c
@@ -55,6 +65,9 @@
rm_util.o: rm_util.c
endif
+rm_saga.o: rm_saga.cpp
+ $(CXX) $(CFLAGS) -o $@ -c $<
+
stdsoap2.o: $(GSOAP_TOP)/stdsoap2.c
$(CC) $(CFLAGS) -c $(GSOAP_TOP)/stdsoap2.c
Modified: trunk/besserver/job.c
===================================================================
--- trunk/besserver/job.c 2010-04-12 18:00:39 UTC (rev 80)
+++ trunk/besserver/job.c 2010-04-12 18:08:50 UTC (rev 81)
@@ -592,10 +592,10 @@
else if (isElement(cur, JSDL_NS, "DeleteOnTermination")) {
printf("----DeleteOnTermination\n");
if (!strcmp(cur->data, "true")) {
- file->delete = true_;
+ file->delete_on_term = true_;
}
else {
- file->delete = false_;
+ file->delete_on_term = false_;
}
}
else if (isElement(cur, JSDL_NS, "Source")) {
Modified: trunk/besserver/job.h
===================================================================
--- trunk/besserver/job.h 2010-04-12 18:00:39 UTC (rev 80)
+++ trunk/besserver/job.h 2010-04-12 18:08:50 UTC (rev 81)
@@ -50,7 +50,7 @@
char *filename;
char *filesystemname;
enum jsdl__CreationFlagEnumeration creationflag;
- enum xsd__boolean delete;
+ enum xsd__boolean delete_on_term;
char *source;
char *target;
struct credential *credential;
Modified: trunk/besserver/rm.h
===================================================================
--- trunk/besserver/rm.h 2010-04-12 18:00:39 UTC (rev 80)
+++ trunk/besserver/rm.h 2010-04-12 18:08:50 UTC (rev 81)
@@ -64,6 +64,17 @@
char *LocalResourceManagerType;
};
+
+#ifdef CXX
+extern "C" int rm_initialize (struct soap*, char*);
+extern "C" int rm_submitJob (struct soap*, struct jobcard*, char*, char**);
+extern "C" int rm_terminateJob (struct soap*, char*, char*);
+extern "C" int rm_getJobInfo (struct soap*, char*, char*, struct jobcard**);
+extern "C" int rm_getJobStatus (struct soap*, char*, char*, struct bes__ActivityStatusType**);
+extern "C" int rm_getResourceList (struct soap*, struct rm_filter*, struct rm_resource**, int*);
+extern "C" int rm_getJobsList (struct soap*, struct rm_filter*, struct rm_job**, int*);
+extern "C" int rm_getClusterInfo (struct soap*, struct rm_clusterInfo**);
+#else
int rm_initialize(struct soap*, char*);
int rm_submitJob(struct soap*, struct jobcard*, char*, char**);
int rm_terminateJob(struct soap*, char*, char *);
@@ -72,6 +83,7 @@
int rm_getResourceList(struct soap *, struct rm_filter*, struct rm_resource**, int*);
int rm_getJobsList(struct soap*, struct rm_filter*, struct rm_job**, int*);
int rm_getClusterInfo(struct soap*, struct rm_clusterInfo**);
+#endif
#endif /* _RM_H */
Modified: trunk/besserver/rm_pbs.c
===================================================================
--- trunk/besserver/rm_pbs.c 2010-04-12 18:00:39 UTC (rev 80)
+++ trunk/besserver/rm_pbs.c 2010-04-12 18:08:50 UTC (rev 81)
@@ -650,7 +650,7 @@
fprintf(script,"%s out %s %s %s\n", STAGE_SCRIPT, currentFile->target,
currentFile->filename, currentFile->credential->username,
currentFile->credential->password);
- if(currentFile->delete)
+ if(currentFile->delete_on_term)
fprintf(script,"rm %s\n", currentFile->filename);
}
currentFile=currentFile->next;
@@ -659,7 +659,7 @@
//Remove files which DeleteOnTermination equals true
currentFile = jc->files;
while(currentFile != NULL){
- if(currentFile->delete){
+ if(currentFile->delete_on_term){
fprintf(script, "rm %s\n", currentFile->filename);
}
currentFile=currentFile->next;
Added: trunk/besserver/rm_saga.cpp
===================================================================
--- trunk/besserver/rm_saga.cpp (rev 0)
+++ trunk/besserver/rm_saga.cpp 2010-04-12 18:08:50 UTC (rev 81)
@@ -0,0 +1,618 @@
+/* ----------------------------------------------------------------
+ * rm_saga.c
+ *
+ * SAGA backend implementation of the OGSA Basic Execution Services
+ *
+ * Copyright (C) Andre Merzky <an...@me...>
+ * CCT, Louisiana State University
+ * All Rights Reserved.
+ *
+ * This file is part of Besserver.
+ *
+ * Besserver is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#define CXX
+
+//Includes
+#include "rm.h"
+#include "rm_util.h"
+#include "faults.h"
+#include "job.h"
+
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <signal.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <pwd.h>
+
+#include <saga/saga.hpp>
+#include <boost/lexical_cast.hpp>
+
+//! Maximum length of the environment variables string
+#define MAXVAR_BUFFER 4096
+
+//GLOBAL VARIABLES
+
+/**
+ * SAGA does not need any special initialization
+ */
+extern "C"
+int rm_initialize (struct soap * soap,
+ char * serverName)
+{
+ return BESE_OK;
+}
+
+/**
+ * Prints an error message to stderr
+ * @param message string to print
+ */
+extern "C"
+void printError (char * message)
+{
+ std::cerr << message << std::flush;
+}
+
+/**
+ * FIXME
+ * @return 0
+ */
+extern "C"
+int getErrNo (void)
+{
+ return 0;
+}
+
+/**
+ * Terminates a job.
+ * @param jobid is the PID assigned by the queue
+ * @param user is a string with the account of the user who requested the
+ * job deletion
+ * @return 0 if correct, non-zero if error
+ */
+extern "C"
+int rm_terminateJob (struct soap * soap,
+ char * jobid,
+ char * user)
+{
+ if ( ! jobid || std::string (jobid).empty () )
+ {
+ // empty jobid - not sure what to do
+ return BESE_BAD_ARG;
+ }
+
+ // FIXME: dig js URL from jobid
+ try
+ {
+ saga::job::service js;
+ saga::job::job j = js.get_job (jobid);
+ j.cancel ();
+ }
+ catch ( const saga::exception & e )
+ {
+ std::cout << "Could not kill job "
+ << jobid
+ << " : "
+ << e.what ()
+ << std::endl;
+ return BESE_BACKEND;
+ }
+
+ return BESE_OK;
+}
+
+/**
+ * Gets the status of the job.
+ *
+ * It maps the different states of SAGA jobs to BES states.
+ * @param jobid is the saga job id
+ * @param user is a string with the account of the user who requested the
+ * job status
+ * @param jobStatus is an output parameter with the status of the job -NULL
+ * if error-
+ * @return 0 if correct, non-zero if error
+ */
+extern "C"
+int rm_getJobStatus(struct soap * soap,
+ char * jobid,
+ char * user,
+ struct bes__ActivityStatusType ** jobStatus)
+{
+ struct bes__ActivityStatusType *activityStatus;
+
+ if ( ! jobid || std::string (jobid).empty () )
+ {
+ // empty jobid - not sure what to do
+ return BESE_BAD_ARG;
+ }
+
+ if ( ! jobStatus )
+ {
+ return BESE_BAD_ARG;
+ }
+
+ activityStatus = (struct bes__ActivityStatusType*) soap_malloc (soap, sizeof (struct bes__ActivityStatusType));
+
+ if ( activityStatus == NULL )
+ {
+ return BESE_MEM_ALLOC;
+ }
+
+ ::memset (activityStatus, 0, sizeof (struct bes__ActivityStatusType));
+
+ bool ok = true;
+
+ try
+ {
+ saga::job::service js;
+ saga::job::job j = js.get_job (jobid);
+
+ switch ( j.get_state () )
+ {
+ case saga::job::New: activityStatus->state = Pending; break;
+ case saga::job::Running: activityStatus->state = Running; break;
+ case saga::job::Suspended: activityStatus->state = Running; break;
+ case saga::job::Canceled: activityStatus->state = Cancelled; break;
+ case saga::job::Failed: activityStatus->state = Failed; break;
+ case saga::job::Done: activityStatus->state = Finished; break;
+ default: ok = false; break;
+ }
+ }
+ catch ( const saga::exception & e )
+ {
+ std::cout << "Could not get job state for "
+ << jobid
+ << " : "
+ << e.what ()
+ << std::endl;
+ return BESE_BACKEND;
+ }
+
+ if ( ! ok )
+ {
+ std::cout << "invalid state state for "
+ << jobid
+ << std::endl;
+ return BESE_BACKEND;
+ }
+
+ *jobStatus = activityStatus;
+
+ return BESE_OK;
+}
+
+/**
+ * Gets the information about a job.
+ *
+ * @param jobid is the PID assigned by the queue
+ * @param soap
+ * @param job_info is an output parameter which contains the information
+ * about the job submission request and the job state (NULL if error).
+ * @return 0 if correct, non-zero if error
+ */
+extern "C"
+int rm_getJobInfo (struct soap * soap,
+ char * jobid,
+ char * user,
+ struct jobcard ** job_info )
+{
+ if ( ! jobid || std::string (jobid).empty () )
+ {
+ // empty jobid - not sure what to do
+ return BESE_BAD_ARG;
+ }
+
+ if ( ! job_info )
+ {
+ return BESE_BAD_ARG;
+ }
+
+ struct jobcard * jc = (struct jobcard *) soap_malloc (soap, sizeof (struct jobcard));
+
+ try
+ {
+ saga::job::service js;
+ saga::job::job j = js.get_job (jobid);
+
+ jc->jobname = "";
+ jc->jobproject = "";
+ jc->num_hostnames = 0;
+ jc->hostnames = NULL;
+ jc->exclusive = 0;
+ jc->osname = "";
+ jc->osver = "";
+ jc->cpuarch = "";
+ jc->executable = "";
+ jc->num_args = 0;
+ jc->args = NULL;
+ jc->input = "";
+ jc->output = "";
+ jc->error = "";
+ jc->wd = "$HOME";
+ jc->environment = NULL;
+ jc->username = "";
+
+ // while ( env )
+ // {
+ // struct envvar* newEnvVar= (struct envvar *) soap_malloc (soap,
+ // sizeof (struct envvar));
+ // memset (newEnvVar, 0, sizeof (struct envvar));
+ // newEnvVar->name = soap_strdup (soap, env.key);
+ // newEnvVar->val = soap_strdup (soap, env.val);
+ // newEnvVar->next = job_info->environment;
+ //
+ // jc->environment = newEnvVar;
+ // }
+ }
+ catch ( const saga::exception & e )
+ {
+ std::cout << "Could not get job info for "
+ << jobid
+ << " : "
+ << e.what ()
+ << std::endl;
+ return BESE_BACKEND;
+ }
+
+ *job_info = jc;
+
+ return BESE_OK;
+}
+
+
+/**
+ * Gets a filtered list of jobs in the queue.
+ *
+ * This function issues a qstat and then parses the output file to add to
+ * the list the jobs that pass the filters.
+ * @param soap is needed to allocate memory that can be deallocated by the
+ * gsoap library after.
+ * @param filters are the filters that are going to be applied. See
+ * HPCBP Advanced Filter Extension.
+ * @return a list of job ids
+ */
+extern "C"
+int rm_getJobList(struct soap * soap,
+ struct rm_filter * filters,
+ struct rm_job ** joblist,
+ int * numjobs)
+{
+ struct rm_job * jobList;
+ char filename[128];
+ char command[256];
+ struct rm_filter* filter;
+ int jobid;
+ int scan;
+ char ignore[128];
+ int numJobs = 0;
+
+ // set up filter maps.
+ // NOTE: we do not support time and id filters, as ids are not numerical in
+ // SAGA, and time
+ std::map <std::string, bool> user_map;
+ std::map <std::string, bool> state_map;
+
+ // we do not su
+ std::vector <std::pair <long, long> > id_range_map;
+ std::vector <std::pair <std::string, std::string> > time_range_map;
+
+ filter = filters;
+ while ( (filter != NULL) )
+ {
+ if ( filter->user != NULL )
+ {
+ user_map [filter->user] = true;
+ }
+
+ if ( filter->state != NULL )
+ {
+ state_map [filter->state] = true;
+ }
+
+ filter = filter->next;
+ }
+
+ try
+ {
+ saga::job::service js;
+ std::vector <std::string> ids = js.list ();
+
+ for ( unsigned int i = 0; i < ids.size (); i++ )
+ {
+ saga::job::job j = js.get_job (ids[i]);
+ saga::job::description jd = j.get_description ();
+
+ // FIXME: this gives the user ID for the first session context, not the
+ // user ID for whoever actually owns this job. Not sure this is possible
+ // in SAGA...
+ std::string user = j.get_session ().list_contexts ()[0].get_attribute ("UserID");
+ std::string state = boost::lexical_cast <std::string> (j.get_state ());
+
+ if ( user_map .count (user ) == 0 &&
+ state_map.count (state) == 0 )
+ {
+ struct rm_job * newJob = (struct rm_job *) soap_malloc (soap,
+ sizeof (struct rm_job));
+ if ( ! newJob )
+ {
+ return BESE_MEM_ALLOC;
+ }
+
+ newJob->jobid = soap_strdup (soap, ids[i].c_str ());
+ newJob->next = jobList;
+ jobList = newJob;
+
+ numJobs++;
+ }
+ }
+ }
+ catch ( const saga::exception & e )
+ {
+ std::cout << "Could not get job list : "
+ << e.what ()
+ << std::endl;
+ return BESE_BACKEND;
+ }
+
+ *joblist = jobList;
+ *numjobs = numJobs;
+
+ return BESE_OK;
+}
+
+
+extern "C"
+int rm_getResourceList (struct soap * soap,
+ struct rm_filter * filter,
+ struct rm_resource ** resourcelist,
+ int * num_resources)
+{
+ // SAGA does not have resource discovery :-(
+ return BESE_SYS_ERR;
+}
+
+
+/**
+ * Gets the factory attributes.
+ *
+ * This function uses @see loadResourceFile
+ * and also queries the SGE queue.
+ * @param soap is needed to allocate memory that can be deallocated by the
+ * gsoap library after.
+ * @return a struct of type clusterInfo with the information needed for the
+ * factory attributes document
+ */
+extern "C"
+int rm_getClusterInfo (struct soap * soap,
+ struct rm_clusterInfo ** clusterInf
+ /* , int compactResources */
+ )
+{
+ // SAGA does not have resource discovery :-(
+ return BESE_SYS_ERR;
+}
+
+/**
+ * Submits a job to the queuing system.
+ *
+ * It generates a script file and sends
+ * it to the queue.
+ * @param jc stores all the information about the job
+ * @param soap is used to allocate memory that can be freed by the gsoap
+ * library
+ * @param message is the description of the error ocurred (if any)
+ * @return job PID if correct, negative integer if error
+ */
+extern "C"
+int rm_submitJob ( struct soap * soap,
+ struct jobcard * jc,
+ char * user,
+ char ** return_jobid)
+{
+ try
+ {
+ using namespace saga::job::attributes;
+
+ saga::url rm; // job service contact
+ saga::job::description jd;
+
+ if ( ! jc )
+ {
+ return BESE_BAD_ARG;
+ }
+
+
+ if ( jc->executable )
+ {
+ jd.set_attribute (description_executable, jc->executable);
+ }
+ else
+ {
+ std::cerr << "Error: Need to have the executable name" << std::endl;
+ return BESE_BAD_ARG;
+ }
+
+
+ if ( jc->input )
+ {
+ jd.set_attribute (description_input, jc->input);
+ }
+
+
+ if ( jc->output )
+ {
+ jd.set_attribute (description_output, jc->output);
+ }
+
+
+ if ( jc->error )
+ {
+ jd.set_attribute (description_error, jc->error);
+ }
+
+
+ if ( jc->osname )
+ {
+ jd.set_attribute (description_operating_system_type, jc->osname);
+ }
+
+
+ if ( jc->cpuarch )
+ {
+ jd.set_attribute (description_cpu_architecture, jc->cpuarch);
+ }
+
+
+ if ( jc->wd )
+ {
+ jd.set_attribute (description_working_directory, jc->wd);
+ }
+
+
+ if ( jc->jobproject )
+ {
+ jd.set_attribute (description_job_project, jc->jobproject);
+ }
+
+
+ // unsupported
+ // if ( jc->jobname != NULL )
+ // {
+ // jd.set_attribute (description_jobname, jc->jobname);
+ // }
+ //
+
+ if ( jc->icpu != 0 )
+ {
+ jd.set_attribute (description_total_cpu_count,
+ boost::lexical_cast <std::string> (jc->icpu));
+ }
+
+
+ if ( jc->ipmem != 0 )
+ {
+ jd.set_attribute (description_total_physical_memory,
+ boost::lexical_cast <std::string> (jc->ipmem));
+ }
+
+
+ // unsupported by SAGA
+ // if ( jc->ivmem != 0 )
+ // {
+ // jd.set_attribute (description_vmem,
+ // boost::lexical_cast <std::string> (jc->ivmem));
+ // }
+
+
+ std::vector <std::string> args;
+ for ( int i = 0; i < jc->num_args; i++ )
+ {
+ args.push_back (jc->args[i]);
+ }
+ jd.set_vector_attribute (description_arguments, args);
+
+
+ std::vector <std::string> chosts;
+ for ( int i = 0; i < jc->num_hostnames; i++ )
+ {
+ if ( jc->hostnames[i] )
+ {
+ chosts.push_back (jc->hostnames[i]);
+ }
+ }
+ jd.set_vector_attribute (description_candidate_hosts, chosts);
+
+
+ // Store the submitting info in environment variables for later use
+ std::vector <std::string> env;
+ struct envvar* variableList = jc->environment;
+ for ( ; variableList != NULL; variableList = variableList->next )
+ {
+ std::string key = variableList->name;
+ std::string val = variableList->val;
+
+ env.push_back (key + "=" + val);
+
+ }
+ jd.set_vector_attribute (description_environment, env);
+
+
+ std::vector <std::string> transfers;
+ bool delete_on_term = true; // clean all or none
+ struct fileStage * stage = jc->files;
+ while ( stage != NULL )
+ {
+ if ( stage->credential )
+ {
+ std::cerr << "Warning: user/pass unsupported for file staging"
+ << std::endl;
+ }
+
+ if ( stage->source != NULL )
+ {
+ std::string tmp (stage->source);
+ tmp += " > ";
+ tmp += stage->filename;
+ }
+ else if ( stage->target != NULL )
+ {
+ std::string tmp (stage->filename);
+ tmp += " < ";
+ tmp += stage->target;
+ }
+
+ // if any file needs to be kept, do *not* set the delete flag
+ if ( ! stage->delete_on_term )
+ {
+ delete_on_term = false;
+ }
+
+ stage = stage->next;
+ }
+
+ if ( ! transfers.empty () )
+ {
+ jd.set_vector_attribute (description_file_transfer, transfers);
+ }
+
+ jd.set_attribute (description_cleanup, boost::lexical_cast <std::string> (delete_on_term));
+
+
+ // create and run job
+ saga::job::service js;
+ saga::job::job j = js.create_job (jd);
+ j.run ();
+
+ * return_jobid = soap_strdup (soap, j.get_job_id ().c_str ());
+ }
+ catch ( const saga::exception & e )
+ {
+ std::cerr << "Error in job submission: "
+ << std::endl
+ << e.what ()
+ << std::endl;
+
+ return BESE_SYS_ERR;
+ }
+
+ return BESE_OK;
+}
+
Modified: trunk/config.h
===================================================================
--- trunk/config.h 2010-04-12 18:00:39 UTC (rev 80)
+++ trunk/config.h 2010-04-12 18:08:50 UTC (rev 81)
@@ -6,7 +6,7 @@
#define QSUBEXEC "qsub"
/* Uncomment the next line if you are building on Mac OS X */
-/* #define MACOSX */
+#define MACOSX
/* You probably don't need to change these. */
/* Setting the VERSION_STRING macro determines what is output */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|