Giter VIP home page Giter VIP logo

afni_ci_test_data's Introduction

Test data management

This repository stores the data required for AFNI's continuous integration testing on CircleCI (and testing run locally with the run_afni_tests.py tool). If you are not using this tool but still wish to use data from this repository you must install datalad if you have not already.

To get the repository:

datalad install https://github.com/afni/afni_ci_test_data.git

Adding more data to the test data repository

N.B. You need to modify your data repository to have push access to the afni server to do this. See git configuration in the trouble shooting tips below.

Adding arbitrary data

Examples of adding data to the repository can be seen in the setup script in this repository. Data can be extracted from archives at URLs, installed via datalad from other online repositories (OpenNeuro and the like), or created on the fly by executing an AFNI command that generates data that is then saved to the repository. For examples, read through the initial setup of this repository

Updating sample test data

When new tests are added, or the expected output of a particular test changes you will need to add some more data to this repository. Follow these instructions to do this...

Be very careful that the behavior from your tested function and the test is what you want. This will create the new "correct" output. It is best to run all of the test commands inside the development container. This will reduce confusing results on circleci (variation in the output due to differences in environment). The best way to start a container is to follow the instructions emitted when you attempt to run container testing in debug mode i.e. run_afni_tests.py -d container

  1. Run all tests (they should all pass except the ones you wish to create data for)
cd /opt/afni/src/tests;                        \
./run_afni_tests.py                            \
    --build-dir /opt/afni/build                \
    -u                                         \
    -e='--runveryslow '                        \
    local
  1. Rerun the failed tests in "create sample output" mode.
./run_afni_tests.py                            \
    --build-dir /opt/afni/build                \
    -u                                         \
    -e='--runveryslow --create-sample-output'  \
    --lf                                       \
    -v verbose                                 \
    local
  1. Copy the sample data into the test data tree. You will need to modify the directory path that contains a datestamp below and be careful with trailing slashes:
rsync -aP                                                               \
    sample_output_of_tests/sample_output_2020_10_28_180130/             \
    afni_ci_test_data/sample_test_output/
  1. Add them to the datalad repo
cd afni_ci_test_data
datalad save -m 'update sample output data'
  1. Publish to the github and afni server. There is a way to configure the repository so that the following is a single command. I could not get it to work robustly across repository installations though:
datalad publish --transfer-data=all --to=origin
datalad publish --transfer-data=all --to=afni_ci_test_data

Note: the afni server stores all the binary blobs (the actual data). These files need to be globally accessible. The git repository doesn't need to look up to date, so for example it is fine to have an old version of master checked-out. The data will look out of date but it will be providing the appropriate files for download when requested.

  1. Fix permissions on the server... I can't find a work around for this right now.

Fixing permissions:

find /fraid/pub/dist/data/afni_ci_test_data -type d  ! -perm -o=x -exec chmod o+x {} \;; find /fraid/pub/dist/data/afni_ci_test_data -type f  ! -perm -o=r -exec chmod o+r {} \;
  1. Test that the data can be fetched:
cd /tmp
datalad install https://github.com/afni/afni_ci_test_data.git
cd afni_ci_test_data
# Insert your actual sample_test_output that you wish to test for
datalad get sample_test_output/3dTproject

If the above doesn't work start working through the trouble-shooting tips below. If it does then celebrate and do the dance of joy.

  1. Update your reference to the data in the main code repository
cd ~/afni # or the path to your afni source code
git add tests/afni_ci_tests_data
git commit -m 'update data for tests'

Troubleshooting tips:

git configuration

The file ./git/config file in the afni_ci_test_data repository does not contain an entry that looks like the following you may have some issues:

