octave-maintainers
[Top][All Lists]
Advanced

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

Re: wait_for_file ??


From: Michael D Godfrey
Subject: Re: wait_for_file ??
Date: Thu, 02 Sep 2010 22:45:19 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.8) Gecko/20100806 Fedora/3.1.2-1.fc13 Thunderbird/3.1.2

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




reply via email to

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