"Automate away ability to make dumb mistakes. Don't use human based process.",
Tim Clem, Github bigwig, SciPy 2012
1 2 3 4 5 6 |
|
$ python script.py 6
waiting for 6(s)
$ edit script.py ## Add another argument ...
$ python script.py 4 1
waiting for 5(s)
No history.
$ cp script.py script-old.py
$ edit script.py ## Make some changes ...
$ cp script-old.py script-older.py
$ cp script.py script-old.py
Invent scheme for version control.
Initialize repository.
$ git init
Initialized empty Git repository in ...
Store a version of the code.
$ git add script.py
$ git commit script.py -m "First commit."
[master (root-commit) 2f12eae] First commit
1 files changed, 20 insertions(+), 0 deletions(-)
create mode 100644 script.py
Edit and run as before.
$ edit script.py ## Add another argument ...
$ python script.py 4 4
waiting for 8(s)
Store the new version.
$ git add script.py
$ git ci script.py -m "Add another argument ..."
[master 250e0a9] Add another argument ...
1 files changed, 4 insertions(+), 2 deletions(-)
History.
$ git log
250e0a989a19 Add another argument ...
2f12eaef785b First commit.
Query history.
$ git diff 2f12ea..250e0a
-wait = float(sys.argv[1])
+wait = float(sys.argv[1]) + \
+ float(sys.argv[2])
Version control is good, but no record of simulations.
$ python script.py 4 4 ## no record
waiting for 8(s)
Invent scheme for recording simulations.
$ ## record event
$ python script.py 4 4 > output0
$ git add output0
$ git ci output0 -m "Adding output file."
Version control does not record events.
Create Sumatra repository.
$ smt init sumatrademo
Sumatra project successfully set up
$ smt configure --executable=python \
--main=script.py
Run simulation using Sumatra.
$ smt run 2 1 ## python script.py 2 1
waiting for 3.0(s)
No data produced.
Created record store
View record.
$ smt list --long
----------------------------------------------
Label : 622fbd437c4a
Timestamp : 2013-05-08 12:07:15.8991...
Duration : 3.02781295776
Repository : GitRepository at /users/...
Main_File : script.py
Version : 250e0a989a19
Script_Arguments : 2 1
Executable : Python (version: 2.6.6) ...
Launch_Mode : serial
User : Daniel Wheeler <daniel.w...
import fipy
to view dependencies.
1 2 3 4 5 6 7 8 9 10 |
|
Eats his own dog food.
Doesn't require a wholesale change to the way I work.
This
$ python script.py 3 2
versus this
$ smt run 3 2
Embed live code with documentation on the web!!!
Dynamic, not static
but sometimes we need static
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|