Skip to content

Commit

Permalink
release: Fixed bug with satellite processes not having proper paths s…
Browse files Browse the repository at this point in the history
…et up. Also decreased amount of time frontend process waits for satellites to come online. Also simplified installWavesurferForNow.
  • Loading branch information
adamltaylor committed Oct 30, 2015
1 parent 77ca519 commit 00850ae
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 15 deletions.
34 changes: 30 additions & 4 deletions +ws/WavesurferModel.m
Expand Up @@ -166,17 +166,28 @@
self.RefillerIPCSubscriber_.setDelegate(self) ;
self.RefillerIPCSubscriber_.connect(ws.WavesurferModel.RefillerIPCPublisherPortNumber) ;

% Start the other Matlab processes
system('start matlab -nojvm -minimize -r "looper=ws.Looper(); looper.runMainLoop(); clear; quit()"');
system('start matlab -nojvm -minimize -r "refiller=ws.Refiller(); refiller.runMainLoop(); clear; quit()"');
% Start the other Matlab processes, passing the relevant
% path information to make sure they can find all the .m
% files they need.
[pathToRepoRoot,pathToMatlabZmqLib] = ws.WavesurferModel.pathNamesThatNeedToBeOnSearchPath() ;
looperLaunchString = ...
sprintf('start matlab -nojvm -minimize -r "addpath(''%s''); addpath(''%s''); looper=ws.Looper(); looper.runMainLoop(); clear; quit()"' , ...
pathToRepoRoot , ...
pathToMatlabZmqLib ) ;
system(looperLaunchString) ;
refillerLaunchString = ...
sprintf('start matlab -nojvm -minimize -r "addpath(''%s''); addpath(''%s''); refiller=ws.Refiller(); refiller.runMainLoop(); clear; quit()"' , ...
pathToRepoRoot , ...
pathToMatlabZmqLib ) ;
system(refillerLaunchString) ;

%system('start matlab -nojvm -minimize -r "looper=ws.Looper(); looper.runMainLoop(); quit()"');
%system('start matlab -r "dbstop if error; looper=ws.Looper(); looper.runMainLoop(); quit()"');
%system('start matlab -nojvm -minimize -r "refiller=Refiller(); refiller.runMainLoop();"');

% Start broadcasting pings until the satellite processes
% respond
nPingsMax=60 ;
nPingsMax=20 ;
isLooperAlive=false;
isRefillerAlive=false;
for iPing = 1:nPingsMax ,
Expand Down Expand Up @@ -2129,6 +2140,21 @@ function mimicUserSettings_(self, other)
end % function
end % public methods block

methods (Static)
function [pathToRepoRoot,pathToMatlabZmqLib] = pathNamesThatNeedToBeOnSearchPath()
% Allow user to invoke Wavesurfer from the Matlab command line, for
% this Matlab session only. Modifies the user's Matlab path, but does
% not safe the modified path.

pathToWavesurferModel = mfilename('fullpath') ;
pathToWsModulerFolder = fileparts(pathToWavesurferModel) ; % should be +ws folder
pathToRepoRoot = fileparts(pathToWsModulerFolder) ; % should be repo root
pathToMatlabZmqLib = fullfile(pathToRepoRoot,'matlab-zmq','lib') ;

%result = { pathToRepoRoot , pathToMatlabZmqLib } ;
end
end % static methods block

end % classdef


22 changes: 11 additions & 11 deletions installWavesurferForNow.m
Expand Up @@ -3,16 +3,16 @@ function installWavesurferForNow()
% this Matlab session only. Modifies the user's Matlab path, but does
% not safe the modified path.

wavesurferPath = which('wavesurfer');
%wavesurferPath = which('wavesurfer');
pathToInstallWavesurferForNow = mfilename('fullpath');

% % This really shouldn't happen given that this function is distributed in the
% % same directory as wavesurfer.m.
% if isempty(pathToInstallWavesurferForNow) ,
% error('wavesurfer:configureFailure', 'Wavesurfer does not appear to be installed correctly. wavesurfer.m is missing.\n');
% end

% This really shouldn't happen given that this function is distributed in the
% same directory as wavesurfer.m.
if isempty(wavesurferPath) ,
error('wavesurfer:configureFailure', 'Wavesurfer does not appear to be installed correctly. wavesurfer.m is missing.\n');
end

wavesurferParentFolder=fileparts(wavesurferPath);
addpath(wavesurferParentFolder);
%addpath(fullfile(wavesurferParentFolder,'wavesurfer_guis'));
addpath(fullfile(wavesurferParentFolder,'matlab-zmq','lib'));
repoRootFolderName=fileparts(pathToInstallWavesurferForNow);
addpath(repoRootFolderName);
addpath(fullfile(repoRootFolderName,'matlab-zmq','lib'));
end

0 comments on commit 00850ae

Please sign in to comment.