Retrace and reenact

“Thanks a lot for sharing your dataset with me! This is super helpful. I’m sure I’ll catch up in no time!”, your room mate says confidently. “How far did you get with the DataLad commands yet?” he asks at last.

“Mhh, I think the last big one was datalad run. Actually, let me quickly show you what this command does. There is something that I’ve been wanting to try anyway.” you say.

The dataset you shared contained a number of datalad run commands. For example, you created the simple podcasts.tsv file that listed all titles and speaker names of the longnow podcasts.

Given that you learned to created “proper” datalad run commands, complete with --input and --output specification, anyone should be able to datalad rerun these commits easily. This is what you want to try now.

You begin to think about which datalad run commit would be the most useful one to take a look at. The creation of podcasts.tsv was a bit lame – at this point in time, you didn’t yet know about --input and --output arguments, and the resulting output is present anyway because text files like this .tsv file are stored in Git. However, one of the attempts to resize a picture could be useful. The input, the podcast logos, is not yet retrieved, nor is the resulting, resized image. “Let’s go for this!”, you say, and drag your confused room mate to the computer screen.

First of all, find the commit shasum of the command you want to run by taking a look into the history of the dataset (in the shared dataset):

# navigate into the shared copy
$ cd ../mock_user/DataLad-101
# lets view the history
$ git log --oneline
dd6fef5 add note on clean datasets
d9d0872 [DATALAD RUNCMD] Resize logo for slides
36a9cfd [DATALAD RUNCMD] Resize logo for slides
244c234 add additional notes on run options
e3277e9 [DATALAD RUNCMD] convert -resize 450x450 recordings/longn...
257130b resized picture by hand
6e624f5 [DATALAD RUNCMD] convert -resize 400x400 recordings/longn...
327fd83 add note on basic datalad run and datalad rerun
4e3fb6e add note datalad and git diff
d26a29b [DATALAD RUNCMD] create a list of podcast titles
d04c4af BF: list both directories content
ecde4e4 [DATALAD RUNCMD] create a list of podcast titles
ef8b726 Add simple script to write a list of podcast speakers and titles
e61c229 Add note on datalad install
49e85d1 [DATALAD] Recorded changes
5f98f2b add note on datalad save
b72b237 Add notes on datalad create
dac2fa7 add reference book about git
9a6fb63 add books on Python and Unix to read later
1a45fd4 Instruct annex to add text files to Git
e85b950 [DATALAD] new dataset

Ah, there it is, the second most recent commit. Just as already done in section DataLad, Re-Run!, take this shasum and plug it into a datalad rerun command:

$ datalad rerun d9d087295ff9e7fc9369333098e277437b5b093e
[INFO] Making sure inputs are available (this may take some time) 
[WARNING] no content present; cannot unlock [unlock(/home/me/dl-101/mock_user/DataLad-101/recordings/salt_logo_small.jpg)] 
[INFO] == Command start (output follows) ===== 
[INFO] == Command exit (modification check follows) ===== 
get(ok): recordings/longnow/.datalad/feed_metadata/logo_salt.jpg (file) [from origin...]
remove(ok): recordings/salt_logo_small.jpg
add(ok): recordings/salt_logo_small.jpg (file)
action summary:
  add (ok: 1)
  get (ok: 1)
  remove (ok: 1)
  save (notneeded: 2)

“This was so easy!” you exclaim. DataLad retrieved the missing file content from the subdataset and it tried to unlock the output prior to the command execution. Note that because you did not retrieve the output, recordings/salt_logo_small.jpg, yet, the missing content could not be unlocked. DataLad warns you about this, but proceeds successfully.

Your room mate now not only knows how exactly the resized file came into existence, but he can also reproduce your exact steps to create it. “This is as reproducible as it can be!” you think in awe.