I do this kind of thing under control of make. If you organize the individual pieces as separate targets then make -k will keep going and make -j can be used to run things in parallel. R can be made to throw an error with something like this:

egTarget:       
        @$(MKDIR) $(FLAGS)
        @echo "library(tools); z <- doSomething() ; \
          if (0 == length(capture.output(z))) q('no', status=0) else \
           {print(z); q('no', status=1)} "  | R --vanilla --slave 
>$(FLAGS)/[EMAIL PROTECTED]
        @mv  $(FLAGS)/[EMAIL PROTECTED] $(FLAGS)/$@
        @touch $(FLAGS)/$@ # better time stamp in some parallel situations

In this example I am assuming that printing z has zero length output if everything was ok, but you could set up different situations, and you will probably want to use try() in doSomething().

HTH.
Paul Gilbert

On Sun, Jul 6, 2008 at 7:36 PM, Tudor Bodea <[EMAIL PROTECTED]> wrote:

Dear useRs:

Please provide me with your thoughts on an issue related to the design of a
production level system.  For example, let's suppose that I need to run the
same R script for a finite sequence of items (e.g., in the energy industry, I
may need to asses the profitability of all gas stations in the state of
Florida).  For each of the items, the R script accesses some remote databases,
gets all the necessary information and processes the data locally.  If the
data for every item in the item list were not corrupted then the R script
would easily do its job.  However, every now and then, the data for some items
is partially missing and the R script returns in such cases an error message
(e.g., for a given gas station, 1 month worth of data is missing from a 3
month decision horizon).  As of right now, using the error option of options
(), whenever an exception happens, the R script sends me an email error
message and kills the current R instance.  As I already figured it out, this
is not necessarily the most efficient way to deal with such exceptions.
Ideally, I would like the script to inform me of the data problem but continue
the analysis with the remaining of the items.  Based on my searches, I believe
that try / stop can answer my problem.  However, if any of you already
implemented such a safe fail system I would really appreciate your taking the
time to (1) share with me what you think constitutes the best practices and/or
(2) point out to me any online material relevant to the topic.  I run various
versions of R on Windows and multiple UNIX platforms.  The list of items is
read from a .csv file and stored in a dataframe.

Thank you.

Tudor


--
Tudor Dan Bodea
Georgia Institute of Technology
School of Civil and Environmental Engineering
Web: http://www.prism.gatech.edu/~gtg757i

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.





====================================================================================

La version française suit le texte anglais.

------------------------------------------------------------------------------------

This email may contain privileged and/or confidential information, and the Bank 
of
Canada does not waive any related rights. Any distribution, use, or copying of 
this
email or the information it contains by other than the intended recipient is
unauthorized. If you received this email in error please delete it immediately 
from
your system and notify the sender promptly by email that you have done so.
------------------------------------------------------------------------------------

Le présent courriel peut contenir de l'information privilégiée ou 
confidentielle.
La Banque du Canada ne renonce pas aux droits qui s'y rapportent. Toute 
diffusion,
utilisation ou copie de ce courriel ou des renseignements qu'il contient par une
personne autre que le ou les destinataires désignés est interdite. Si vous 
recevez
ce courriel par erreur, veuillez le supprimer immédiatement et envoyer sans 
délai à
l'expéditeur un message électronique pour l'aviser que vous avez éliminé de 
votre
ordinateur toute copie du courriel reçu.
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to