Skip to content
Back to formatted view

Raw Message

Message-ID: <op.vdzc8dx6yqqyib@amazonas.geoecology.uni-potsdam.de>
Date: 2010-06-08T12:06:03Z
From: Melwin
Subject: file closing timing problem
In-Reply-To: <8AFB4A1479ECD246A26FAA98CC48A93C018FE2A1@granite1604>

I am not sure if this belongs on this list, anyway:

Wait until somefile.dat (i.e. a file that is supposed to be modified by  
swat_edit.exe) has been renewed:

while ( difftime(Sys.time(),file.info("somefile.dat")$atime,units="sec") >  
30 )
	Sys.sleep(1)
#to be placed between your two system calls

cheers,

Melwin

Am 08.06.2010, 13:38 Uhr, schrieb John Joseph <John.Joseph at utsa.edu>:

> Hello,
> I hope someone can help me with what seems like a simple problem.  I  
> have the following code:
> system("swat_edit.exe", wait=FALSE, invisible=FALSE)
> system("swat2005.exe")
> In the first line, swat_edit.exe edits hundreds of input files, which  
> are then to be used by swat2005.exe in its calculations.  The problem is  
> that before swat_edit.exe finishes editing and closing all the input  
> files, swat2005.exe begins, and an error occurs that such-and-such an  
> input file is already in use so that swat2005.exe cannot run.
> Naturally, one would think that changing wait=FALSE ot wait=TRUE might  
> solve the problem.  But wait = TRUE gives an error.
> I am using Windows 7 and Windows XP, and this problem occurs with both.   
> I've inserted a time-delaying statement, z<- mean(runif(30000000,0,1),  
> to buy time, but this only helps on the older computer I have, not on  
> the new Core i7, which I really want to make use of.  The suggestion has  
> been made to switch to a Linux system, but I'm having trouble getting  
> the source code for swat_edit.exe so that I can recompile for Linux.   
> Any ideas, if I want to try to achieve this in Windows?
> Your help would be much appreciated.
> John Joseph
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-hpc mailing list
> R-sig-hpc at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-hpc


--