101-118-sharelocal3.rst 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. .. _sharelocal3:
  2. Retrace and reenact
  3. -------------------
  4. "Thanks a lot for sharing your dataset with me! This
  5. is super helpful. I'm sure I'll catch up in no time!",
  6. your room mate says confidently. "How far did you get
  7. with the DataLad commands yet?" he asks at last.
  8. "Mhh, I think the last big one was :dlcmd:`run`.
  9. Actually, let me quickly show you what this command
  10. does. There is something that I've been wanting to try
  11. anyway." you say.
  12. The dataset you shared contained a number of :dlcmd:`run`
  13. commands. For example, you created the simple ``podcasts.tsv``
  14. file that listed all titles and speaker names of the longnow
  15. podcasts.
  16. Given that you learned to create "proper" :dlcmd:`run` commands,
  17. complete with ``--input`` and ``--output`` specification,
  18. anyone should be able to :dlcmd:`rerun` these commits
  19. easily. This is what you want to try now.
  20. You begin to think about which :dlcmd:`run` commit would be
  21. the most useful one to take a look at. The creation of
  22. ``podcasts.tsv`` was a bit dull -- at this point in time, you
  23. didn't yet know about ``--input`` and ``--output`` arguments,
  24. and the resulting output is present anyway because text files
  25. like this ``.tsv`` file are stored in Git.
  26. However, one of the attempts to resize a picture could be
  27. useful. The input, the podcast logos, is not yet retrieved,
  28. nor is the resulting, resized image. "Let's go for this!",
  29. you say, and drag your confused room mate to the computer
  30. screen.
  31. First of all, find the commit shasum of the command you
  32. want to run by taking a look into the history of the dataset
  33. (in the shared dataset):
  34. .. runrecord:: _examples/DL-101-118-101
  35. :language: console
  36. :workdir: dl-101/DataLad-101
  37. :notes: More cool things on shared datasets: rerunning run commands
  38. :cast: 04_collaboration
  39. $ # navigate into the shared copy
  40. $ cd ../mock_user/DataLad-101
  41. .. runrecord:: _examples/DL-101-118-102
  42. :language: console
  43. :workdir: dl-101/mock_user/DataLad-101
  44. :emphasize-lines: 4
  45. :notes: find the shasum
  46. :cast: 04_collaboration
  47. $ # lets view the history
  48. $ git log --oneline -n 10
  49. Ah, there it is, the second most recent commit.
  50. Just as already done in section :ref:`run2`,
  51. take this shasum and plug it into a :dlcmd:`rerun`
  52. command:
  53. .. runrecord:: _examples/DL-101-118-103
  54. :language: console
  55. :workdir: dl-101/mock_user/DataLad-101
  56. :realcommand: echo "$ datalad rerun $(git rev-parse HEAD~1)" && datalad rerun $(git rev-parse HEAD~1)
  57. :notes: plug the shasum into a rerun command
  58. :cast: 04_collaboration
  59. "This was so easy!" you exclaim. DataLad retrieved the missing
  60. file content from the subdataset and it tried to unlock the output
  61. prior to the command execution. Note that because you did not retrieve
  62. the output, ``recordings/salt_logo_small.jpg``, yet, the missing content
  63. could not be "unlocked", but is reportedly "removed" prior to the successful rerun.
  64. Your room mate now not only knows how exactly the resized file
  65. came into existence, but he can also reproduce your exact steps to
  66. create it. "This is as reproducible as it can be!" you think in awe.
  67. .. only:: adminmode
  68. Add a tag at the section end.
  69. .. runrecord:: _examples/DL-101-118-104
  70. :language: console
  71. :workdir: dl-101/DataLad-101
  72. $ git branch sct_retrace_and_reenact