From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yu Subject: Re: babel, executing code in background process Date: Mon, 5 Mar 2012 10:33:22 +0100 Message-ID: References: <87booh1c7l.fsf@gmx.com> <87zkbzoag5.fsf@gmx.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=0015174c3af0d64e8704ba7b9ff3 Return-path: Received: from eggs.gnu.org ([208.118.235.92]:39954) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S4UIs-0006mn-Uv for emacs-orgmode@gnu.org; Mon, 05 Mar 2012 04:34:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S4UIl-0008Ny-BS for emacs-orgmode@gnu.org; Mon, 05 Mar 2012 04:34:02 -0500 Received: from mailout-de.gmx.net ([213.165.64.23]:49613) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1S4UIl-0008Lc-1Y for emacs-orgmode@gnu.org; Mon, 05 Mar 2012 04:33:55 -0500 Received: by eeke53 with SMTP id e53so1432759eek.0 for ; Mon, 05 Mar 2012 01:33:52 -0800 (PST) In-Reply-To: <87zkbzoag5.fsf@gmx.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Eric Schulte Cc: Erik Garrison , emacs-orgmode@gnu.org --0015174c3af0d64e8704ba7b9ff3 Content-Type: text/plain; charset=UTF-8 Hello! The trick would be in setting up the post-execution code block handling > (namely results parsing and insertion) to run after external evaluation > has completed. I don't think this is a high priority necessarily. When executing e.g. gnuplot or octave source code blocks for the sake of plotting, I'm usually interested in runtime feedback more than collecting the text afterwards. When doing notebook-Style work, also something like : #+begin_src octave :session *foo* :results silent <> : <> : #+end_src : #+begin_src octave :session *foo* :results value <> : <> : #+end_src would be possible, though of course no convenient solution. My current solution for long-running octave scripts isn't any more convenient though: Define the task as functions and then switch to the session buffer manually and run those interactively. kind regards, Yu 2012/3/2 Eric Schulte > Erik Garrison writes: > > > Hi Eric, > > > > Thanks for the background. It looks like ob-screen may be very limited > in > > that it doesn't > > > > It seems to me that a decent method would behave similarly to the way to > > "M-x compile" works--- another buffer opens in which the compilation > > progresses. Is there any reason why this might not be applicable to the > > way babel works? > > > > The approach you describe above (a process buffer with a filter) would > be one viable approach, perhaps even something as simple as using > `async-shell-command' would be workable. One place to start looking > would be in ob-eval.el for external evaluation and ob-comint for session > based evaluation. > > The trick would be in setting up the post-execution code block handling > (namely results parsing and insertion) to run after external evaluation > has completed. > > If anyone wants to look into the code and write/propose a way forward > I'm happy to help in any way I can. > > Cheers, > > > > > Erik > > > > On Wed, Feb 29, 2012 at 5:55 PM, Eric Schulte > wrote: > > > >> Hi Erik, > >> > >> Currently there is not (to my knowledge) any support for asynchronous > >> code block evaluation. The one possible exception could be ob-screen > >> which I mention only because I don't really know anything about it. > >> > >> This would certainly be a worthwhile feature to add to Org-mode code > >> blocks, however a good implementation (easy to use, robust and > >> cross-language) will be non-trivial to implement. > >> > >> Best, > >> > >> Erik Garrison writes: > >> > >> > Hi, > >> > > >> > I'm just starting to use org-mode and babel to structure exploratory > data > >> > analysis which I do for my work. > >> > > >> > One issue that I've run into is that many of the queries I have to > issue > >> > will take a very long time to complete. > >> > > >> > Is there any method I could use to execute them in a background > process? > >> > > >> > Thanks, > >> > Erik > >> > >> -- > >> Eric Schulte > >> http://cs.unm.edu/~eschulte/ > >> > > -- > Eric Schulte > http://cs.unm.edu/~eschulte/ > > --0015174c3af0d64e8704ba7b9ff3 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hello!
The trick would be in setting up the post-execution code block hand= ling
(namely results parsing and insertion) to run after external evaluation
has completed.=C2=A0
I don't think this i= s a high priority necessarily. When executing e.g. gnuplot or octave source= code blocks for the sake of plotting, I'm usually interested in runtim= e feedback more than collecting the text afterwards. When doing notebook-St= yle work, also something like

=C2=A0 : #+begin_src octave :session *foo* :results silent <<asyn= chronous-header>>
=C2=A0 :=C2=A0=C2=A0 <<Calculate data>&= gt;
=C2=A0 : #+end_src
=C2=A0 : #+begin_src octave :session *foo* :r= esults value <<synchronous-header>>
=C2=A0 :=C2=A0=C2=A0=C2=A0 <<Return data>>
=C2=A0 : #+end_sr= c

would be possible, though of course no convenient solution. My cur= rent solution for long-running octave scripts isn't any more convenient= though: Define the task as functions and then switch to the session buffer= manually and run those interactively.

kind regards, Yu


2012/3/2 E= ric Schulte <e= ric.schulte@gmx.com>
Erik Garrison <erik.garrison@gmail.com> writes:

> Hi Eric,
>
> Thanks for the background. =C2=A0It looks like ob-screen may be very l= imited in
> that it doesn't
>
> It seems to me that a decent method would behave similarly to the way = to
> "M-x compile" works--- another buffer opens in which the com= pilation
> progresses. =C2=A0Is there any reason why this might not be applicable= to the
> way babel works?
>

The approach you describe above (a process buffer with a filter) woul= d
be one viable approach, perhaps even something as simple as using
`async-shell-command' would be workable. =C2=A0One place to start looki= ng
would be in ob-eval.el for external evaluation and ob-comint for session based evaluation.

The trick would be in setting up the post-execution code block handling
(namely results parsing and insertion) to run after external evaluation
has completed.

If anyone wants to look into the code and write/propose a way forward
I'm happy to help in any way I can.

Cheers,

>
> Erik
>
> On Wed, Feb 29, 2012 at 5:55 PM, Eric Schulte <eric.schulte@gmx.com> wrote:
>
>> Hi Erik,
>>
>> Currently there is not (to my knowledge) any support for asynchron= ous
>> code block evaluation. =C2=A0The one possible exception could be o= b-screen
>> which I mention only because I don't really know anything abou= t it.
>>
>> This would certainly be a worthwhile feature to add to Org-mode co= de
>> blocks, however a good implementation (easy to use, robust and
>> cross-language) will be non-trivial to implement.
>>
>> Best,
>>
>> Erik Garrison <erik.= garrison@gmail.com> writes:
>>
>> > Hi,
>> >
>> > I'm just starting to use org-mode and babel to structure = exploratory data
>> > analysis which I do for my work.
>> >
>> > One issue that I've run into is that many of the queries = I have to issue
>> > will take a very long time to complete.
>> >
>> > Is there any method I could use to execute them in a backgrou= nd process?
>> >
>> > Thanks,
>> > Erik
>>
>> --
>> Eric Schulte
>> http:= //cs.unm.edu/~eschulte/
>>

--
Eric Schulte
http://cs.unm.= edu/~eschulte/


--0015174c3af0d64e8704ba7b9ff3--