Ignore:
Timestamp:
Apr 24, 2024, 11:35:22 AM (6 months ago)
Author:
augier3pi
Message:

Fix launching fluidimage

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/command_launch_python.m

    r1135 r1136  
    1 %'command_launch_python': creates the command strings for opening a programme in python with a Linux system('GLNX86','GLNXA64','MACI64')
     1%'command_launch_python': creates the command string for launching fluidimage
    22%------------------------------------------------------------------------
    3 % function cmd=command_launch_matlab(filelog,ActionPath,ActionName,inputxml)
     3% function cmd=command_launch_python(inputxml)
    44%
    55%OUTPUT
    6 % cmd=set of system commands (char string) to write
    7                            
     6% cmd=set of system commands (char string) to write
    87%
    98%INPUT:
    10 % filelog: name (char string)  of the file to collect the output in the Matlab command window
    11 % ActionPath:  path to the  programme to launch
    12 % ActionName: name of the programme to launch
    13 % inputxml: full name, including path, of the xml input parameter file for the programme ActionName
    14 % option: ='bacground' or 'cluster' depending on the launching option
     9% inputxml: path of the xml input parameter file for the program fluidimage
     10% option: = 'background' or 'cluster' depending on the launching option
    1511
    16 function cmd=command_launch_python(filelog,ActionPath,ActionName,inputxml)
    17  cmd = ['LD_LIBRARY_PATH=$(echo $LD_LIBRARY_PATH | pyp "l = x.split('':'');...' ...
    18      ' l = [s for s in l if ''matlab'' not in s]; print('':''.join(l))") ' ...
    19                 'python -m ' ActionName ' ' inputxml];
    20 
    21 % Matlab case:
    22  % ThreadOption='';
    23 % if strcmp(option,'cluster')
    24 %     ThreadOption='-singleCompThread';
    25 %     inputxml={inputxml};% single input parameter file
    26 % end
    27 % matlab_ver = ver('MATLAB');
    28 % matlab_version = matlab_ver.Version;
    29 % cmd=[...
    30 %     '#!/bin/bash\n'...
    31 %     'source /etc/profile\n'...
    32 %     'module purge\n'...
    33 %     'module load matlab/' matlab_version '\n'...% CHOICE OF THE SAME MATLAB VERSION AS THE CURRENT MATLAB SESSION (not mandatory)
    34 %     'time_start=$(date +%%s)\n'...
    35 %     'matlab -nodisplay -nosplash -nojvm ''' ThreadOption ''' -logfile ''' filelog ''' <<END_MATLAB\n'...%launch the new Matlab session  without display
    36 %     'addpath(''' path_uvmat ''');\n'...
    37 %     'addpath(''' ActionPath ''');\n'];
    38 % for iprocess=1:numel(inputxml)
    39 %     cmd=[cmd '' ActionName  '(''' inputxml{iprocess} ''');\n'];
    40 % end
    41 % cmd=[cmd  'exit\n' 'END_MATLAB\n'];
    42 %     if strcmp(option,'background')
    43 %     cmd=[cmd ...
    44 %     'time_end=$(date +%%s)\n'...
    45 %     'echo "global time = " $(($time_end - $time_start)) >> ''' filelog '''\n'];
    46 %     end
    47 %
    48 % %% case cluster:
    49 % % matlab_ver = ver('MATLAB');
    50 % %                     matlab_version = matlab_ver.Version;
    51 % %                     cmd=[...
    52 % %                         '#!/bin/bash\n'...
    53 % %                         'source /etc/profile\n'...
    54 % %                         'module purge\n'...
    55 % %                         'module load matlab/' matlab_version '\n'...% CHOICE OF CURRENT MATLAB VERSION
    56 % %                         'matlab -nodisplay -nosplash -nojvm -singleCompThread -logfile ''' filelog{iprocess} ''' <<END_MATLAB\n'...% open a new Matlab session without display
    57 % %                         'addpath(''' path_series ''');\n'...
    58 % %                         'addpath(''' ActionPath ''');\n'...
    59 % %                         '' ActionName  '(''' filexml{iprocess} ''');\n'...% launch the Matlab function selected by the GUI 'series'
    60 % %                         'exit\n'...
    61 % %                         'END_MATLAB\n'];
    62 % %                 end
    63 
    64 
     12function cmd=command_launch_python(inputxml)
     13    cmd = ['python -m fluidimage.run_from_xml ' inputxml];
     14end
Note: See TracChangeset for help on using the changeset viewer.