remote_tsbase

PURPOSE ^

SYNOPSIS ^

function [ydate,yout1,yout2,yout3,yout4,yout5]= remote_tsbase(shotnumber,signal,remote_enforce,cluster)

DESCRIPTION ^

LUKE -  Function which load signals from Tore Supra database (work for WEST shot date only). May be used within CEA network or outside by SSH bridge

   Input:

        shotnumber: shot number (ex: 45525)
        signal : type of signal (ex: 'gphyb')
        remote_enforce : enforce remote calculation
           (default = 0)
       cluster : CEA cluster (SIRRAH) or CEA cluster (ANDROMEDE)

   Output:

        ydate: shot date (if only shot number is given, it answers the shot date)
       yout1: signal vector 1 
       yout2: signal vector 2 (may be time vector)
       yout3: signal vector 3 (may be time vector or empty)
       yout4: signal vector 4 (may be time vector or empty)
       yout5: signal vector 5 (may be time vector or empty)

 by Y.Peysson (CEA/DSM/IRFM) <yves.peysson@cea.fr>

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [ydate,yout1,yout2,yout3,yout4,yout5]= remote_tsbase(shotnumber,signal,remote_enforce,cluster)
0002 %
0003 %LUKE -  Function which load signals from Tore Supra database (work for WEST shot date only). May be used within CEA network or outside by SSH bridge
0004 %
0005 %   Input:
0006 %
0007 %        shotnumber: shot number (ex: 45525)
0008 %        signal : type of signal (ex: 'gphyb')
0009 %        remote_enforce : enforce remote calculation
0010 %           (default = 0)
0011 %       cluster : CEA cluster (SIRRAH) or CEA cluster (ANDROMEDE)
0012 %
0013 %   Output:
0014 %
0015 %        ydate: shot date (if only shot number is given, it answers the shot date)
0016 %       yout1: signal vector 1
0017 %       yout2: signal vector 2 (may be time vector)
0018 %       yout3: signal vector 3 (may be time vector or empty)
0019 %       yout4: signal vector 4 (may be time vector or empty)
0020 %       yout5: signal vector 5 (may be time vector or empty)
0021 %
0022 % by Y.Peysson (CEA/DSM/IRFM) <yves.peysson@cea.fr>
0023 %
0024 if nargin < 2,
0025      error('Not enough input argument in remote_tsbase.m');
0026 end
0027 if nargin < 3
0028     remote_enforce = 0;
0029     cluster = 'ANDROMEDE';
0030 end
0031 if nargin < 4
0032     cluster = 'ANDROMEDE';
0033 end
0034 %
0035 remote_profile_ANDROMEDE = remote_CEA_ANDROMEDE;
0036 remote_profile_SIRRAH = remote_CEA_SIRRAH;
0037 %
0038 if remote_enforce == 0,
0039     [err_ANDROMEDE,txt_ANDROMEDE] = unix(['ssh -Y ',remote_profile_ANDROMEDE.remoteuser,'@',remote_profile_ANDROMEDE.host,' "hostname"']);%Zone partenaire
0040     [err_SIRRAH,txt_SIRRAH] = unix(['ssh -Y ',remote_profile_SIRRAH.remoteuser,'@',remote_profile_SIRRAH.host,' "hostname"']);%Zone intra
0041     err = err_ANDROMEDE + err_SIRRAH;
0042     %
0043     if err == 0, 
0044         txt = txt_SIRRAH;%the client is connected to CEA intranet
0045     else
0046         if err_ANDROMEDE == 0,
0047             txt = txt_ANDROMEDE;%the client computer can connected directly to CEA extranet.
0048         else
0049             txt = '';%the client computer cannot connected directly to CEA extranet. May be by a SSH bridge.
0050         end
0051     end
0052 else
0053     err = 0;
0054     err_ANDROMEDE = '';
0055     err_SIRRAH = '';
0056     txt = '';
0057 end
0058 %
0059 
0060 %
0061 ydate = [];
0062 yout1 = [];
0063 yout2 = [];
0064 yout3 = [];
0065 yout4 = [];
0066 yout5 = [];
0067 %
0068 [err_local,txt_local] = unix('hostname');%local client machine
0069 %
0070 if strcmp(txt_local,txt),%client on the server machine. Direct connection possible
0071     remote_enforce = 0;
0072 end
0073 %
0074 if err==0,
0075     %
0076     if ~isempty(txt) && remote_enforce == 0,%when connected directly from the CEA network
0077             [yout1,yout2,yout3,yout4,yout5] = tsbase(shotnumber,signal);%
0078             [ydate] = tsdate(shotnumber);%
0079             err = '';
0080             job = '';
0081     else
0082         dkepath = load_structures_yp('dkepath','','');
0083         %
0084         for iprof = 1: length(dkepath.profilestr)
0085             if strcmp(cluster,'ANDROMEDE'),
0086                 if strfind(dkepath.profilestr{iprof},'CEA_ANDROMEDE : direct'),%connect to ANDROMEDE
0087                     break
0088                 end
0089             elseif strcmp(cluster,'SIRRAH'),
0090                 if strfind(dkepath.profilestr{iprof},'CEA_SIRRAH : direct'),%connect to SIRRAH
0091                     break
0092                 end
0093             end
0094         end
0095         %
0096         scheduler.remnum = iprof;
0097         %
0098         remote = dkepath.remote(scheduler.remnum);
0099         if remote_enforce == 0
0100             remote.link_mode='';
0101         else
0102             remote.link_mode=1;
0103         end
0104         job = matstandardjob_jd('runmat');
0105         if nargin > 1,
0106             [err,job,yout1,yout2,yout3,yout4,yout5] = matremote_jd('tsbase',{shotnumber,signal},remote,job);
0107         else
0108             [err,job,ydate] = matremote_jd('tsdate',{shotnumber},remote,job);
0109         end
0110         %
0111     end    
0112 end

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