[Swift-commit] cog r3935

swift at ci.uchicago.edu swift at ci.uchicago.edu
Fri Jun 20 17:05:03 CDT 2014


------------------------------------------------------------------------
r3935 | timgarmstrong | 2014-06-20 17:03:10 -0500 (Fri, 20 Jun 2014) | 1 line

Set redirects
------------------------------------------------------------------------
Index: modules/provider-coaster-c-client/src/coasters.cpp
===================================================================
--- modules/provider-coaster-c-client/src/coasters.cpp	(revision 3934)
+++ modules/provider-coaster-c-client/src/coasters.cpp	(working copy)
@@ -236,6 +236,30 @@
   delete job;
 }
 
+coaster_rc
+coaster_job_set_redirects(coaster_job *job, const char *stdin_loc,
+                  const char *stdout_loc, const char *stderr_loc)
+                  COASTERS_THROWS_NOTHING {
+  if (job == NULL) {
+    return COASTER_ERROR_INVALID;
+  }
+  
+  // Accessor methods shouldn't throw exceptions
+  std::string *stdin_str = (stdin_loc == NULL) ?
+                            NULL : new string(stdin_loc);
+  job->job.setStdinLocation(*stdin_str);
+  
+  std::string *stdout_str = (stdout_loc == NULL) ?
+                            NULL : new string(stdout_loc);
+  job->job.setStdinLocation(*stdout_str);
+  
+  std::string *stderr_str = (stderr_loc == NULL) ?
+                            NULL : new string(stderr_loc);
+  job->job.setStdinLocation(*stderr_str);
+
+  return COASTER_SUCCESS;
+}
+
 const char *
 coaster_job_get_id(coaster_job *job) COASTERS_THROWS_NOTHING {
   // Shouldn't throw anything from accessor method
Index: modules/provider-coaster-c-client/src/coasters.h
===================================================================
--- modules/provider-coaster-c-client/src/coasters.h	(revision 3934)
+++ modules/provider-coaster-c-client/src/coasters.h	(working copy)
@@ -41,6 +41,7 @@
  */
 typedef enum {
   COASTER_SUCCESS,
+  COASTER_ERROR_INVALID,
   COASTER_ERROR_OOM,
   COASTER_ERROR_NETWORK,
   COASTER_ERROR_UNKNOWN,
@@ -130,7 +131,6 @@
  * Create a new coasters job for later submission.
  * Some standard arguments can be specified now, or left as NULL to be
  * initialized later.
- * TODO: functions to set other job properties
  *
  * executable: must be provided, name of executable
  * argc/argv: command line arguments
@@ -148,7 +148,18 @@
 coaster_rc
 coaster_job_free(coaster_job *job) COASTERS_THROWS_NOTHING;
 
+/*
+ * Set input and output streams redirections.
+ * All can be NULL to use default.
+ */
+coaster_rc
+coaster_job_set_redirects(coaster_job *job, const char *stdin_loc,
+                  const char *stdout_loc, const char *stderr_loc)
+                  COASTERS_THROWS_NOTHING;
 
+// TODO: functions for setting directory, env vars, attributes,
+//       stageins, stageouts, cleanups
+
 /*
  * Get local job ID string.
  * Return value points to job state: will be invalid if job is freed.
@@ -167,6 +178,7 @@
  * Get name of return code.  Returns NULL if invalid code.
  */
 const char *coaster_rc_string(coaster_rc code);
+
 #ifdef __cplusplus
 } // extern "C"
 #endif



More information about the Swift-commit mailing list