101-113-summary.rst 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. .. _run6:
  2. Summary
  3. -------
  4. In the last four sections, we demonstrated how to create a proper :dlcmd:`run`
  5. command, and discovered the concept of *locked* content.
  6. * :dlcmd:`run` records and saves the changes a command makes in a dataset. That means
  7. that modifications to existing content or new content are associated with a specific command
  8. and saved to the dataset's history. Essentially, :dlcmd:`run` helps you to keep
  9. track of what you do in your dataset by capturing all :term:`provenance`.
  10. * A :dlcmd:`run` command generates a ``run record`` in the commit. This :term:`run record` can be used
  11. by DataLad to re-execute a command with :dlcmd:`rerun SHASUM`, where SHASUM is the
  12. commit hash of the :dlcmd:`run` command that should be re-executed.
  13. * If a :dlcmd:`run` or :dlcmd:`rerun` does not modify any content, it will not write a
  14. record to history.
  15. * With any :dlcmd:`run`, specify a commit message, and whenever appropriate, specify its inputs
  16. to the executed command (using the ``-i``/``--input`` flag) and/or its output (using the ``-o``/
  17. ``--output`` flag). The full command structure is:
  18. .. code-block:: console
  19. $ datalad run -m "commit message here" --input "path/to/input/" --output "path/to/output" "command"
  20. * Anything specified as ``input`` will be retrieved if necessary with a :dlcmd:`get` prior to command
  21. execution. Anything specified as ``output`` will be ``unlocked`` prior to modifications.
  22. * It is good practice to specify ``input`` and ``output`` to ensure that a :dlcmd:`rerun` works, and to capture the relevant elements of a computation in a machine-readable record.
  23. If you want to spare yourself preparation time in case everything is already retrieved and unlocked, you can use ``--assume-ready {input|output|both}`` to skip a check on whether inputs are already present or outputs already unlocked.
  24. .. figure:: ../artwork/src/run.svg
  25. :alt: Schematic illustration of datalad run.
  26. :width: 80%
  27. Overview of ``datalad run``.
  28. * Getting and unlocking content is not only convenient for yourself, but enormously helpful
  29. for anyone you share your dataset with, but this will be demonstrated in an upcoming section
  30. in detail.
  31. * To execute a :dlcmd:`run` or :dlcmd:`rerun`, a :dlcmd:`status`
  32. either needs to report that the dataset has no uncommitted changes (the dataset state
  33. should be "clean"), or the command needs to be extended with the ``--explicit`` option.
  34. Now what can I do with that?
  35. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  36. You have procedurally experienced how to use :dlcmd:`run` and :dlcmd:`rerun`. Both
  37. of these commands make it easier for you and others to associate changes in a dataset with
  38. a script or command, and are helpful as the exact command for a given task is stored by
  39. DataLad, and does not need to be remembered.
  40. Furthermore, by experiencing many common error messages in the context of :dlcmd:`run`
  41. commands, you have gotten some clues on where to look for problems, should you encounter
  42. those errors in your own work.
  43. Lastly, we've started to unveil some principles of :term:`git-annex` that are relevant to
  44. understanding how certain commands work and why certain commands may fail. We have seen that
  45. git-annex locks large files' content to prevent accidental modifications, and how the ``--output``
  46. flag in :dlcmd:`run` can save us an intermediate :dlcmd:`unlock` to unlock this content.
  47. The next section will elaborate on this a bit more.
  48. Further reading
  49. ^^^^^^^^^^^^^^^
  50. The chapter on :dlcmd:`run` provided an almost complete feature overview of the command.
  51. If you want, you can extend this knowledge with computational environments and :dlcmd:`containers-run` in chapter :ref:`containersrun`.
  52. In addition, you can read up on other forms of computing usecases - for example, how to use :dlcmd:`run` in interactive computing environments such as `Jupyter Notebooks <https://knowledge-base.psychoinformatics.de/kbi/0003>`_.