Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/io-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ jobs:
# the key depend on the last commit repo https://gin.g-node.org/NeuralEnsemble/ephy_testing_data.git
id: ephy_testing_data
run: |
# if gin cannot be reached the key matches no cache and the restore-keys below restore the most recent one
set -o pipefail
if ! hash="$(git ls-remote https://gin.g-node.org/NeuralEnsemble/ephy_testing_data.git HEAD | cut -f1)" || [ -z "$hash" ]; then
echo "::error::could not resolve ephy_testing_data HEAD on gin; refusing to build a degenerate cache key"
exit 1
echo "::warning::could not resolve ephy_testing_data HEAD on gin; restoring the most recent dataset cache"
hash=""
fi
echo "dataset_hash=$hash" >> "$GITHUB_OUTPUT"
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/plexon2-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ jobs:
# the key depend on the last commit repo https://gin.g-node.org/NeuralEnsemble/ephy_testing_data.git
id: ephy_testing_data
run: |
# if gin cannot be reached the key matches no cache and the restore-keys below restore the most recent one
set -o pipefail
if ! hash="$(git ls-remote https://gin.g-node.org/NeuralEnsemble/ephy_testing_data.git HEAD | cut -f1)" || [ -z "$hash" ]; then
echo "::error::could not resolve ephy_testing_data HEAD on gin; refusing to build a degenerate cache key"
exit 1
echo "::warning::could not resolve ephy_testing_data HEAD on gin; restoring the most recent dataset cache"
hash=""
fi
echo "dataset_hash=$hash" >> "$GITHUB_OUTPUT"
Expand Down
11 changes: 10 additions & 1 deletion neo/utils/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""

import os
import warnings
from pathlib import Path

default_testing_repo = "https://gin.g-node.org/NeuralEnsemble/ephy_testing_data"
Expand All @@ -14,6 +15,9 @@
# set in home
local_testing_data_folder = Path.home() / "ephy_testing_data"

# local copies already updated in this process, so each one asks its remote at most once
_updated_folders = set()


def get_local_testing_data_folder():
global local_testing_data_folder
Expand Down Expand Up @@ -64,7 +68,12 @@ def download_dataset(repo=default_testing_repo, remote_path=None, local_folder=N
# make sure git repo is in clean state
repo = dataset.repo
repo.call_git(["checkout", "--force", "master"])
dataset.update(merge=True)
if local_folder not in _updated_folders:
_updated_folders.add(local_folder)
# the remote can be unreachable (gin answers 403 to CI runners at times), so keep the local copy then
results = dataset.update(merge=True, on_failure="ignore")
if any(result["status"] in ("impossible", "error") for result in results):
warnings.warn(f"Could not update {local_folder} from its remote, using the local copy as it is")
else:
dataset = datalad.api.install(path=local_folder, source=repo)

Expand Down
Loading