Changeset 52
- Timestamp:
- 01/07/12 21:21:29 (13 years ago)
- Location:
- trunk/pbs_drmaa
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/pbs_drmaa/session.c
r45 r52 135 135 pbsdrmaa_exc_raise_pbs( "pbs_connect" ); 136 136 } 137 138 self->job_exit_status_file_prefix = NULL; 137 139 } 138 140 EXCEPT_DEFAULT … … 159 161 pbs_disconnect( pbsself->pbs_conn ); 160 162 fsd_free( pbsself->status_attrl ); 163 fsd_free( pbsself->job_exit_status_file_prefix ); 164 161 165 pbsself->super_destroy( self ); 162 166 } … … 220 224 fsd_conf_option_t *wait_thread_sleep_time = NULL; 221 225 fsd_conf_option_t *max_retries_count = NULL; 226 fsd_conf_option_t *user_state_dir = NULL; 222 227 223 228 pbs_home = fsd_conf_dict_get(self->configuration, "pbs_home" ); 224 229 wait_thread_sleep_time = fsd_conf_dict_get(self->configuration, "wait_thread_sleep_time" ); 225 230 max_retries_count = fsd_conf_dict_get(self->configuration, "max_retries_count" ); 231 user_state_dir = fsd_conf_dict_get(self->configuration, "user_state_dir" ); 226 232 227 233 if( pbs_home && pbs_home->type == FSD_CONF_STRING ) … … 269 275 fsd_log_info(("Wait thread sleep time: %d", pbsself->wait_thread_sleep_time)); 270 276 } 277 278 if( user_state_dir && user_state_dir->type == FSD_CONF_STRING ) 279 { 280 struct passwd *pw = NULL; 281 uid_t uid; 282 283 uid = geteuid(); 284 pw = getpwuid(uid); /* drmaa_init is always called in thread safely fashion */ 285 286 if (!pw) 287 fsd_exc_raise_fmt(FSD_ERRNO_INTERNAL_ERROR,"Failed to get pw_name of the user %d", uid); 288 289 pbsself->job_exit_status_file_prefix = fsd_asprintf(user_state_dir->val.string, pw->pw_name); 290 } 291 else 292 { 293 pbsself->job_exit_status_file_prefix = fsd_asprintf("%s/.drmaa", getenv("HOME")); 294 } 295 296 if (mkdir(pbsself->job_exit_status_file_prefix, 0600) == -1 && errno != EEXIST) /* TODO it would be much better to do stat before */ 297 { 298 fsd_log_warning("Failed to create job state directory: %s. Valid job exit status may not be available in some cases.", pbsself->job_exit_status_file_prefix) 299 } 300 301 302 /* TODO purge old exit statuses files */ 271 303 272 304 pbsself->super_apply_configuration(self); /* call method from the superclass */ -
trunk/pbs_drmaa/session.h
r45 r52 84 84 */ 85 85 int wait_thread_sleep_time; 86 87 /* 88 * The prefix of the directory where the job exit status information is stored (default: %HOME/.pbs-drmaa/ 89 */ 90 char *job_exit_status_file_prefix; 86 91 }; 87 92 -
trunk/pbs_drmaa/submit.c
r49 r52 342 342 if( input_path != NULL ) 343 343 script_len += strlen(" <") + strlen(input_path); 344 if (((pbsdrmaa_session_t)self->session)->job_exit_status_file_prefix) 345 script_len += strlen("; echo $? >") + strlen(((pbsdrmaa_session_t)self->session)->job_exit_status_file_prefix) + strlen("/$PBS_JOBID.exitcode"); 344 346 } 345 347 … … 357 359 if( input_path != NULL ) 358 360 s += sprintf( s, " <%s", input_path ); 361 if (((pbsdrmaa_session_t)self->session)->job_exit_status_file_prefix) 362 s += sprintf( s, "; echo $? >%s/$PBS_JOBID.exitcode", ((pbsdrmaa_session_t)self->session)->job_exit_status_file_prefix); 363 359 364 fsd_assert( s == script+script_len ); 360 365 }
Note: See TracChangeset
for help on using the changeset viewer.