emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] remote plot with local output?


From: Charles C. Berry
Subject: Re: [O] remote plot with local output?
Date: Mon, 14 Sep 2015 13:42:55 -0700
User-agent: Alpine 2.20 (OSX 67 2015-01-07)

On Tue, 15 Sep 2015, Benda Xu wrote:

Dear All,

I am looking for a way to configure org-babel so that a program runs
remotely and outputs locally.  An example is

 #+NAME: line
  | 1 |
  | 2 |
  | 3 |

 #+BEGIN_SRC python :results file :var dt=line :dir /ipmuap02:/tmp
   from matplotlib import pylab as plt
   plt.plot(dt)
   plt.savefig("line.png")
   return "line.png"
 #+END_SRC

 #+RESULTS:
 [[file:/scp:ipmuap02:/tmp/line.png]]

I would like to embed this figure into my note.  The example above need
to fetch the figure from the remote host on each exportation, which is
very sensitive to the network environment.

I cannot make the plot locally, because (unlike the over-simplified
example) some potentially big data are only available remotely.

My solution is to cache the result (:cache yes), execute the code block,
copy the output file to localhost, update the #+RESULTS link to the
local one, manually.  Now I am facing many such tasks and feel like
automating that.


What is the recommended way for copying the file output from an remote
execution code block back to localhost?


Look at the :post header arg

        (info "(org) post")

You write a src block that extracts the remote file name from *this*,
creates a local file name from it, copies the remote file to the local host, then substitutes the local file name in *this* and uses it as the return value.

Use the name of that src block as the argument to :post

HTH,

Chuck



reply via email to

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