slides/modules/what-datalad-adds-to-git-annex.html

419 lines
15 KiB
HTML
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!doctype html>
<html lang="en">
<head>
<title>What DataLad adds to Git/git-annex?</title>
<meta name="description" content="FILLIN">
<meta charset="utf-8">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
<!-- Original reveal JS stylesheets-->
<link rel="stylesheet" href="../reveal.js/dist/reset.css">
<link rel="stylesheet" href="../reveal.js/dist/reveal.css">
<link rel="stylesheet" href="../reveal.js/dist/theme/beige.css">
<!-- custom styles, e.g., imgcredit -->
<link rel="stylesheet" href="../custom/css/main.css" id="theme">
<script src="../custom/js/printpdf.js"></script>
</head>
<body>
<div class="reveal">
<div class="slides">
<section>
<h1>What DataLad adds to Git/git-annex?</h1>
</section>
<section>
<img src="../img/logos/git.svg"><br>
<img src="../img/xkcd/1597.png" height="800px"><imgcredit>xkcd comic<a href="https://xkcd.com/1597/" target="_blank">
1597</a> </imgcredit>
</section>
<section>
<h2>What makes scientific workflows special?</h2>
<dl>
<dt>Scientific building blocks are not static.</dt>
<dd>Version control beyond text</dd>
<dt>Science is build from modular units.</dt>
<dd>Nesting</dd>
<dt>Science is exploratory, iterative, multi-stepped, and complex.</dt>
<dd>Provenance</dd>
<dt>Science is collaborative.</dt>
<dd>Transport logistics</dd>
</dl>
</section>
<section data-transition="None">
<h2>A simpler core API</h2>
<ul>
<li>Example: Add a new file into a dataset</li>
<div class="r-stack">
<pre><code class="language-bash" data-line-numbers="1-3"># create a data analysis script
$ datalad status
untracked: code/script.py (file)
$ git status
On branch master
Untracked files:
(use "git add file..." to include in what will be committed)
code/script.py
nothing added to commit but untracked files present (use "git add" to track)
</code></pre>
<pre class="language-bash"><code data-line-numbers="4-10"># create a data analysis script
$ datalad status
untracked: code/script.py (file)
$ git status
On branch master
Untracked files:
(use "git add file..." to include in what will be committed)
code/script.py
nothing added to commit but untracked files present (use "git add" to track)
</code></pre>
</div>
<br>
<li>Save the dataset modification...</li>
<ul>
<li>... with DataLad</li>
<pre class="language-bash"><code>$ datalad save \
-m "Add a k-nearest-neighbour clustering analysis" \
code/script.py </code></pre>
<li>... versus with Git</li>
<pre class="language-bash"><code>$ git add code/script.py
$ git commit -m "Add a k-nearest-neighbour clustering analysis"</code></pre>
<li>... versus with git-annex</li>
<pre class="language-bash"><code>$ git annex add code/script.py
$ git commit -m "Add a k-nearest-neighbour clustering analysis"</code></pre>
</ul>
</ul>
</section>
<section>
<h2>Git submodules</h2>
<ul>
<li>Built-in Git feature: Add a repository to another repository, treating them
as separate projects (e.g., use third party project, but keep commits separate)</li>
</ul>
<table>
<tr>
<td>
Make a project with a submodule:
<pre><code class="bash" data-line-numbers="1, 3-5, 8">$ git init myproject
Initialized empty Git repository in /tmp/myproject/.git/
$ cd myproject
$ git submodule add \
https://github.com/adswa/multimatch_gaze.git
Cloning into '/tmp/myproject/multimatch_gaze'...
done.
$ git commit -am 'Add multimatch module'
[main fb9093c] Add multimatch module
2 files changed, 4 insertions(+)
create mode 100644 .gitmodules
create mode 160000 multimatch_gaze
</code></pre>
</td>
</tr>
<tr>
<td>
Get a repository with a submodule:
<pre><code class="bash" data-line-numbers="1, 4-5">$ git clone https://github.com/adswa/myproject.git
Cloning into 'myproject'...
done.
$ cd myproject
$ git submodule init
Submodule 'multimatch_gaze' (https://github.com/adswa/multimatch_gaze.git)
registered for path 'multimatch_gaze'</code></pre>
</td>
</tr>
</table>
</section>
<section data-transition="None">
<h2>DataLad subdatasets</h2>
<li>DataLad simplifies submodule mechanism with superdataset-subdataset hierarchies:</li>
<img src="../img/concepts/linkage_subds.svg" width="900"> <br>
<pre><code style="max-width:none" class="bash" data-line-numbers="1,3, 6">$ cd myanalysis
# we can install analysis input data as a subdataset to the dataset
$ datalad clone -d . https://github.com/datalad-handbook/iris_data.git input/
[INFO ] Scanning for unlocked files (this may take some time)
[INFO ] Remote origin not usable by git-annex; setting annex-ignore
install(ok): input (dataset)
add(ok): input (file)
add(ok): .gitmodules (file)
save(ok): . (dataset)
action summary:
add (ok: 2)
install (ok: 1)
save (ok: 1)
</code></pre>
</section>
<section data-transition="None">
<h2>data analysis provenance</h2>
<p style="z-index: 100;position: fixed;background-color:#ede6d5;font-size:35px;box-shadow: 10px 10px 8px #888888;margin-top:60px;margin-bottom:-60px">
Enshrine the analysis in a script
</p>
<p class="fragment fade-in" style="z-index: 100;position: fixed;background-color:#ede6d5;font-size:35px;box-shadow: 10px 10px 8px #888888;margin-top:180px;margin-bottom:-60px">
Here: extract_lc_timeseries.py
</p>
<p style="z-index: -1">
<pre><code class="bash" style="max-height:none" data-line-numbers="6">$ datalad containers-run \
--message "Time series extraction from Locus Coeruleus"
--container-name nilearn \
--input 'mri/*_bold.nii' \
--output 'sub-*/LC_timeseries_run-*.csv' \
"python3 code/extract_lc_timeseries.py"
-- Git commit --
commit 5a7565a640ff6de67e07292a26bf272f1ee4b00e
Author: Adina Wagner adina.wagner@t-online.de
AuthorDate: Mon Nov 11 16:15:08 2019 +0100
Commit: Adina Wagner adina.wagner@t-online.de
CommitDate: Mon Nov 11 16:15:08 2019 +0100
[DATALAD RUNCMD] Time series extraction from Locus Coeruleus
=== Do not change lines below ===
{
"cmd": "singularity exec --bind {pwd} .datalad/environments/nilearn.simg bash..",
"dsid": "92ea1faa-632a-11e8-af29-a0369f7c647e",
"inputs": [
"mri/*.bold.nii.gz",
".datalad/environments/nilearn.simg"
],
"outputs": ["sub-*/LC_timeseries_run-*.csv"],
...
}
^^^ Do not change lines above ^^^
---
sub-01/LC_timeseries_run-1.csv | 1 +
...
</code></pre>
</p>
</section>
<section data-transition="None">
<h2>data analysis provenance</h2>
<p style="z-index: 100;position: fixed;background-color:#ede6d5;font-size:35px;box-shadow: 10px 10px 8px #888888;margin-top:130px;margin-bottom:-60px;margin-left:750px">
Record code execution together <br> with
input-data, output files and software
environment in the
execution-command
</p>
<p style="z-index: -1">
<pre><code class="bash" style="max-height:none" data-line-numbers="1-6">$ datalad containers-run \
--message "Time series extraction from Locus Coeruleus"
--container-name nilearn \
--input 'mri/*_bold.nii' \
--output 'sub-*/LC_timeseries_run-*.csv' \
"python3 code/extract_lc_timeseries.py"
-- Git commit --
commit 5a7565a640ff6de67e07292a26bf272f1ee4b00e
Author: Adina Wagner adina.wagner@t-online.de
AuthorDate: Mon Nov 11 16:15:08 2019 +0100
Commit: Adina Wagner adina.wagner@t-online.de
CommitDate: Mon Nov 11 16:15:08 2019 +0100
[DATALAD RUNCMD] Time series extraction from Locus Coeruleus
=== Do not change lines below ===
{
"cmd": "singularity exec --bind {pwd} .datalad/environments/nilearn.simg bash..",
"dsid": "92ea1faa-632a-11e8-af29-a0369f7c647e",
"inputs": [
"mri/*.bold.nii.gz",
".datalad/environments/nilearn.simg"
],
"outputs": ["sub-*/LC_timeseries_run-*.csv"],
...
}
^^^ Do not change lines above ^^^
---
sub-01/LC_timeseries_run-1.csv | 1 +
...
</code></pre>
</p>
</section>
<section data-transition="None">
<h2>data analysis provenance</h2>
<p style="z-index: 100;position: fixed;background-color:#ede6d5;font-size:35px;box-shadow: 10px 10px 8px #888888;margin-top:60px;margin-bottom:-60px;margin-left:200px">
Result: machine readable record about which data, code, and <br>
software produced a result how, when, and why.
</p>
<p style="z-index: -1">
<pre><code class="bash" style="max-height:none" data-line-numbers="8-30">$ datalad containers-run \
--message "Time series extraction from Locus Coeruleus"
--container-name nilearn \
--input 'mri/*_bold.nii' \
--output 'sub-*/LC_timeseries_run-*.csv' \
"python3 code/extract_lc_timeseries.py"
-- Git commit --
commit 5a7565a640ff6de67e07292a26bf272f1ee4b00e
Author: Adina Wagner adina.wagner@t-online.de
AuthorDate: Mon Nov 11 16:15:08 2019 +0100
Commit: Adina Wagner adina.wagner@t-online.de
CommitDate: Mon Nov 11 16:15:08 2019 +0100
[DATALAD RUNCMD] Time series extraction from Locus Coeruleus
=== Do not change lines below ===
{
"cmd": "singularity exec --bind {pwd} .datalad/environments/nilearn.simg bash..",
"dsid": "92ea1faa-632a-11e8-af29-a0369f7c647e",
"inputs": [
"mri/*.bold.nii.gz",
".datalad/environments/nilearn.simg"
],
"outputs": ["sub-*/LC_timeseries_run-*.csv"],
...
}
^^^ Do not change lines above ^^^
---
sub-01/LC_timeseries_run-1.csv | 1 +
...
</code></pre>
</p>
</section>
<section data-transition="None">
<h2>data analysis provenance</h2>
<p style="z-index: 100;position: fixed;background-color:#ede6d5;font-size:35px;box-shadow: 10px 10px 8px #888888;margin-top:60px;margin-bottom:-60px;margin-left:350px">
Use the unique identifier of the execution record
</p>
<p style="z-index: -1">
<pre><code class="bash" style="max-height:none" data-line-numbers="1">$ datalad rerun 5a7565a640ff6de67
[INFO ] run commit 5a7565a640ff6de67; (Time series extraction from Locus Coeruleus)
[INFO ] Making sure inputs are available (this may take some time)
get(ok): mri/sub-01_bold.nii (file)
get(ok): mri/sub-02_bold.nii (file)
[...]
[INFO ] == Command start (output follows) =====
[INFO ] == Command exit (modification check follows) =====
add(ok): sub-01/LC_timeseries_run-*.csv(file)
add(ok): sub-02/LC_timeseries_run-*.csv (file)
[...]
action summary:
add (ok: 30)
get (ok: 30)
save (ok: 2)
unlock (ok: 30)
</code></pre>
</p>
</section>
<section data-transition="None">
<h2>data analysis provenance</h2>
<p style="z-index: 100;position: fixed;background-color:#ede6d5;font-size:35px;box-shadow: 10px 10px 8px #888888;margin-top:400px;margin-bottom:-60px;margin-left:350px">
... to have a machine recompute and verify past work
</p>
<p style="z-index: -1">
<pre><code class="bash" style="max-height:none" data-line-numbers="2-16">$ datalad rerun 5a7565a640ff6de67
[INFO ] run commit 5a7565a640ff6de67; (Time series extraction from Locus Coeruleus)
[INFO ] Making sure inputs are available (this may take some time)
get(ok): mri/sub-01_bold.nii (file)
get(ok): mri/sub-02_bold.nii (file)
[...]
[INFO ] == Command start (output follows) =====
[INFO ] == Command exit (modification check follows) =====
add(ok): sub-01/LC_timeseries_run-*.csv(file)
add(ok): sub-02/LC_timeseries_run-*.csv (file)
[...]
action summary:
add (ok: 30)
get (ok: 30)
save (ok: 2)
unlock (ok: 30)
</code></pre>
</section>
<section data-transition="None">
<h2>Interoperability</h2>
<ul>
<li>Scientific workflows can be idiosyncratic across institutions / departments / labs / any two scientists</li>
</ul>
<img src="../img/concepts/services_only.svg" height="650">
</section>
<section data-transition="None">
<h2>Interoperability</h2>
<ul>
<li>DataLad is built to maximize interoperability and streamline routines across hosting and
storage technology</li>
</ul>
<img src="../img/concepts/services_connected.svg" height="650">
</section>
<section data-markdown><script type="text/template">
## Talk is cheap, show me the code: Git vs. DataLad
<iframe width="1120" height="630" src="https://www.youtube-nocookie.com/embed/Yrg6DgOcbPE" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
https://www.youtube.com/watch?v=Yrg6DgOcbPE
<aside class="notes">
- show git limits: commit a change in a 3rd-level submodule
- show annex limits: get file in a subdataset
- reveal: datalad makes repo-boundaries vanish -- show save -r
</aside>
</script></section>
</div> <!-- /.slides -->
</div> <!-- /.reveal -->
<script src="../reveal.js/dist/reveal.js"></script>
<script src="../reveal.js/plugin/notes/notes.js"></script>
<script src="../reveal.js/plugin/markdown/markdown.js"></script>
<script src="../reveal.js/plugin/highlight/highlight.js"></script>
<script src="../custom/js/copy-code.js"></script>
<script>
// Full list of configuration options available at:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
// The "normal" size of the presentation, aspect ratio will be preserved
// when the presentation is scaled to fit different resolutions. Can be
// specified using percentage units.
width: 1280,
height: 960,
// Factor of the display size that should remain empty around the content
margin: 0.1,
// Bounds for smallest/largest possible scale to apply to content
minScale: 0.2,
maxScale: 1.0,
controls: true,
progress: true,
history: true,
center: true,
transition: 'slide', // none/fade/slide/convex/concave/zoom
// Optional reveal.js plugins
plugins: [ RevealMarkdown, RevealHighlight, RevealNotes ]
});
</script>
<!-- A footer with a "1" and "home" button to get back to the first slide and the index page
<div id="hidden" style="display:none;">
<div id="header">
<div id="footer-left"><a href="#0">1️⃣</a></div>
<div id="footer-right"><a href="../index.html">🏠</a></div>
</div>
</div> -->
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script src="../custom/js/headerandfooter.js"></script>
</body>
</html>