octave-maintainers
[Top][All Lists]
Advanced

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

Re: wait_for_file ??


From: Ben Abbott
Subject: Re: wait_for_file ??
Date: Fri, 03 Sep 2010 08:21:35 -0400

On Sep 3, 2010, at 1:45 AM, Michael D Godfrey 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.
> 
> If you decide to use this, it would be good to flag it as ##FIXME##
> -- find out how to ensure the correct sequencing of writing the eps
> before gs tries to read it. --
> 
> Michael

The approach in 1, has a problem. I'd intended that the __wait_for_file__ to be 
used when calling fig2dev, pstoedit (whose input is eps, so that's ok), and 
when appending pages which may be ps or pdf.

Thus, using  `drawnow("eps", filename)' won't work since the format may not be 
"eps", and we'd over-write the file we're waiting for.

Ben








reply via email to

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