An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20091120/ce8f478b/attachment-0001.pl>
can R scripts detect signals sent by the task scheduler ?
6 messages · mauede at alice.it, Barry Rowlingson, Dirk Eddelbuettel +1 more
On Fri, Nov 20, 2009 at 1:25 PM, <mauede at alice.it> wrote:
In general, is it possible to run R scripts through cron jobs ?
Yes, the only problem might be if you use anything that needs a graphics window. In the old days you needed an X11 display to create png graphics with the png() function, but not any more. I'm not sure if yo need an X11 system for anything apart from showing graphs. But I don't know everything.
Is it possible to make ?the script detect the system interrupt, save its current status and then exit so that next time it is rescheduled it can pick up from where it left ?
?Signals:
Interrupting Execution of R
Description:
On receiving ?SIGUSR1? R will save the workspace and quit.
?SIGUSR2? has the same result except that the ?.Last? function and
?on.exit? expressions will not be called.
So if you can send that signal to your process you might be in luck.
However if by 'system interrupt' you mean the SIGQUIT signal, then I'm
not sure that R can trap interrupts to that extent. You might want to
see if your operating system supports 'checkpointing', in which case
any process can be saved and restarted.
If by 'system interrupt' you mean SIGKILL (signal 9) then you are very stuck.
What is going on in your system? Are you trying to checkpoint if the
machine is shut down?
Barry
On 20 November 2009 at 14:25, mauede at alice.it wrote:
| In general, is it possible to run R scripts through cron jobs ?
| Is it possible to make the script detect the system interrupt, save its current status and then exit so that next time it is rescheduled it can pick up from where it left ?
| Examples, if any, are more then welcome.
You are conflating a few things here:
i) yes, you can run R from cron or task scheduler -- that is how R
updates webpages on the R site, how CRANberries is updated etc pp
ii) to a program, it doesn't matter who started it, be it the task
scheduler or interactive use (modulo correcly setup PATH et al
variables
iii) R and its predecessor systems have stopped and resumed for decades,
look at help(save.image) or help(save)
iv) Snapshotting running applications and resuming them elsewhere is
an operating system task -- some OSs do this, but typically not
in consumer grade versions.
Hope this helps, Dirk
Three out of two people have difficulties with fractions.
On Fri, 20 Nov 2009, Barry Rowlingson wrote:
On Fri, Nov 20, 2009 at 1:25 PM, <mauede at alice.it> wrote:
In general, is it possible to run R scripts through cron jobs ?
Yes, the only problem might be if you use anything that needs a graphics window. In the old days you needed an X11 display to create png graphics with the png() function, but not any more. I'm not sure if yo need an X11 system for anything apart from showing graphs. But I don't know everything.
Some package authors assume such a display to install their packages (and a few of those may not have a choice as some graphics libraries seem to need one to be loaded). So my dept's automated package updater scripts run from cron, and start (and stop) a Xvfb X server to get around that. [...]
Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20091121/b0e74664/attachment-0001.pl>
On Fri, Nov 20, 2009 at 11:01 PM, <mauede at alice.it> wrote:
I have just updated R version to 2.10 for Windows. I cannot find package "fork" which seems to include? the exception handling functions. The list that pops up when I select Install Package does not contain any fork package (even spelt with capital letters).? Where am I supposed to get it from ?
I suspect there's no such thing for Windows. Process control and signalling is something very different between operating systems, so someone needs to write a dedicated Windows version of that package. See here: http://ftp.heanet.ie/mirrors/cran.r-project.org/web/packages/fork/index.html Barry