update_remote_jd

PURPOSE ^

SYNOPSIS ^

function dkepath = update_remote_jd(dkepath,link_mode,test_mode,display_mode)

DESCRIPTION ^

 this function load remote profiles and selects accessible remote clusters with compatible LUKE version 

   - link_mode : connection mode prescription
       o -2  : disable remote profiles
       o -1  : local profiles only
       o NaN : (default) use value from remote.link_mode
       o []  : give priority to (0) ssh key pair, (1) ssh bridge, (2) url/ftp bridge
       o 0   : ssh key pair enforced
       o 1   : ssh bridge enforced
       o 2   : url/ftp bridge enforced

   - test_mode : test the connections

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function dkepath = update_remote_jd(dkepath,link_mode,test_mode,display_mode)
0002 %
0003 % this function load remote profiles and selects accessible remote clusters with compatible LUKE version
0004 %
0005 %   - link_mode : connection mode prescription
0006 %       o -2  : disable remote profiles
0007 %       o -1  : local profiles only
0008 %       o NaN : (default) use value from remote.link_mode
0009 %       o []  : give priority to (0) ssh key pair, (1) ssh bridge, (2) url/ftp bridge
0010 %       o 0   : ssh key pair enforced
0011 %       o 1   : ssh bridge enforced
0012 %       o 2   : url/ftp bridge enforced
0013 %
0014 %   - test_mode : test the connections
0015 %
0016 if nargin < 4,
0017     display_mode = 1;%display the available remote profiles
0018 end
0019 %
0020 lukever = LUKEversion_jd;% local LUKE version
0021 lukever(lukever == ' ' | lukever == '.') = '_';% syntax for comparison
0022 %
0023 % Local hostname
0024 %
0025 lochostname = hostname_jd;
0026 %
0027 % load remote profiles if needed
0028 %
0029 nrem = 0;
0030 flag_local = [];
0031 %
0032 for irem = 1:length(dkepath.remote),
0033     if isfield(dkepath.remote(irem),'remoteid'),% process remote profile with schedulername, profilename & luke_root
0034         remotestr = ['remote_',dkepath.remote(irem).remoteid];
0035         if exist([remotestr,'.m'],'file'),
0036             %
0037             nrem = nrem+1;
0038             remote(nrem) = feval(remotestr,dkepath.remote(irem).schedulername,dkepath.remote(irem).profilename); 
0039             remote(nrem).env.luke_root = dkepath.remote(irem).luke_root;
0040             if isfield(dkepath.remote(nrem),'link_mode'),
0041                 remote(nrem).link_mode = dkepath.remote(irem).link_mode;
0042             end
0043             if isfield(dkepath.remote(nrem),'cvsupdate'),
0044                 remote(nrem).cvsupdate = dkepath.remote(irem).cvsupdate;
0045             end
0046             if isfield(dkepath.remote(nrem),'cvsrights'),
0047                 remote(nrem).cvsrights = dkepath.remote(irem).cvsrights;
0048             end
0049             if isfield(dkepath.remote(nrem),'gitupdate'),
0050                 remote(nrem).gitupdate = dkepath.remote(irem).gitupdate;
0051             end
0052             if isfield(dkepath.remote(nrem),'gitmode'),
0053                 remote(nrem).gitmode = dkepath.remote(irem).gitmode;
0054             end
0055 
0056             %
0057         else
0058             continue
0059         end
0060     else
0061         %
0062         nrem = nrem+1;
0063         remote(nrem) = dkepath.remote(nrem);
0064         %
0065     end
0066     %
0067     if any(strfind(lochostname,remote(nrem).hostname)),
0068         remote(nrem).host = '';
0069         flag_local(nrem) = true;
0070     else
0071         flag_local(nrem) = false;
0072     end
0073 end
0074 %
0075 if ~isempty(link_mode) && link_mode == -1,% local profiles only
0076     remote = remote(find(flag_local));
0077     nrem = length(remote);
0078     link_mode = [];% mode compatible with local calculations
0079 end
0080 %
0081 if nrem == 0,
0082     remote = [];
0083 end
0084 
0085 %
0086 % test compatibility of local and remote LUKE versions
0087 %
0088 flag = true(1,nrem);
0089 %
0090 for irem = 1:nrem
0091     %
0092     % if remote(irem).luke_root is a string, it is considered as the default value
0093     %
0094     if isfield(remote(irem).env,'luke_root'),
0095         %
0096         if isstruct(remote(irem).env.luke_root), 
0097             %
0098             if isfield(remote(irem).env.luke_root,lukever),
0099                 remote(irem).env.luke_root = remote(irem).env.luke_root.(lukever);
0100             elseif isfield(remote(irem).env.luke_root,'LUKE_default') && ~isempty(remote(irem).env.luke_root.LUKE_default),
0101                 remote(irem).env.luke_root = remote(irem).env.luke_root.LUKE_default;
0102             else
0103                 flag(irem) = false;
0104                 info_dke_yp(6,['no compatible LUKE version found for remote profile #',num2str(irem),' to host : ',remote(irem).host,'. Profile disabled.'])
0105             end
0106         end
0107     else
0108         flag(irem) = false;% no remote luke root specified
0109     end
0110 end
0111 %
0112 % test connection and identify local profiles
0113 %
0114 if isempty(link_mode) || isnan(link_mode) || link_mode >= 0,% remote profiles enabled : test connections and display output following link_mode
0115     %
0116     if test_mode,
0117         disp (' ')
0118         info_dke_yp(3,'Testing remote profile connections ')
0119     end
0120     %
0121     [dkepath.remote,dkepath.profilestr] = load_remoteprofiles_jd(remote(flag),test_mode,false,NaN,NaN,false,false,link_mode);
0122     %
0123     nrem = length(dkepath.remote);
0124     %
0125     if display_mode == 1,
0126         dispremoteprofiles(dkepath);
0127     else
0128         disp (' ')
0129         info_dke_yp(2,'To list available remote profiles type ''dispremoteprofiles;''')        
0130     end
0131     %
0132 else% remote profiles disabled
0133     %
0134     dkepath.remote = [];
0135     dkepath.profilestr = {};
0136     nrem = 0;
0137     %
0138 end
0139 %
0140 dkepath.remprofiles = cell(1,1 + nrem);
0141 dkepath.distprofiles = cell(1,3 + nrem);
0142 %
0143 dkepath.remprofiles{1} = 'Local interactive calculation';
0144 %
0145 dkepath.distprofiles{1} = 'Sequential';
0146 dkepath.distprofiles{2} = 'MDCE Job scheduler';
0147 dkepath.distprofiles{3} = 'MDCE parfor';
0148 %
0149 for irem = 1:nrem,
0150     dkepath.remprofiles{irem+1} = dkepath.profilestr{irem};
0151     dkepath.distprofiles{irem+3} = ['batch jobs on ',dkepath.profilestr{irem}];
0152 end
0153 %
0154 
0155         
0156

Community support and wiki are available on Redmine. Last update: 18-Apr-2019.