[Swift-commit] cog r3875

swift at ci.uchicago.edu swift at ci.uchicago.edu
Fri Feb 21 10:25:04 CST 2014


------------------------------------------------------------------------
r3875 | yadunand | 2014-02-21 10:24:17 -0600 (Fri, 21 Feb 2014) | 3 lines


Committing fix for string reference issue for jobmanager

------------------------------------------------------------------------
Index: modules/provider-coaster-c-client/src/CoasterSWIG.h
===================================================================
--- modules/provider-coaster-c-client/src/CoasterSWIG.h	(revision 3874)
+++ modules/provider-coaster-c-client/src/CoasterSWIG.h	(working copy)
@@ -20,7 +20,7 @@
 
 int CoasterSWIGClientSettings(CoasterClient *client, char *settings);
 
-Job* CoasterSWIGJobCreate(char *cmd_string);
+Job* CoasterSWIGJobCreate(char *cmd_string, char *jobmanager);
 
 int CoasterSWIGJobSettings(Job* j, char* dir, char* args, char* attr,
                            char* envs, char* stdoutLoc, char* stderrLoc);
Index: modules/provider-coaster-c-client/src/CoasterClient.cpp
===================================================================
--- modules/provider-coaster-c-client/src/CoasterClient.cpp	(revision 3874)
+++ modules/provider-coaster-c-client/src/CoasterClient.cpp	(working copy)
@@ -189,7 +189,7 @@
 	index = URL.find(':');
 	if (index == string::npos) {
 		// default port
-		return 1984;
+		return 53001;
 	}
 	else {
 		const char* sport = URL.substr(index + 1).c_str();
Index: modules/provider-coaster-c-client/src/CoasterClientTest.cpp
===================================================================
--- modules/provider-coaster-c-client/src/CoasterClientTest.cpp	(revision 3874)
+++ modules/provider-coaster-c-client/src/CoasterClientTest.cpp	(working copy)
@@ -14,7 +14,7 @@
 		CoasterLoop loop;
 		loop.start();
 
-		CoasterClient client("localhost:1984", loop);
+		CoasterClient client("localhost:53001", loop);
 		client.start();
 
 		Settings s;
Index: modules/provider-coaster-c-client/src/Job.h
===================================================================
--- modules/provider-coaster-c-client/src/Job.h	(revision 3874)
+++ modules/provider-coaster-c-client/src/Job.h	(working copy)
@@ -25,7 +25,7 @@
 		string* stdinLocation;
 		string* stdoutLocation;
 		string* stderrLocation;
-		string* jobManager;
+        string jobManager;
 
 		map<string, string>* env;
 		map<string, string>* attributes;
@@ -60,8 +60,8 @@
 		string* getStderrLocation();
 		void setStderrLocation(string& loc);
 
-		string* getJobManager();
-		void setJobManager(string& jm);
+        string getJobManager();
+        void setJobManager(string jm);
 
 		map<string, string>* getEnv();
 		string* getEnv(string name);
Index: modules/provider-coaster-c-client/src/Lock.cpp
===================================================================
--- modules/provider-coaster-c-client/src/Lock.cpp	(revision 3874)
+++ modules/provider-coaster-c-client/src/Lock.cpp	(working copy)
@@ -11,7 +11,7 @@
 
 static int unique = 0;
 
-#define DEBUG_LOCKS 1
+#define DEBUG_LOCKS 0
 #if DEBUG_LOCKS == 1
 #define debug(format, args...)           \
   {    printf("LOCK: %i " format "\n", id, ## args);        \
Index: modules/provider-coaster-c-client/src/CoasterSWIG.cpp
===================================================================
--- modules/provider-coaster-c-client/src/CoasterSWIG.cpp	(revision 3874)
+++ modules/provider-coaster-c-client/src/CoasterSWIG.cpp	(working copy)
@@ -73,12 +73,12 @@
     return 0;
 }
 
-Job* CoasterSWIGJobCreate(char *cmd_string)
+Job* CoasterSWIGJobCreate(char *cmd_string, char *jobmanager)
 {
-    string jobmanager = string("dummy");
-    cout << "CoasterSWIGJobCreate("<< cmd_string <<") "<< endl;
+    string jm = string(jobmanager);
+    cout << "CoasterSWIGJobCreate("<< cmd_string <<") : jobmanager="<< jm << endl;
     Job *job = new Job(cmd_string);
-    job->setJobManager(jobmanager);
+    job->setJobManager(jm);
     return job;
 }
 
Index: modules/provider-coaster-c-client/src/Job.cpp
===================================================================
--- modules/provider-coaster-c-client/src/Job.cpp	(revision 3874)
+++ modules/provider-coaster-c-client/src/Job.cpp	(working copy)
@@ -1,5 +1,6 @@
 #include "Job.h"
 #include <sstream>
+#include <cstring>
 
 using namespace std;
 
@@ -17,7 +18,7 @@
 	stdinLocation = NULL;
 	stdoutLocation = NULL;
 	stderrLocation = NULL;
-	jobManager = NULL;
+	jobManager = string("");
 
 	env = NULL;
 	attributes = NULL;
@@ -86,12 +87,13 @@
 	stderrLocation = &loc;
 }
 
-string* Job::getJobManager() {
+string Job::getJobManager() {
 	return jobManager;
 }
 
-void Job::setJobManager(string& jm) {
-	jobManager = &jm;
+void Job::setJobManager(string jm) {
+    // cout << "Job.cpp setJobManager ="<< jm << endl;
+    jobManager = jm;
 }
 
 map<string, string>* Job::getEnv() {
Index: modules/provider-coaster-c-client/src/JobSubmitCommand.cpp
===================================================================
--- modules/provider-coaster-c-client/src/JobSubmitCommand.cpp	(revision 3874)
+++ modules/provider-coaster-c-client/src/JobSubmitCommand.cpp	(working copy)
@@ -1,6 +1,7 @@
 #include "JobSubmitCommand.h"
 #include "CoasterError.h"
 #include <cstring>
+#include <string>
 
 using namespace std;
 
@@ -62,13 +63,15 @@
 		}
 	}
 
-	if (job->getJobManager() == NULL) {
+	if (job->getJobManager().empty()) {
+        cout<< "getJobManager == NULL, setting to :  fork "<< endl;
 		add(ss, "jm", "fork");
 	}
 	else {
-		add(ss, "jm", job->getJobManager());
+        const char *jm_string = (job->getJobManager()).c_str();
+        cout<< "getJobManager != !NULL, setting to : "<< job->getJobManager() << endl;
+		add(ss, "jm", jm_string);
 	}
-
 	addOutData(Buffer::wrap(ss));
 }
 



More information about the Swift-commit mailing list