Changeset 52 for trunk/pbs_drmaa/session.c
- Timestamp:
- 01/07/12 21:21:29 (12 years ago)
- File:
-
- 1 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 */
Note: See TracChangeset
for help on using the changeset viewer.