![]() |
Belle II Software prerelease-11-00-00a
|
Class to obtain payload metadata from the HSF central server via REST requests. More...
#include <HSFCentralMetadataProvider.h>


Public Types | |
| using | PayloadMap = std::unordered_map<std::string, PayloadMetadata> |
| Type for the internal list of payloads. | |
Public Member Functions | |
| HSFCentralMetadataProvider (const std::set< std::string > &usableTagStates) | |
| Create using the default HSF central base URL and given usable tag states. | |
| HSFCentralMetadataProvider (std::string baseUrl, const std::set< std::string > &usableTagStates) | |
| Create using a custom base URL for the HSF central server. | |
| virtual | ~HSFCentralMetadataProvider ()=default |
| default destructor | |
| std::string | getGlobaltagStatus (const std::string &name) override |
| Check the status of a given globaltag. | |
| bool | updatePayloads (const std::string &globaltag, int exp, int run) override |
| Update the list of known payloads for the given globaltag/exp/run. | |
| bool | setTags (const std::vector< std::string > &tags) |
| Set the list of globaltag names to be considered for payloads. | |
| bool | getPayloads (int exp, int run, std::vector< PayloadMetadata > &info) |
| Update the information in the vector of metadata instances with the actual values. | |
| std::set< std::string > | getUsableTagStates () |
| Get the valid tag states when checking globaltag status. | |
| void | setUsableTagStates (const std::set< std::string > &states) |
| Set the valid tag states for this provider when checking globaltag status. | |
Protected Member Functions | |
| void | addPayload (PayloadMetadata &&payload, const std::string &messagePrefix="") |
| Add a payload information to the internal list. | |
| void | printInfoMessage (const std::string &provider) |
| Print an INFO message about the used metadata provider. | |
Protected Attributes | |
| std::vector< std::string > | m_tags |
| List of globaltags to consider. | |
| std::unordered_map< std::string, PayloadMetadataCache > | m_cache |
| Map of globaltag->known metadata. | |
| PayloadMap * | m_payloads {nullptr} |
| Map of known payloads for current conditions. | |
| std::set< std::string > | m_usableTagStates {"TESTING", "VALIDATED", "RUNNING", "PUBLISHED"} |
| Set of global tag states to consider valid (except for 'INVALID' which is always considered invalid) | |
Private Member Functions | |
| nlohmann::json | get (const std::string &url) |
| Download a given relative url (the baseUrl will be prepended) and return the json description. | |
Private Attributes | |
| Downloader & | m_downloader {Downloader::getDefaultInstance()} |
| Reference to the downloader instance for convenience. | |
| std::string | m_baseUrl |
| base url of the server | |
| std::string | m_payloadBaseUrl |
| base url of the payload server | |
Static Private Attributes | |
| static constexpr long long | m_maxIoV = 9223372036854775807 |
| Max IoV value, representing infinite end of validity. | |
Class to obtain payload metadata from the HSF central server via REST requests.
This class connects to the Belle II HSF central server instead of the main Belle II conditions database server. It provides the same functionality as CentralMetadataProvider but uses a different base URL and a different API.
Definition at line 21 of file HSFCentralMetadataProvider.h.
|
inherited |
Type for the internal list of payloads.
Definition at line 30 of file MetadataProvider.h.
| HSFCentralMetadataProvider | ( | std::string | baseUrl, |
| const std::set< std::string > & | usableTagStates ) |
Create using a custom base URL for the HSF central server.
Definition at line 19 of file HSFCentralMetadataProvider.cc.
|
protectedinherited |
Add a payload information to the internal list.
This should be called by implementations during updatePayloads() for each payload found.
| payload | payload information filled from the globaltag |
| messagePrefix | a message prefix to be shown for possible log messages to indicate the correct metadata provider |
Definition at line 91 of file MetadataProvider.cc.
|
private |
Download a given relative url (the baseUrl will be prepended) and return the json description.
Will raise exceptions on error
Definition at line 48 of file HSFCentralMetadataProvider.cc.
|
overridevirtual |
Check the status of a given globaltag.
Implements MetadataProvider.
Definition at line 58 of file HSFCentralMetadataProvider.cc.
|
inherited |
Update the information in the vector of metadata instances with the actual values.
The input is a list of metadata instances and the metadata provider will try to modify them in place and add all the missing information it can find.
This function will call updatePayloads() if necessary to update the list of known payloads for a given run but it will try to cache these results so incrementally asking for new payloads as they get requested is perfectly fine.
updatePayloads() will only called for globaltags if we still need to find payload information. If all payloads are found no further queries will be made so adding additional globaltags that are not used at the end is not expensive.
| exp | the experiment number | |
| run | the run number | |
| [in,out] | info | a list of metadata instances which we try to find the missing metadata for. |
Definition at line 36 of file MetadataProvider.cc.
|
inlineinherited |
Get the valid tag states when checking globaltag status.
Definition at line 122 of file MetadataProvider.h.
|
protectedinherited |
Print an INFO message about the used metadata provider.
| provider | the actual metadata provider used for the job |
Definition at line 114 of file MetadataProvider.cc.
|
inherited |
Set the list of globaltag names to be considered for payloads.
This should be called before requesting any payloads but after calling setValidTagStates().
Definition at line 15 of file MetadataProvider.cc.
|
inlineinherited |
Set the valid tag states for this provider when checking globaltag status.
Should be called before setTags() if necessary.
Definition at line 128 of file MetadataProvider.h.
|
overridevirtual |
Update the list of known payloads for the given globaltag/exp/run.
This basically just calls addPayload() for each payload it finds in the globaltag for the given exp/run.
Implements MetadataProvider.
Definition at line 76 of file HSFCentralMetadataProvider.cc.
|
private |
base url of the server
Definition at line 54 of file HSFCentralMetadataProvider.h.
|
protectedinherited |
Map of globaltag->known metadata.
Definition at line 172 of file MetadataProvider.h.
|
private |
Reference to the downloader instance for convenience.
Definition at line 51 of file HSFCentralMetadataProvider.h.
|
staticconstexprprivate |
Max IoV value, representing infinite end of validity.
Definition at line 60 of file HSFCentralMetadataProvider.h.
|
private |
base url of the payload server
Definition at line 57 of file HSFCentralMetadataProvider.h.
|
protectedinherited |
Map of known payloads for current conditions.
Definition at line 174 of file MetadataProvider.h.
|
protectedinherited |
List of globaltags to consider.
Definition at line 170 of file MetadataProvider.h.
|
protectedinherited |
Set of global tag states to consider valid (except for 'INVALID' which is always considered invalid)
Definition at line 176 of file MetadataProvider.h.