File: FinishQueue.m

package info (click to toggle)
openems 0.0.35+dfsg.1-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 6,288 kB
  • sloc: cpp: 40,259; yacc: 580; lex: 350; makefile: 258; sh: 169; ruby: 19
file content (40 lines) | stat: -rw-r--r-- 933 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
function [queue] = FinishQueue(queue, query_time)
% function [queue] = FinishQueue(queue, <query_time>)
%
% Wait for the given queue to finish.
%
% Parameter:
%   query_time (optional): time interval to check for finished tasks
%                          (in seconds, default is 5)
%
% For more details see: InitQueue
%
% See also: InitQueue, ResultsQueue, Add2Queue, RunOpenEMS
%
% openEMS matlab interface
% -----------------------
% author: Thorsten Liebig

if ~isfield(queue,'jobs')
    return
end

if (nargin<2)
    query_time = 5;
end

numJobs = numel(queue.jobs);

if (queue.verbose>=1)
    disp(['FinishQueue: Waiting for ' num2str(sum(~queue.jobs_finished)) ' of ' num2str(numJobs) ' jobs to finish...']);
end

running = numel(queue.jobs_finished) - sum(queue.jobs_finished);

while sum(running)>0
    [queue running] = CheckQueue(queue, query_time);
end

if (queue.verbose>=1)
    disp(['FinishQueue: All jobs done!'])
end