Skip to content

Commit 74219f8

Browse files
Add ability to turn off some of the local repository mirrors
1 parent 58e52fb commit 74219f8

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

buildconfig/CMake/MantidExternalData.cmake

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,18 @@ if(NOT MANTID_DATA_STORE)
1919
message(FATAL_ERROR "MANTID_DATA_STORE not set. It is required for external data")
2020
endif()
2121

22+
# add options for selecting which data mirrors to use
23+
set(_data_store_mirror_options all ral ornl none)
24+
set(DATA_STORE_MIRROR
25+
all
26+
CACHE STRING "Local data mirror to enable"
27+
)
28+
set_property(CACHE DATA_STORE_MIRROR PROPERTY STRINGS ${_data_store_mirror_options})
29+
list(FIND _data_store_mirror_options ${DATA_STORE_MIRROR} index)
30+
if(index EQUAL -1)
31+
message(FATAL_ERROR "DATA_STORE_MIRROR must be one of ${_data_store_mirror_options}")
32+
endif()
33+
2234
# Tell ExternalData module about selected object stores.
2335
list(APPEND ExternalData_OBJECT_STORES
2436
# Store selected by Mantid-specific configuration above.
@@ -41,9 +53,17 @@ mark_as_advanced(ExternalData_URL_TEMPLATES)
4153
list(APPEND ExternalData_URL_TEMPLATES "file:///home/builder/MantidExternalData-readonly/%(algo)/%(hash)")
4254
list(APPEND ExternalData_URL_TEMPLATES "file:///Users/mantidbuilder/MantidExternalData/%(algo)/%(hash)") # macOS
4355
list(APPEND ExternalData_URL_TEMPLATES "file:///mantid_data/%(algo)/%(hash)") # ISIS Linux
56+
4457
# facility based mirrors
45-
list(APPEND ExternalData_URL_TEMPLATES "http://130.246.80.136/external-data/%(algo)/%(hash)") # RAL
46-
list(APPEND ExternalData_URL_TEMPLATES "https://mantid-cache.sns.gov/testdata/%(algo)/%(hash)") # ORNL
58+
if((${DATA_STORE_MIRROR} STREQUAL all) OR (${DATA_STORE_MIRROR} STREQUAL ral))
59+
message(STATUS "Adding ral data mirror")
60+
list(APPEND ExternalData_URL_TEMPLATES "http://130.246.80.136/external-data/%(algo)/%(hash)") # RAL
61+
endif()
62+
if((${DATA_STORE_MIRROR} STREQUAL all) OR (${DATA_STORE_MIRROR} STREQUAL ornl))
63+
message(STATUS "Adding ornl data mirror")
64+
list(APPEND ExternalData_URL_TEMPLATES "https://mantid-cache.sns.gov/testdata/%(algo)/%(hash)") # ORNL
65+
endif()
66+
4767
# This should always be last as it's the main read/write cache
4868
list(APPEND ExternalData_URL_TEMPLATES "https://testdata.mantidproject.org/ftp/external-data/%(algo)/%(hash)")
4969

dev-docs/source/DataFilesForTesting.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,11 @@ it is recommended that it be placed on a disk with a large amount of
194194
space. CMake uses the ``MANTID_DATA_STORE`` variable to define where the
195195
data is stored.
196196

197+
The data itself can be downloaded from a local mirror as well to decrease build times.
198+
This is controlled by the ``DATA_STORE_MIRROR`` variable which can be "all" (default), "none", "ornl", or "ral".
199+
The variable will insert additional data mirrors that facilities have created.
200+
If the data is not found in a local mirror, it will be downloaded from the central data repository.
201+
197202
Example cmake command:
198203
----------------------
199204

0 commit comments

Comments
 (0)