[remote "afni_ci_test_data"]
    url = https://afni.nimh.nih.gov/pub/dist/data/afni_ci_test_data/.git
    pushurl = afni.nimh.nih.gov:/fraid/pub/dist/data/afni_ci_test_data
    fetch = +refs/heads/*:refs/remotes/afni_ci_test_data/*
    annex-bare = false
    annex-uuid = c1ce38d5-c2ef-48c6-a1f2-e207215d0717

Specifically, you should have a pushurl configured. If you do not, datalad publish will try and fail to write via https. Also in the annex section the version should likely be 7 not 8.

Consulting the ghosts of the past

Check commits logs in the afni_ci_test_data repo, these provide an excellent guide to commands that were used to add data to the repository.

Fixing browser access

Due to NIH server configuration constraint the files need to be indexed if you wish to access them directly via a browser. This could be implemented as a git hook that is executed on push if that is desirable. Overall I think having browser access is not required though. It can make things confusing to try to support this functionality. The @make.directory.index script is stored in repository if you need it, add it to your path:

@make.directory.index -nested -dirs /fraid/pub/dist/data/afni_ci_test_data

annex remote accessibility

Sometimes when the remote is not accessible the annex remote will be disabled. This can be undone by modifying .git/config or using git-annex enableremote afni_ci_test_data

Potential quick fix

Sometimes the quick and easy fix is to run datalad update (usually in combination with permissions fixes and version changes).

afni_ci_test_data's People

Contributors

afni-dglen avatar afnihq avatar leej3 avatar mrneont avatar rmarkello avatar yarikoptic avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

afni_ci_test_data's Issues

cannot 'data-lad publish ...' to 'afni_ci_test_data'

@leej3

I have successfully gone through all the steps on the instruction page except the last command:
datalad publish --transfer-data=all --to=afni_ci_test_data

I have done this on three separate systems: Ubuntu 20.04, Mac 10.15 and lastly Ubuntu 16.04. Note that on this last one, I am on the 'safni' machine.

Strictly following the instructions, when I try the above command, I get this error:

[INFO   ] Publishing Dataset(/home/afniHQ/FOR_TEST_AFNI/afni/tests/afni_ci_test_data) data to afni_ci_test_data 
CommandError: 'git -c diff.ignoreSubmodules=none annex copy --to=afni_ci_test_data --fast --json --json-error-messages --json-progress -c annex.dotfiles=true -c annex.retry=3 -- .' failed with exitcode 1 under /home/afniHQ/FOR_TEST_AFNI/afni/tests/afni_ci_test_data
git-annex: copy: 6 failed

The same occurs even if I edit my .git/config file with the extra information, suggested on the main instruction page.

One problem is: the instructions say users must have git-annex ver=7. However, the environment.yml only installs datalad, which takes care of installing git-annex, and I cannot specify git-annex version anywhere. And datalad seems to always install git-annex ver=8.

On a Mac, I could not get homebrew to install git-annex ver=7 either through building or going through the git repo. On the current safni Ubuntu, I tried editing my conda environment by uninstalling git-annex ver=8, then installing git-annex ver=7 (and then I had to reinstall datalad, too), with:

conda remove git-annex
conda config --append channels conda-forge
conda install git-annex=7
conda install datalad

However, when running the datalad publish command again, I now got this error:

CommandError: 'git -c diff.ignoreSubmodules=none annex wanted afni_ci_test_data -c annex.dotfiles=true -c annex.retry=3' failed with exitcode 1 under /home/afniHQ/FOR_TEST_AFNI/afni/tests/afni_ci_test_data
git-annex: Repository version 8 is not supported. Upgrade git-annex.

So, I seem to be stuck between datalad requirement of git-annex ver=8 and the afni_tests_ci_data requirement of git-annex ver=7. (Assuming that is the origin of the original failure message; I don't even know.)

Any advice is welcome, thanks.

Help elderly me

Hi @afni-rickr -- do you have notes from those few sessions we did a few months back... I feel user ran into an issue which we had (some binary files were committed to git instead of git-annex) and I can't recall it.

Related -- do you guys have some slack or whatever for rapid correspondence?

how to install git-annex ver=7 on a Mac?

@leej3

I have a Mac OS 10.15. I am trying to run the testing framework, and get all the way to the 2nd data-lad publish, as described in this issue:
#2

I am not sure what that error means, but this part of the instructions:
https://github.com/afni/afni_ci_test_data#git-configuration
says that git-annex should "likely be" ver=7, but installing datalad always brings a dependency of git-annex ver=8. I don't even know how to install git-annex ver=7 on this Mac OS.

Things I have tried:

A) The building the conda env with the distributed environment.yml: only specifies datalad, and I only get git-annex ver=8.

B) brew install git-annex : only installs ver=8. Trying brew install git-annex@7 to try to specify a version only produces an error (even if I try the full version number with the dot).

C) Trying to follow the instructions here (which you suggested in an email):
https://itnext.io/how-to-install-an-older-brew-package-add141e58d32
I followed its instructions for git-annex, leading me to run this, but git-annex is not allowed to install in this way, as the text output implies:

$ brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/58523dde0519e92b494a833c66baea59389d4e84/Formula/git-annex.rb
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/cask).
==> Updated Formulae
Updated 6 formulae.
==> Updated Casks
Updated 1 cask.

Traceback (most recent call last):
9: from /usr/local/Homebrew/Library/Homebrew/brew.rb:122:in `<main>'
8: from /usr/local/Homebrew/Library/Homebrew/cmd/install.rb:131:in `install'
7: from /usr/local/Homebrew/Library/Homebrew/cli/parser.rb:303:in `parse'
6: from /usr/local/Homebrew/Library/Homebrew/cli/parser.rb:634:in `formulae'
5: from /usr/local/Homebrew/Library/Homebrew/cli/parser.rb:634:in `map'
4: from /usr/local/Homebrew/Library/Homebrew/cli/parser.rb:638:in `block in formulae'
3: from /usr/local/Homebrew/Library/Homebrew/formulary.rb:404:in `factory'
2: from /usr/local/Homebrew/Library/Homebrew/formulary.rb:180:in `get_formula'
1: from /usr/local/Homebrew/Library/Homebrew/formulary.rb:185:in `klass'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:277:in `load_file': Invalid usage: Installation of git-annex from a GitHub commit URL is unsupported! `brew extract git-annex` to a stable tap on GitHub instead. (UsageError)
12: from /usr/local/Homebrew/Library/Homebrew/brew.rb:155:in `<main>'
11: from /usr/local/Homebrew/Library/Homebrew/brew.rb:157:in `rescue in <main>'
10: from /usr/local/Homebrew/Library/Homebrew/help.rb:64:in `help'
9: from /usr/local/Homebrew/Library/Homebrew/help.rb:83:in `command_help'
8: from /usr/local/Homebrew/Library/Homebrew/help.rb:103:in `parser_help'
7: from /usr/local/Homebrew/Library/Homebrew/cli/parser.rb:303:in `parse'
6: from /usr/local/Homebrew/Library/Homebrew/cli/parser.rb:634:in `formulae'
5: from /usr/local/Homebrew/Library/Homebrew/cli/parser.rb:634:in `map'
4: from /usr/local/Homebrew/Library/Homebrew/cli/parser.rb:638:in `block in formulae'
3: from /usr/local/Homebrew/Library/Homebrew/formulary.rb:404:in `factory'
2: from /usr/local/Homebrew/Library/Homebrew/formulary.rb:180:in `get_formula'
1: from /usr/local/Homebrew/Library/Homebrew/formulary.rb:185:in `klass'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:277:in `load_file': Invalid usage: Installation of git-annex from a GitHub commit URL is unsupported! `brew extract git-annex` to a stable tap on GitHub instead. (UsageError)

D) ... So I went the "brew extract ..." route, suggested by the above. First I googled about it: there were no hits for "brew extract git-annex", but for just "brew extract", there was this helpful/general page:
https://cmichel.io/how-to-install-an-old-package-version-with-brew/
(I also did try again "brew install [email protected]", thinking the more specific version might get found, but that failed.)
I did these steps then:

$ brew tap-new $USER/local-git-annex
$ brew extract --version=7 git-annex $USER/local-git-annex
==> Searching repository history
Warning: Calling `cellar` in a bottle block is deprecated! Use `brew style --fix` on the formula to update the style or use `sha256` with a `cellar:` argument instead.
Please report this issue to the homebrew/core tap (not Homebrew/brew or Homebrew/core), or even better, submit a PR to fix it:
  /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/git-annex.rb:15

[... and MANY MORE repeats of this warning...]

Error: git-annex: cannot load such file -- language/haskell

I also tried running the 2nd command above with the full version number 7.[number], but that didn't change anything. Googling about that error brought me here:
https://stackoverflow.com/questions/67059691/warning-calling-sha256-digest-tag-in-a-bottle-block-is-deprecated-use
... so I ran:
brew style --fix /usr/local/Homebrew/Library/Taps/ptaylor/homebrew-local-git-annex/Formula
(I note that before running this, I checked out what the above directory looked---it was empty; after running this command, it still was.)
... but then running the above "brew extract ..." didn't produce any different output.

Any advice is welcome.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.