@@ -105,6 +105,17 @@ static void recv_ack(int status, orte_process_name_t* sender,
105
105
void * cbdata );
106
106
static void write_handler (int fd , short event , void * cbdata );
107
107
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
+
108
119
static int raw_init (void )
109
120
{
110
121
OBJ_CONSTRUCT (& incoming_files , opal_list_t );
@@ -657,25 +668,26 @@ static int create_link(char *my_dir, char *path,
657
668
static int raw_link_local_files (orte_job_t * jdata ,
658
669
orte_app_context_t * app )
659
670
{
660
- char * my_dir , * path = NULL ;
671
+ char * session_dir , * path = NULL ;
661
672
orte_proc_t * proc ;
662
- char * prefix ;
663
673
int i , j , rc ;
664
674
orte_filem_raw_incoming_t * inbnd ;
665
675
opal_list_item_t * item ;
666
676
char * * files = NULL , * bname , * filestring ;
667
677
668
- /* check my session directory for files I have received and
678
+ /* check my jobfam session directory for files I have received and
669
679
* symlink them to the proc-level session directory of each
670
680
* local process in the job
681
+ *
682
+ * TODO: @rhc - please check that I've correctly interpret your
683
+ * intention here
671
684
*/
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 ;
679
691
}
680
692
681
693
/* get the list of files this app wants */
@@ -692,10 +704,6 @@ static int raw_link_local_files(orte_job_t *jdata,
692
704
693
705
/* if there are no files to link, then ignore this */
694
706
if (NULL == files ) {
695
- free (my_dir );
696
- if (NULL != prefix ) {
697
- free (prefix );
698
- }
699
707
return ORTE_SUCCESS ;
700
708
}
701
709
@@ -736,22 +744,15 @@ static int raw_link_local_files(orte_job_t *jdata,
736
744
ORTE_NAME_PRINT (& proc -> name )));
737
745
738
746
/* 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
+
743
749
/* create it, if it doesn't already exist */
744
750
if (OPAL_SUCCESS != (rc = opal_os_dirpath_create (path , S_IRWXU ))) {
745
751
ORTE_ERROR_LOG (rc );
746
752
/* doesn't exist with correct permissions, and/or we can't
747
753
* create it - either way, we are done
748
754
*/
749
755
free (files );
750
- if (NULL != prefix ) {
751
- free (prefix );
752
- }
753
- free (path );
754
- free (my_dir );
755
756
return rc ;
756
757
}
757
758
@@ -775,13 +776,8 @@ static int raw_link_local_files(orte_job_t *jdata,
775
776
inbnd -> file ));
776
777
/* cycle thru the link points and create symlinks to them */
777
778
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 ]))) {
779
780
ORTE_ERROR_LOG (rc );
780
- free (my_dir );
781
- free (path );
782
- if (NULL != prefix ) {
783
- free (prefix );
784
- }
785
781
free (files );
786
782
return rc ;
787
783
}
@@ -796,13 +792,8 @@ static int raw_link_local_files(orte_job_t *jdata,
796
792
}
797
793
}
798
794
}
799
- free (path );
800
795
}
801
796
opal_argv_free (files );
802
- if (NULL != prefix ) {
803
- free (prefix );
804
- }
805
- free (my_dir );
806
797
return ORTE_SUCCESS ;
807
798
}
808
799
@@ -999,7 +990,7 @@ static void recv_files(int status, orte_process_name_t* sender,
999
990
opal_buffer_t * buffer , orte_rml_tag_t tag ,
1000
991
void * cbdata )
1001
992
{
1002
- char * file , * jobfam_dir ;
993
+ char * file , * session_dir ;
1003
994
int32_t nchunk , n , nbytes ;
1004
995
unsigned char data [ORTE_FILEM_RAW_CHUNK_MAX ];
1005
996
int rc ;
@@ -1086,9 +1077,9 @@ static void recv_files(int status, orte_process_name_t* sender,
1086
1077
incoming -> top = strdup (tmp );
1087
1078
free (tmp );
1088
1079
/* 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 );
1092
1083
1093
1084
OPAL_OUTPUT_VERBOSE ((1 , orte_filem_base_framework .framework_output ,
1094
1085
"%s filem:raw: opening target file %s" ,
0 commit comments