octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: wait_for_file ??


From: Shai Ayal
Subject: Re: wait_for_file ??
Date: Fri, 3 Sep 2010 09:07:01 +0300

On Fri, Sep 3, 2010 at 8:45 AM, Michael D Godfrey
<address@hidden> wrote:
> On 09/02/2010 04:57 AM, Ben Abbott wrote:
>
> Pls try the attached.
>
> When not using Gnuplot, I've replaced the drawnow() with
> drawnow("eps","/dev/null")
>
> Here are my results:
>
> 1. When I run tests using ssh within our lab (everything is on 1Gb ethernet)
> I find
>     no problems with the code as in your changesets using ssh.
>
> 2. When I run from my DSL line at home I get the following.
>
> First, here is an example of my modified __wait_for_file:
> function __wait_for_file__ (filename, delay)
>
>   if (nargin < 2)
>     ## FIXME -- is 1 second sufficient?
>     delay = 1.0;
>   endif
>
>   max_iter = 10;
>
>   status = 0;
>   iter = 0;
>   printf("dev/null used for %s delay: %d\n", filename, delay);
>   if (nargin > 0 && numel (filename) > 0)
>     while (file_is_missing (filename) && iter++ < max_iter)
>       if (strcmp (get (gcf, "__backend__"), "gnuplot"))
>         drawnow ();
>       else
>         drawnow ("eps", "/dev/null");
> ##        drawnow ("eps", filename);
>       endif
>       printf("drawnow iter %d\n", iter);
>       pause (delay / max_iter);
>       rehash ()
>     endwhile
>     if (file_is_missing (filename))
>       status = -1;
>     endif
>   else
>     status = -1;
>     print_usage ();
>     return
>   endif
>
>   if (status < 0)
>     error ("print:filedoesnotexist",
>            "print.m: missing file '%s'.", filename);
>   endif
>
> endfunction
> ====================================
> I put in printf statements and tried 2 drawnow commands.
> And, I tried 2 tests:
> 1. ssh from my home machine.
> 2. Run NX client in home machine so that all the processing in Octave is
>     local to the server -- only the desktop is copied to my home machine.
>
> In these cases the wait loop with drawnow("eps", "/dev/null") always times
> out:
> octave:1> plot(1:20)
> octave:2> print ('gl2ps_t1x.pdf','-dpdf')
> dev/null used for /tmp/oct-xPh3WV.ps delay: 20
> dev/null used for /tmp/oct-FtfuzB.eps delay: 20
> drawnow iter 1
> drawnow iter 2
> drawnow iter 3
> drawnow iter 4
> drawnow iter 5
> drawnow iter 6
> drawnow iter 7
> drawnow iter 8
> drawnow iter 9
> drawnow iter 10
> error: print.m: missing file '/tmp/oct-FtfuzB.eps'.
> error: called from:
> error:   /d/src/octave/hg/octave/scripts/plot/private/__wait_for_file__.m at
> line 59, column 5
> error:   /d/src/octave/hg/octave/scripts/plot/private/__ghostscript__.m at
> line 117, column 3
> warning: print.m: No such file or directory, '/tmp/oct-FtfuzB.eps'.
> error:   /d/src/octave/hg/octave/scripts/plot/__fltk_print__.m at line 142,
> column 14
> error:   /d/src/octave/hg/octave/scripts/plot/print.m at line 332, column 1
> ===================================
> If I change to drawnow("eps", filename); I get using NX:
> octave:1> plot(1:20)
> octave:2> print ('gl2ps_t1x.pdf','-dpdf')
> filename used for /tmp/oct-3HNOzV.ps delay: 1
> filename used for /tmp/oct-nSyK73.eps delay: 1
> drawnow iter 1
> drawnow iter 2
> drawnow iter 3
> drawnow iter 4
> drawnow iter 5
> drawnow iter 6
> drawnow iter 7
> drawnow iter 8
> drawnow iter 9
> octave:3>
> ======================
> Using ssh:
> octave:1> plot(1:20)
> octave:2> print ('gl2ps_t1x.pdf','-dpdf')
> filename used for /tmp/oct-85Dd2k.ps delay: 1
> filename used for /tmp/oct-TuWU4Y.eps delay: 1
> drawnow iter 1
> octave:3>
> ===========================
>
> So, in this environment 2 things are required:
> 1. Use drawnow("eps", filename);
> 2. Increase delay to 2.0 or 4.0, since using 1.0 results in
>     almost hitting the timeout.
>
I don't totally understand what is going on, but the factors to consider are:
1. if the file output device is slow (i.e. nfs over a slow or high
latency network), it may take some time to create the file
2. since OpenGL is part of the process of file creation (gl2ps just
plugs in into OpenGL), and OpenGL is a component of the X-server,
having a remote X-session , whether over ssh or nx (which adds another
layer of compression on top of ssh) will also affect file creation
speed.

Perhaps the best way is not to increase the delay, since this would
penalize all users -- just keep 1 sec delay and raise max_iter to 100.
Just so the users don't get mad at the console, print a warning every
15 iterations.

Shai



reply via email to

[Prev in Thread] Current Thread [Next in Thread]