Skip to content

Commit

Permalink
FIX: Ensure templateflow Layout is re-indexed when updating
Browse files Browse the repository at this point in the history
  • Loading branch information
mgxd committed Aug 17, 2020
1 parent 1c473df commit 003c889
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions templateflow/conf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,19 @@
def update(local=False, overwrite=True, silent=False):
"""Update an existing DataLad or S3 home."""
if TF_USE_DATALAD and _update_datalad():
return True

from ._s3 import update as _update_s3
success = True
else:
from ._s3 import update as _update_s3
success = _update_s3(TF_HOME, local=local, overwrite=overwrite, silent=silent)

return _update_s3(TF_HOME, local=local, overwrite=overwrite, silent=silent)
# update Layout only if necessary
if success and TF_LAYOUT is not None:
init_layout()
# ensure the api uses the updated layout
import importlib
from .. import api
importlib.reload(api)
return success


def setup_home(force=False):
Expand All @@ -76,9 +84,12 @@ def _update_datalad():


TF_LAYOUT = None
try:


def init_layout():
from .bids import Layout

global TF_LAYOUT
TF_LAYOUT = Layout(
TF_HOME,
validate=False,
Expand All @@ -92,5 +103,9 @@ def _update_datalad():
"scripts",
],
)


try:
init_layout()
except ImportError:
pass

0 comments on commit 003c889

Please sign in to comment.