[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: Editing DO files while it is being executed
-----BEGIN PGP SIGNED MESSAGE-----
Something one of our staff noticed is that 'strange things' can happen
if one edits a running DO file. For example:
1. Start a Stata job with "do somefile.do";
2. While the job is still running, edit somefile.do in an editor, say,
by adding some additional commands to the end of it;
3. See the Stata job *execute those additional commands*, rather than
executing the contents of the DO file as it was when the job started!
This behaviour happens on both Stata versions we have here: Stata 8 for
Windows and Stata 9 for Linux.
I used 'strace' to see what Stata was actually doing. It appears that
Stata reads the DO file in 512-byte blocks and only reads the next block
when it needs to (and "when it needs to" can be minutes, hours or even
days later). Each new block read involves reading the file in its
current state, which means that any editing of the DO file while the job
is running can cause problems with the running job.
The workaround is simple of course, one just avoids editing DO files
which relate to running jobs.
This behaviour of Stata seems strange: why doesn't it read the whole DO
file at the start (which will only happen if the whole DO file is <512
bytes in size)?
Any other comments?
Computing Manager, Cancer Epidemiology Unit
Cancer Research UK / Oxford University
PGP: CC70 1883 BD92 E665 B840 118B 6E94 2CFD 694D E370
Get key from http://www.ceu.ox.ac.uk/~davee/davee-ceu-ox-ac-uk.asc
N 51.7518, W 1.2016
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v188.8.131.52 (GNU/Linux)
-----END PGP SIGNATURE-----
* For searches and help try: