Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Editing DO files while it is being executed


From   Dave Ewart <davee@ceu.ox.ac.uk>
To   statalist@hsphsun2.harvard.edu
Subject   st: Editing DO files while it is being executed
Date   Fri, 23 Jun 2006 12:08:01 +0100

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

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?

Dave.
- -- 
Dave Ewart
davee@ceu.ox.ac.uk
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 v1.4.2.2 (GNU/Linux)

iD8DBQFEm8uRbpQs/WlN43ARAqkDAKDu1CoINsjQvpPkngZbO3ZD110yUgCgphHT
xqHWbY/SfgbqDP0deSwmCvo=
=1r+h
-----END PGP SIGNATURE-----
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index