@@ -105,6 +105,17 @@ static void recv_ack(int status, orte_process_name_t* sender,
105105 void * cbdata );
106106static void write_handler (int fd , short event , void * cbdata );
107107
108+ static char * filem_session_dir ()
109+ {
110+ char * session_dir = orte_process_info .jobfam_session_dir ;
111+ if ( NULL == session_dir ){
112+ /* if no job family session dir was provided -
113+ * use the job session dir */
114+ session_dir = orte_process_info .job_session_dir ;
115+ }
116+ return session_dir ;
117+ }
118+
108119static int raw_init (void )
109120{
110121 OBJ_CONSTRUCT (& incoming_files , opal_list_t );
@@ -657,25 +668,26 @@ static int create_link(char *my_dir, char *path,
657668static int raw_link_local_files (orte_job_t * jdata ,
658669 orte_app_context_t * app )
659670{
660- char * my_dir , * path = NULL ;
671+ char * session_dir , * path = NULL ;
661672 orte_proc_t * proc ;
662- char * prefix ;
663673 int i , j , rc ;
664674 orte_filem_raw_incoming_t * inbnd ;
665675 opal_list_item_t * item ;
666676 char * * files = NULL , * bname , * filestring ;
667677
668- /* check my session directory for files I have received and
678+ /* check my jobfam session directory for files I have received and
669679 * symlink them to the proc-level session directory of each
670680 * local process in the job
681+ *
682+ * TODO: @rhc - please check that I've correctly interpret your
683+ * intention here
671684 */
672- my_dir = opal_dirname (orte_process_info .job_session_dir );
673-
674- /* setup */
675- if (NULL != orte_process_info .tmpdir_base ) {
676- prefix = strdup (orte_process_info .tmpdir_base );
677- } else {
678- prefix = NULL ;
685+ session_dir = filem_session_dir ();
686+ if ( NULL == session_dir ){
687+ /* we were unable to find any suitable directory */
688+ rc = ORTE_ERR_BAD_PARAM ;
689+ ORTE_ERROR_LOG (rc );
690+ return rc ;
679691 }
680692
681693 /* get the list of files this app wants */
@@ -692,10 +704,6 @@ static int raw_link_local_files(orte_job_t *jdata,
692704
693705 /* if there are no files to link, then ignore this */
694706 if (NULL == files ) {
695- free (my_dir );
696- if (NULL != prefix ) {
697- free (prefix );
698- }
699707 return ORTE_SUCCESS ;
700708 }
701709
@@ -736,22 +744,15 @@ static int raw_link_local_files(orte_job_t *jdata,
736744 ORTE_NAME_PRINT (& proc -> name )));
737745
738746 /* get the session dir name in absolute form */
739- path = NULL ;
740- rc = orte_session_dir_get_name (& path , & prefix , NULL ,
741- orte_process_info .nodename ,
742- & proc -> name );
747+ path = orte_process_info .proc_session_dir ;
748+
743749 /* create it, if it doesn't already exist */
744750 if (OPAL_SUCCESS != (rc = opal_os_dirpath_create (path , S_IRWXU ))) {
745751 ORTE_ERROR_LOG (rc );
746752 /* doesn't exist with correct permissions, and/or we can't
747753 * create it - either way, we are done
748754 */
749755 free (files );
750- if (NULL != prefix ) {
751- free (prefix );
752- }
753- free (path );
754- free (my_dir );
755756 return rc ;
756757 }
757758
@@ -775,13 +776,8 @@ static int raw_link_local_files(orte_job_t *jdata,
775776 inbnd -> file ));
776777 /* cycle thru the link points and create symlinks to them */
777778 for (j = 0 ; NULL != inbnd -> link_pts [j ]; j ++ ) {
778- if (ORTE_SUCCESS != (rc = create_link (my_dir , path , inbnd -> link_pts [j ]))) {
779+ if (ORTE_SUCCESS != (rc = create_link (session_dir , path , inbnd -> link_pts [j ]))) {
779780 ORTE_ERROR_LOG (rc );
780- free (my_dir );
781- free (path );
782- if (NULL != prefix ) {
783- free (prefix );
784- }
785781 free (files );
786782 return rc ;
787783 }
@@ -796,13 +792,8 @@ static int raw_link_local_files(orte_job_t *jdata,
796792 }
797793 }
798794 }
799- free (path );
800795 }
801796 opal_argv_free (files );
802- if (NULL != prefix ) {
803- free (prefix );
804- }
805- free (my_dir );
806797 return ORTE_SUCCESS ;
807798}
808799
@@ -999,7 +990,7 @@ static void recv_files(int status, orte_process_name_t* sender,
999990 opal_buffer_t * buffer , orte_rml_tag_t tag ,
1000991 void * cbdata )
1001992{
1002- char * file , * jobfam_dir ;
993+ char * file , * session_dir ;
1003994 int32_t nchunk , n , nbytes ;
1004995 unsigned char data [ORTE_FILEM_RAW_CHUNK_MAX ];
1005996 int rc ;
@@ -1086,9 +1077,9 @@ static void recv_files(int status, orte_process_name_t* sender,
10861077 incoming -> top = strdup (tmp );
10871078 free (tmp );
10881079 /* define the full path to where we will put it */
1089- jobfam_dir = opal_dirname ( orte_process_info . job_session_dir );
1090- incoming -> fullpath = opal_os_path (false, jobfam_dir , file , NULL );
1091- free ( jobfam_dir );
1080+ session_dir = filem_session_dir ( );
1081+
1082+ incoming -> fullpath = opal_os_path (false, session_dir , file , NULL );
10921083
10931084 OPAL_OUTPUT_VERBOSE ((1 , orte_filem_base_framework .framework_output ,
10941085 "%s filem:raw: opening target file %s" ,
0 commit comments