various fixes to dynareParallelDelete.m
- did not account for cases when username not set (namely when remote is localhost) - did not account for cases when remote directory was not set (namely when remote is localhost) - added unnecessary `filesep` to `pname` when `pname` was empty - ignore unused output arguments (it is necessary to explicitly ignore them to prevent unwanted output from the `system` call) - globbing did not work as it was expanded on the calling machine not the remote; pass call to `bash -c` to handle thistime-shift
parent
3d9fe36ec5
commit
7a02b3bfd2
|
@ -11,7 +11,7 @@ function dynareParallelDelete(fname,pname,Parallel)
|
||||||
% None
|
% None
|
||||||
%
|
%
|
||||||
%
|
%
|
||||||
% Copyright (C) 2009-2017 Dynare Team
|
% Copyright (C) 2009-2020 Dynare Team
|
||||||
%
|
%
|
||||||
% This file is part of Dynare.
|
% This file is part of Dynare.
|
||||||
%
|
%
|
||||||
|
@ -28,25 +28,31 @@ function dynareParallelDelete(fname,pname,Parallel)
|
||||||
% You should have received a copy of the GNU General Public License
|
% You should have received a copy of the GNU General Public License
|
||||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
if nargin ==0
|
if nargin ~= 3
|
||||||
disp('dynareParallelDelete(fname)')
|
disp('dynareParallelDelete(fname,pname,Parallel)')
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if nargin ==1
|
if ~isempty(pname)
|
||||||
pname='';
|
|
||||||
else
|
|
||||||
pname=[pname,filesep];
|
pname=[pname,filesep];
|
||||||
end
|
end
|
||||||
|
|
||||||
for indPC=1:length(Parallel)
|
for indPC=1:length(Parallel)
|
||||||
if ~ispc || strcmpi('unix',Parallel(indPC).OperatingSystem)
|
if ~ispc || strcmpi('unix',Parallel(indPC).OperatingSystem)
|
||||||
if ~isempty(Parallel(indPC).Port)
|
if ~isempty(Parallel(indPC).Port)
|
||||||
ssh_token = ['-p ',Parallel(indPC).Port];
|
ssh_token = ['-p ',Parallel(indPC).Port ' '];
|
||||||
else
|
else
|
||||||
ssh_token = '';
|
ssh_token = ' ';
|
||||||
end
|
end
|
||||||
[NonServeS NonServeD]=system(['ssh ',ssh_token,' ',Parallel(indPC).UserName,'@',Parallel(indPC).ComputerName,' rm -f ',Parallel(indPC).RemoteDirectory,'/',pname,fname]);
|
username = Parallel(indPC).UserName;
|
||||||
|
if ~isempty(username)
|
||||||
|
username = [username '@'];
|
||||||
|
end
|
||||||
|
directory = Parallel(indPC).RemoteDirectory;
|
||||||
|
if ~isempty(directory)
|
||||||
|
directory = [directory '/'];
|
||||||
|
end
|
||||||
|
[~, ~] = system(['ssh ',ssh_token,username,Parallel(indPC).ComputerName,' ''/bin/bash --norc -c "rm -f ',directory,pname,fname,'"''']);
|
||||||
else
|
else
|
||||||
fname_temp=['\\',Parallel(indPC).ComputerName,'\',Parallel(indPC).RemoteDrive,'$\',Parallel(indPC).RemoteDirectory,'\',pname,fname];
|
fname_temp=['\\',Parallel(indPC).ComputerName,'\',Parallel(indPC).RemoteDrive,'$\',Parallel(indPC).RemoteDirectory,'\',pname,fname];
|
||||||
if exist(fname_temp,'file')
|
if exist(fname_temp,'file')
|
||||||
|
|
Loading…
Reference in New Issue