Re: [R] Way to make R idle for some time and try something again later
At 6:44 AM +0100 7/30/05, Prof Brian Ripley wrote: This depends on what else is going on. My guess is that you are running the Aqua GUI, and it is servicing the GUI which is taking the time, not R itself. Actually, no, I am not using the Aqua GUI. Not even a framework build: ../source/configure --enable-R-shlib --with-blas=-framework vecLib --with-lapack --enable-R-framework=no On all of Linux, Solaris and Windows (RGui or Rterm) Sys.sleep() does use very close to zero resources at the beginning of a session, but things may be different if e.g. tcltk widgets are in use. On Fri, 29 Jul 2005, Don MacQueen wrote: I done something very similar -- have R watch a file, and whenever new data is added to the file, read the new data from the file. In my case, new data was arriving once per minute, so I needed to have R wait about a minute before looking for new data. On my unix-based system, I found that if I usd I don't think your system IS `unix-based' (Unix is a trademark, and MacOS X is based on a rather different kernel). It is quite possible that it is behaving differently from the POSIX description of Unix system calls on which R is based for Unix-alikes. Sys.sleep( N ) then cpu usage immediately went up drastically. If the the system is otherwise fairly idle, cpu usage goes up to nearly 100%. A cpu monitor shows that R is using the cpu cycles. If I use instead system('sleep N') cpu usage does not go up. Does that freeze the GUI? It certainly freezes tcltk widgets on Unix. I've never tried it while using tcltk widgets. (and apologies for the delay; I've been away from the office for two weeks) (where N is the number of seconds to sleep) version _ platform powerpc-apple-darwin7.9.0 arch powerpc os darwin7.9.0 system powerpc, darwin7.9.0 status major2 minor1.1 year 2005 month06 day 20 language R At 12:13 PM -0700 7/29/05, Tae-Hoon Chung wrote: Hi, All; I have a question. In R, what is the best way to make R idle for a while and try something again later? For example, suppose there is an R job which accesses a file that may be shared with other active jobs. So when the file is being accessed by other job, your job will not be able to access the file and your job will crash because of that. To avoid this, you want your job to try to access the file repeatedly with some time interval, say every 10 seconds or something like that. Which is the best way to do this in R? -- Brian D. Ripley, [EMAIL PROTECTED] 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, UKFax: +44 1865 272595 -- -- Don MacQueen Environmental Protection Department Lawrence Livermore National Laboratory Livermore, CA, USA __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Way to make R idle for some time and try something again later
Hi, All; I have a question. In R, what is the best way to make R idle for a while and try something again later? For example, suppose there is an R job which accesses a file that may be shared with other active jobs. So when the file is being accessed by other job, your job will not be able to access the file and your job will crash because of that. To avoid this, you want your job to try to access the file repeatedly with some time interval, say every 10 seconds or something like that. Which is the best way to do this in R? Thanks in advance, Tae-Hoon Chung Post-Doctoral Researcher Translational Genomics Research Institute (TGen) 445 N. 5th Street (Suite 530) Phoenix, AZ 85004 1-602-343-8724 (Direct) 1-480-323-9820 (Mobile) 1-602-343-8840 (Fax) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Way to make R idle for some time and try something again later
On 7/29/2005 3:13 PM, Tae-Hoon Chung wrote: Hi, All; I have a question. In R, what is the best way to make R idle for a while and try something again later? For example, suppose there is an R job which accesses a file that may be shared with other active jobs. So when the file is being accessed by other job, your job will not be able to access the file and your job will crash because of that. To avoid this, you want your job to try to access the file repeatedly with some time interval, say every 10 seconds or something like that. Which is the best way to do this in R? Sys.sleep(10) should give you a 10 second pause with very little impact on the system. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Way to make R idle for some time and try something again later
Which operating system are you using ? See help(Sys.sleep), which might be what you want but there may be other ways in determining if a file is being accessed by another program. Regards, Adai On Fri, 2005-07-29 at 12:13 -0700, Tae-Hoon Chung wrote: Hi, All; I have a question. In R, what is the best way to make R idle for a while and try something again later? For example, suppose there is an R job which accesses a file that may be shared with other active jobs. So when the file is being accessed by other job, your job will not be able to access the file and your job will crash because of that. To avoid this, you want your job to try to access the file repeatedly with some time interval, say every 10 seconds or something like that. Which is the best way to do this in R? Thanks in advance, Tae-Hoon Chung Post-Doctoral Researcher Translational Genomics Research Institute (TGen) 445 N. 5th Street (Suite 530) Phoenix, AZ 85004 1-602-343-8724 (Direct) 1-480-323-9820 (Mobile) 1-602-343-8840 (Fax) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Way to make R idle for some time and try something again later
Dear Tae-Hoon: 1. RSiteSearch('wait') will tell you that Sys.sleep() is what you want. Although this list is terrific, R's built-in help/search tools should always be tried first (they're faster when you hit the right search term). 2. The other part of the puzzle is ?try -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA The business of the statistician is to catalyze the scientific learning process. - George E. P. Box -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tae-Hoon Chung Sent: Friday, July 29, 2005 12:13 PM To: RHelp Subject: [R] Way to make R idle for some time and try something again later Hi, All; I have a question. In R, what is the best way to make R idle for a while and try something again later? For example, suppose there is an R job which accesses a file that may be shared with other active jobs. So when the file is being accessed by other job, your job will not be able to access the file and your job will crash because of that. To avoid this, you want your job to try to access the file repeatedly with some time interval, say every 10 seconds or something like that. Which is the best way to do this in R? Thanks in advance, Tae-Hoon Chung Post-Doctoral Researcher Translational Genomics Research Institute (TGen) 445 N. 5th Street (Suite 530) Phoenix, AZ 85004 1-602-343-8724 (Direct) 1-480-323-9820 (Mobile) 1-602-343-8840 (Fax) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Way to make R idle for some time and try something again later
I done something very similar -- have R watch a file, and whenever new data is added to the file, read the new data from the file. In my case, new data was arriving once per minute, so I needed to have R wait about a minute before looking for new data. On my unix-based system, I found that if I usd Sys.sleep( N ) then cpu usage immediately went up drastically. If the the system is otherwise fairly idle, cpu usage goes up to nearly 100%. A cpu monitor shows that R is using the cpu cycles. If I use instead system('sleep N') cpu usage does not go up. (where N is the number of seconds to sleep) version _ platform powerpc-apple-darwin7.9.0 arch powerpc os darwin7.9.0 system powerpc, darwin7.9.0 status major2 minor1.1 year 2005 month06 day 20 language R At 12:13 PM -0700 7/29/05, Tae-Hoon Chung wrote: Hi, All; I have a question. In R, what is the best way to make R idle for a while and try something again later? For example, suppose there is an R job which accesses a file that may be shared with other active jobs. So when the file is being accessed by other job, your job will not be able to access the file and your job will crash because of that. To avoid this, you want your job to try to access the file repeatedly with some time interval, say every 10 seconds or something like that. Which is the best way to do this in R? Thanks in advance, Tae-Hoon Chung Post-Doctoral Researcher Translational Genomics Research Institute (TGen) 445 N. 5th Street (Suite 530) Phoenix, AZ 85004 1-602-343-8724 (Direct) 1-480-323-9820 (Mobile) 1-602-343-8840 (Fax) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- -- Don MacQueen Environmental Protection Department Lawrence Livermore National Laboratory Livermore, CA, USA __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Way to make R idle for some time and try something again later
Don MacQueen wrote: I done something very similar -- have R watch a file, and whenever new data is added to the file, read the new data from the file. In my case, new data was arriving once per minute, so I needed to have R wait about a minute before looking for new data. On my unix-based system, I found that if I usd Sys.sleep( N ) then cpu usage immediately went up drastically. If the the system is otherwise fairly idle, cpu usage goes up to nearly 100%. A cpu monitor shows that R is using the cpu cycles. This is system-specific. In Windows, CPU usage measures in at 0% while in a Sys.sleep loop. (It's not really zero, because R checks for events to update the display, but it's very low). Duncan Murdoch If I use instead system('sleep N') cpu usage does not go up. (where N is the number of seconds to sleep) version _ platform powerpc-apple-darwin7.9.0 arch powerpc os darwin7.9.0 system powerpc, darwin7.9.0 status major2 minor1.1 year 2005 month06 day 20 language R At 12:13 PM -0700 7/29/05, Tae-Hoon Chung wrote: Hi, All; I have a question. In R, what is the best way to make R idle for a while and try something again later? For example, suppose there is an R job which accesses a file that may be shared with other active jobs. So when the file is being accessed by other job, your job will not be able to access the file and your job will crash because of that. To avoid this, you want your job to try to access the file repeatedly with some time interval, say every 10 seconds or something like that. Which is the best way to do this in R? Thanks in advance, Tae-Hoon Chung Post-Doctoral Researcher Translational Genomics Research Institute (TGen) 445 N. 5th Street (Suite 530) Phoenix, AZ 85004 1-602-343-8724 (Direct) 1-480-323-9820 (Mobile) 1-602-343-8840 (Fax) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Way to make R idle for some time and try something again later
This depends on what else is going on. My guess is that you are running the Aqua GUI, and it is servicing the GUI which is taking the time, not R itself. On all of Linux, Solaris and Windows (RGui or Rterm) Sys.sleep() does use very close to zero resources at the beginning of a session, but things may be different if e.g. tcltk widgets are in use. On Fri, 29 Jul 2005, Don MacQueen wrote: I done something very similar -- have R watch a file, and whenever new data is added to the file, read the new data from the file. In my case, new data was arriving once per minute, so I needed to have R wait about a minute before looking for new data. On my unix-based system, I found that if I usd I don't think your system IS `unix-based' (Unix is a trademark, and MacOS X is based on a rather different kernel). It is quite possible that it is behaving differently from the POSIX description of Unix system calls on which R is based for Unix-alikes. Sys.sleep( N ) then cpu usage immediately went up drastically. If the the system is otherwise fairly idle, cpu usage goes up to nearly 100%. A cpu monitor shows that R is using the cpu cycles. If I use instead system('sleep N') cpu usage does not go up. Does that freeze the GUI? It certainly freezes tcltk widgets on Unix. (where N is the number of seconds to sleep) version _ platform powerpc-apple-darwin7.9.0 arch powerpc os darwin7.9.0 system powerpc, darwin7.9.0 status major2 minor1.1 year 2005 month06 day 20 language R At 12:13 PM -0700 7/29/05, Tae-Hoon Chung wrote: Hi, All; I have a question. In R, what is the best way to make R idle for a while and try something again later? For example, suppose there is an R job which accesses a file that may be shared with other active jobs. So when the file is being accessed by other job, your job will not be able to access the file and your job will crash because of that. To avoid this, you want your job to try to access the file repeatedly with some time interval, say every 10 seconds or something like that. Which is the best way to do this in R? -- Brian D. Ripley, [EMAIL PROTECTED] 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, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html