diff --git a/Framework/Kernel/inc/MantidKernel/FacilityInfo.h b/Framework/Kernel/inc/MantidKernel/FacilityInfo.h index c4484eab302d27443c14f4baa10ad9cac7a2f7b3..a1da07cbd62f8b3170c8136ab46b4ea02ee9656c 100644 --- a/Framework/Kernel/inc/MantidKernel/FacilityInfo.h +++ b/Framework/Kernel/inc/MantidKernel/FacilityInfo.h @@ -96,6 +96,9 @@ public: /// Returns a bool indicating whether prefix is required in file names bool noFilePrefix() const { return m_noFilePrefix; } + /// Returns the multiple file limit + size_t multiFileLimit() const { return m_multiFileLimit; } + private: void fillZeroPadding(const Poco::XML::Element *elem); void fillDelimiter(const Poco::XML::Element *elem); @@ -105,6 +108,7 @@ private: void fillHTTPProxy(const Poco::XML::Element *elem); void fillComputeResources(const Poco::XML::Element *elem); void fillNoFilePrefix(const Poco::XML::Element *elem); + void fillMultiFileLimit(const Poco::XML::Element *elem); /// Add new extension void addExtension(const std::string &ext); @@ -121,6 +125,7 @@ private: std::vector<InstrumentInfo> m_instruments; ///< list of instruments of this facility bool m_noFilePrefix; ///< flag indicating if prefix is required in file names + size_t m_multiFileLimit; ///< the multiple file limit std::vector<ComputeResourceInfo> m_computeResInfos; ///< (remote) compute /// resources available in /// this facility diff --git a/Framework/Kernel/src/FacilityInfo.cpp b/Framework/Kernel/src/FacilityInfo.cpp index ed5491190bcac65965c40ef43f43026cb1e740b0..52de210b3fade89da921833f9cc8d122805c5e02 100644 --- a/Framework/Kernel/src/FacilityInfo.cpp +++ b/Framework/Kernel/src/FacilityInfo.cpp @@ -33,7 +33,7 @@ Logger g_log("FacilityInfo"); FacilityInfo::FacilityInfo(const Poco::XML::Element *elem) : m_catalogs(elem), m_name(elem->getAttribute("name")), m_zeroPadding(0), m_delimiter(), m_extensions(), m_archiveSearch(), m_instruments(), - m_noFilePrefix(), m_computeResources() { + m_noFilePrefix(), m_multiFileLimit(100), m_computeResources() { if (m_name.empty()) { g_log.error("Facility name is not defined"); throw std::runtime_error("Facility name is not defined"); @@ -46,6 +46,7 @@ FacilityInfo::FacilityInfo(const Poco::XML::Element *elem) fillArchiveNames(elem); fillComputeResources(elem); fillNoFilePrefix(elem); + fillMultiFileLimit(elem); fillInstruments(elem); // Make sure this is last as it picks up some defaults // that are set above } @@ -65,6 +66,17 @@ void FacilityInfo::fillNoFilePrefix(const Poco::XML::Element *elem) { m_noFilePrefix = (noFilePrefixStr == "True"); } +/// Called from constructor to fill the multifile limit +void FacilityInfo::fillMultiFileLimit(const Poco::XML::Element *elem) { + const std::string multiFileLimitStr = elem->getAttribute("multifilelimit"); + if (!multiFileLimitStr.empty()) { + size_t limit; + if (Mantid::Kernel::Strings::convert(multiFileLimitStr, limit)) { + m_multiFileLimit = limit; + } + } +} + /// Called from constructor to fill default delimiter void FacilityInfo::fillDelimiter(const Poco::XML::Element *elem) { // The string to separate the instrument name and the run number. diff --git a/Framework/Kernel/src/MultiFileNameParser.cpp b/Framework/Kernel/src/MultiFileNameParser.cpp index ee2697908883f01a640ce0939a9ef415f5761650..bb2a7ab4e081b3cae0fb97ecc3d968df4e1e63e0 100644 --- a/Framework/Kernel/src/MultiFileNameParser.cpp +++ b/Framework/Kernel/src/MultiFileNameParser.cpp @@ -5,6 +5,7 @@ #include "MantidKernel/ConfigService.h" #include "MantidKernel/FacilityInfo.h" +#include "MantidKernel/Strings.h" #include <numeric> #include <sstream> @@ -546,11 +547,11 @@ std::vector<std::vector<unsigned int>> generateRange(unsigned int from, throw std::runtime_error( "Unable to generate a range with a step size of zero."); - size_t limit = 100; - int success = - ConfigService::Instance().getValue("loading.multifilelimit", limit); - if (!success) { - limit = 100; + size_t limit; + std::string limitStr; + ConfigService::Instance().getValue("loading.multifilelimit", limitStr); + if (!Strings::convert(limitStr, limit)) { + limit = ConfigService::Instance().getFacility().multiFileLimit(); } unsigned int orderedTo = from > to ? from : to; @@ -559,9 +560,9 @@ std::vector<std::vector<unsigned int>> generateRange(unsigned int from, if (numberOfFiles > limit) { std::stringstream sstream; sstream << "The range from " << orderedFrom << " to " << orderedTo - << " step " << stepSize << ", would genetate " << numberOfFiles + << " with step " << stepSize << " would generate " << numberOfFiles << " files. " - << "This is greater then the current limit of " << limit << ". " + << "This is greater than the current limit of " << limit << ". " << "This limit can be configured in the Mantid.user.properties " "file using the key loading.multifilelimit=200."; throw std::range_error(sstream.str()); diff --git a/Framework/Properties/Mantid.properties.template b/Framework/Properties/Mantid.properties.template index 367b6713bdedf23aba51e8b1b2e1cf33dacd42ab..73cc078955f6ac784bbee22f6bb74047a6665852 100644 --- a/Framework/Properties/Mantid.properties.template +++ b/Framework/Properties/Mantid.properties.template @@ -222,7 +222,10 @@ loading.multifile=On # Limits the maximum number of files Mantid will attempt to load as part of a range. # Set to a very high number to disable, however this limit is in place to protect # you and your computer from simple formatting mistakes -loading.multifilelimit=100 +# By default it is facility dependent, and can be specified in Facilities.xml +# If not specified there for a given facility, it is assumed 100. +# If overwritten by the user, the user defined value takes priority over facility dependent defaults. +loading.multifilelimit = # Hide algorithms that use a Property Manager by default. algorithms.categories.hidden=Workflow\\Inelastic\\UsesPropertyManager;Workflow\\SANS\\UsesPropertyManager;DataHandling\\LiveData\\Support;Deprecated;Utility\\Development;Remote diff --git a/docs/source/release/v3.10.0/framework.rst b/docs/source/release/v3.10.0/framework.rst index 99c619347896290433c81190dee7ffd32bc69365..22cca23df3819865d8177450d568ebdb67c1ee0a 100644 --- a/docs/source/release/v3.10.0/framework.rst +++ b/docs/source/release/v3.10.0/framework.rst @@ -5,9 +5,11 @@ Framework Changes .. contents:: Table of Contents :local: + API --- +- The default multiple file limit is now made facility dependent. It is 1000 for ILL, and 100 for all the others. - Frequency unit (GHz) included as an option to represent energy transfer. Algorithms diff --git a/instrument/Facilities.xml b/instrument/Facilities.xml index 6fce4adc3f986af645e78df7d41e39c62f89cfb1..78a91f9f73241371bd9e8c24490498d815c647c9 100644 --- a/instrument/Facilities.xml +++ b/instrument/Facilities.xml @@ -582,7 +582,7 @@ </facility> -<facility name="ILL" zeropadding="6" FileExtensions=".nxs,.hdf,.inx,.asc" nofileprefix="True"> +<facility name="ILL" zeropadding="6" FileExtensions=".nxs,.hdf,.inx,.asc" nofileprefix="True" multifilelimit="1000"> <instrument name="IN4"> <technique>Neutron Spectroscopy</technique> diff --git a/instrument/Schema/Facilities/1.0/FacilitiesSchema.xsd b/instrument/Schema/Facilities/1.0/FacilitiesSchema.xsd index c6cbde1cdeb9e8a6077b976d396d1d6d013ebd9c..ae7f344680f097c9f6fe08c26363d9bb94f3729f 100644 --- a/instrument/Schema/Facilities/1.0/FacilitiesSchema.xsd +++ b/instrument/Schema/Facilities/1.0/FacilitiesSchema.xsd @@ -104,6 +104,7 @@ <xs:attribute name="FileExtensions"/> <xs:attribute name="delimiter"/> <xs:attribute name="nofileprefix"/> + <xs:attribute name="multifilelimit"/> </xs:complexType> </xs:element> </xs:choice>