Skip to content

Commit 808d92a

Browse files
authored
Merge branch 'dev' into filtered-attach
2 parents e421f95 + a7246d0 commit 808d92a

File tree

780 files changed

+25287
-16669
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

780 files changed

+25287
-16669
lines changed

.github/workflows/clean-test.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ name: Clean PR checks
1919
# Warning: the check_* keys are magic and must consist of the string
2020
# "check_" followed by the applicable check name exactly. The
2121
# "description" field is only the human-readable label for the input.
22-
'check_build/O2/o2':
23-
description: build/O2/o2
24-
type: boolean
25-
default: true
2622
'check_build/AliceO2/O2/o2/macOS':
2723
description: build/AliceO2/O2/o2/macOS
2824
type: boolean
@@ -31,14 +27,10 @@ name: Clean PR checks
3127
description: build/AliceO2/O2/o2/macOS-arm
3228
type: boolean
3329
default: true
34-
'check_build/O2/fullCI':
30+
'check_build/O2/fullCI_slc9':
3531
description: build/O2/fullCI
3632
type: boolean
3733
default: true
38-
'check_build/O2/o2-cs8':
39-
description: build/O2/o2-cs8
40-
type: boolean
41-
default: true
4234
'check_build/O2/o2-dataflow-cs8':
4335
description: build/O2/o2-dataflow-cs8
4436
type: boolean

.github/workflows/reports.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ jobs:
1717
if: github.repository == 'AliceO2Group/AliceO2'
1818

1919
steps:
20-
- uses: actions/checkout@v3
20+
- uses: actions/checkout@v4
2121
- name: Set up Python 3.10
2222
uses: actions/setup-python@v5
2323
with:
2424
python-version: '3.10'
25-
- uses: actions/cache@v2
25+
- uses: actions/cache@v4
2626
name: Configure pip caching
2727
with:
2828
path: ~/.cache/pip

CCDB/include/CCDB/BasicCCDBManager.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,10 +330,10 @@ T* CCDBManagerInstance::getForRun(std::string const& path, int runNumber, bool s
330330
template <typename T>
331331
T* CCDBManagerInstance::getSpecificForRun(std::string const& path, int runNumber, MD metaData)
332332
{
333-
auto [start, stop] = getRunDuration(runNumber);
333+
auto [start, stop] = getRunDuration(runNumber, mFatalWhenNull);
334334
if (start < 0 || stop < 0) {
335335
if (mFatalWhenNull) {
336-
reportFatal(std::string("Failed to get run duration for run ") + std::to_string(runNumber));
336+
reportFatal(std::string("Failed to get run duration for run ") + std::to_string(runNumber) + std::string(" from CCDB"));
337337
}
338338
return nullptr;
339339
}

CCDB/include/CCDB/CCDBDownloader.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ struct HeaderObjectPair_t {
4747

4848
typedef struct DownloaderRequestData {
4949
std::vector<std::string> hosts;
50+
std::vector<std::string> locations;
5051
std::string path;
5152
long timestamp;
5253
HeaderObjectPair_t hoPair;
@@ -231,12 +232,13 @@ class CCDBDownloader
231232
std::string prepareRedirectedURL(std::string address, std::string potentialHost) const;
232233

233234
/**
234-
* Returns a vector of possible content locations based on the redirect headers.
235+
* Updates the locations vector with the the locations.
235236
*
236-
* @param baseUrl Content path.
237237
* @param headerMap Map containing response headers.
238+
* @param locations Location list to be updated.
239+
* @param locIndex Index of the next locaiton to be tried.
238240
*/
239-
std::vector<std::string> getLocations(std::multimap<std::string, std::string>* headerMap) const;
241+
void updateLocations(std::multimap<std::string, std::string>* headerMap, std::vector<std::string>* locations, int* locIndex) const;
240242

241243
std::string mUserAgentId = "CCDBDownloader";
242244
/**

CCDB/include/CCDB/CcdbApi.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,11 @@ class CcdbApi //: public DatabaseInterface
348348
TObject* retrieveFromTFile(std::string const& path, std::map<std::string, std::string> const& metadata, long timestamp,
349349
std::map<std::string, std::string>* headers, std::string const& etag,
350350
const std::string& createdNotAfter, const std::string& createdNotBefore) const;
351+
void loadFileToMemory(std::vector<char>& dest, std::string const& path,
352+
std::map<std::string, std::string> const& metadata, long timestamp,
353+
std::map<std::string, std::string>* headers, std::string const& etag,
354+
const std::string& createdNotAfter, const std::string& createdNotBefore, bool considerSnapshot = true) const;
355+
351356
#if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__ROOTCLING__) && !defined(__CLING__)
352357
typedef struct RequestContext {
353358
o2::pmr::vector<char>& dest;
@@ -383,7 +388,7 @@ class CcdbApi //: public DatabaseInterface
383388
static bool removeSemaphore(std::string const& name, bool remove = false);
384389
static void removeLeakingSemaphores(std::string const& basedir, bool remove = false);
385390

386-
void loadFileToMemory(o2::pmr::vector<char>& dest, const std::string& path, std::map<std::string, std::string>* localHeaders = nullptr) const;
391+
void loadFileToMemory(o2::pmr::vector<char>& dest, const std::string& path, std::map<std::string, std::string>* localHeaders = nullptr, bool fetchLocalMetaData = true) const;
387392
void loadFileToMemory(o2::pmr::vector<char>& dest, std::string const& path,
388393
std::map<std::string, std::string> const& metadata, long timestamp,
389394
std::map<std::string, std::string>* headers, std::string const& etag,

CCDB/src/CCDBDownloader.cxx

Lines changed: 38 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ void CCDBDownloader::tryNewHost(PerformData* performData, CURL* easy_handle)
362362
{
363363
auto requestData = performData->requestData;
364364
std::string newUrl = requestData->hosts.at(performData->hostInd) + "/" + requestData->path + "/" + std::to_string(requestData->timestamp);
365-
LOG(debug) << "Connecting to another host " << newUrl;
365+
LOG(debug) << "Connecting to another host " << newUrl << "\n";
366366
requestData->hoPair.header.clear();
367367
curl_easy_setopt(easy_handle, CURLOPT_URL, newUrl.c_str());
368368
mHandlesToBeAdded.push_back(easy_handle);
@@ -374,9 +374,11 @@ void CCDBDownloader::getLocalContent(PerformData* performData, std::string& newL
374374
LOG(debug) << "Redirecting to local content " << newLocation << "\n";
375375
if (requestData->localContentCallback(newLocation)) {
376376
contentRetrieved = true;
377+
LOG(debug) << "Local content retrieved succesfully: " << newLocation << " n";
377378
} else {
378379
// Prepare next redirect url
379380
newLocation = getNewLocation(performData, locations);
381+
LOG(debug) << "Failed to retrieve local content: " << newLocation << "\n";
380382
}
381383
}
382384

@@ -396,15 +398,15 @@ std::string CCDBDownloader::getNewLocation(PerformData* performData, std::vector
396398
void CCDBDownloader::httpRedirect(PerformData* performData, std::string& newLocation, CURL* easy_handle)
397399
{
398400
auto requestData = performData->requestData;
399-
LOG(debug) << "Trying content location " << newLocation;
401+
LOG(debug) << "Trying content location " << newLocation << "\n";
400402
curl_easy_setopt(easy_handle, CURLOPT_URL, newLocation.c_str());
401403
mHandlesToBeAdded.push_back(easy_handle);
402404
}
403405

404406
void CCDBDownloader::followRedirect(PerformData* performData, CURL* easy_handle, std::vector<std::string>& locations, bool& rescheduled, bool& contentRetrieved)
405407
{
406408
std::string newLocation = getNewLocation(performData, locations);
407-
if (newLocation.find("alien:/", 0) != std::string::npos || newLocation.find("file:/", 0) != std::string::npos) {
409+
while (!contentRetrieved && (newLocation.find("alien:/", 0) != std::string::npos || newLocation.find("file:/", 0) != std::string::npos)) {
408410
getLocalContent(performData, newLocation, contentRetrieved, locations);
409411
}
410412
if (!contentRetrieved && newLocation != "") {
@@ -508,17 +510,17 @@ void CCDBDownloader::transferFinished(CURL* easy_handle, CURLcode curlCode)
508510
std::string currentHost = requestData->hosts[performData->hostInd];
509511
std::string loggingMessage = prepareLogMessage(currentHost, requestData->userAgent, requestData->path, requestData->timestamp, requestData->headers, httpCode);
510512

511-
// Get alternative locations for the same host
512-
auto locations = getLocations(&(requestData->hoPair.header));
513+
// Get new locations based on received headers
514+
updateLocations(&(requestData->hoPair.header), &requestData->locations, &performData->locInd);
513515

514516
// React to received http code
515517
if (200 <= httpCode && httpCode < 400) {
516518
LOG(debug) << loggingMessage;
517519
if (304 == httpCode) {
518520
LOGP(debug, "Object exists but I am not serving it since it's already in your possession");
519521
contentRetrieved = true;
520-
} else if (300 <= httpCode && httpCode < 400 && performData->locInd < locations.size()) {
521-
followRedirect(performData, easy_handle, locations, rescheduled, contentRetrieved);
522+
} else if (300 <= httpCode && httpCode < 400 && performData->locInd < requestData->locations.size()) {
523+
followRedirect(performData, easy_handle, requestData->locations, rescheduled, contentRetrieved);
522524
} else if (200 <= httpCode && httpCode < 300) {
523525
contentRetrieved = true; // Can be overruled by following error check
524526
}
@@ -531,8 +533,16 @@ void CCDBDownloader::transferFinished(CURL* easy_handle, CURLcode curlCode)
531533
contentRetrieved = false;
532534
}
533535

534-
// Check if content was retrieved, or scheduled to be retrieved
535-
if (!rescheduled && !contentRetrieved && performData->locInd == locations.size()) {
536+
// Check if content was retrieved or scheduled to be retrieved
537+
if (!rescheduled && !contentRetrieved) {
538+
// Current location failed without providing 3xx http code, try next redirect for the same host
539+
if (performData->locInd < requestData->locations.size()) {
540+
followRedirect(performData, easy_handle, requestData->locations, rescheduled, contentRetrieved);
541+
}
542+
}
543+
544+
// Check again because content might have been retrieved or rescheduled via a redirect
545+
if (!rescheduled && !contentRetrieved) {
536546
// Ran out of locations to redirect, try new host
537547
if (++performData->hostInd < requestData->hosts.size()) {
538548
tryNewHost(performData, easy_handle);
@@ -650,24 +660,37 @@ CURLcode CCDBDownloader::perform(CURL* handle)
650660
return batchBlockingPerform(handleVector).back();
651661
}
652662

653-
std::vector<std::string> CCDBDownloader::getLocations(std::multimap<std::string, std::string>* headerMap) const
663+
void CCDBDownloader::updateLocations(std::multimap<std::string, std::string>* headerMap, std::vector<std::string>* locations, int* locIndex) const
654664
{
655-
std::vector<std::string> locs;
665+
std::vector<std::string> newLocations;
666+
656667
auto iter = headerMap->find("Location");
657668
if (iter != headerMap->end()) {
658-
locs.push_back(iter->second);
669+
auto range = headerMap->equal_range("Location");
670+
for (auto it = range.first; it != range.second; ++it) {
671+
if (std::find(locations->begin(), locations->end(), it->second) == locations->end()) {
672+
if (std::find(newLocations.begin(), newLocations.end(), it->second) == newLocations.end()) {
673+
newLocations.push_back(it->second);
674+
}
675+
}
676+
}
659677
}
678+
660679
// add alternative locations (not yet included)
661680
auto iter2 = headerMap->find("Content-Location");
662681
if (iter2 != headerMap->end()) {
663682
auto range = headerMap->equal_range("Content-Location");
664683
for (auto it = range.first; it != range.second; ++it) {
665-
if (std::find(locs.begin(), locs.end(), it->second) == locs.end()) {
666-
locs.push_back(it->second);
684+
if (std::find(locations->begin(), locations->end(), it->second) == locations->end()) {
685+
if (std::find(newLocations.begin(), newLocations.end(), it->second) == newLocations.end()) {
686+
newLocations.push_back(it->second);
687+
}
667688
}
668689
}
669690
}
670-
return locs;
691+
692+
// Insert location list at the current location index. This assures that the provided locations will be tried first.
693+
locations->insert(locations->begin() + (*locIndex), newLocations.begin(), newLocations.end());
671694
}
672695

673696
std::vector<CURLcode> CCDBDownloader::batchBlockingPerform(std::vector<CURL*> const& handleVector)

CCDB/src/CcdbApi.cxx

Lines changed: 51 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,23 @@ size_t header_map_callback(char* buffer, size_t size, size_t nitems, void* userd
667667
}
668668
}
669669
}
670+
671+
// Keep only the first ETag encountered
672+
if (key == "ETag") {
673+
auto cl = headers->find("ETag");
674+
if (cl != headers->end()) {
675+
insert = false;
676+
}
677+
}
678+
679+
// Keep only the first Content-Type encountered
680+
if (key == "Content-Type") {
681+
auto cl = headers->find("Content-Type");
682+
if (cl != headers->end()) {
683+
insert = false;
684+
}
685+
}
686+
670687
if (insert) {
671688
headers->insert(std::make_pair(key, value));
672689
}
@@ -1461,7 +1478,7 @@ std::map<std::string, std::string> CcdbApi::retrieveHeaders(std::string const& p
14611478

14621479
if (!mSnapshotCachePath.empty()) {
14631480
// protect this sensitive section by a multi-process named semaphore
1464-
auto semaphore_barrier = std::make_unique<CCDBSemaphore>(mSnapshotCachePath, path);
1481+
auto semaphore_barrier = std::make_unique<CCDBSemaphore>(mSnapshotCachePath + std::string("_headers"), path);
14651482

14661483
std::string logfile = mSnapshotCachePath + "/log";
14671484
std::fstream out(logfile, ios_base::out | ios_base::app);
@@ -1870,6 +1887,21 @@ void CcdbApi::saveSnapshot(RequestContext& requestContext) const
18701887
}
18711888
}
18721889

1890+
void CcdbApi::loadFileToMemory(std::vector<char>& dest, std::string const& path,
1891+
std::map<std::string, std::string> const& metadata, long timestamp,
1892+
std::map<std::string, std::string>* headers, std::string const& etag,
1893+
const std::string& createdNotAfter, const std::string& createdNotBefore, bool considerSnapshot) const
1894+
{
1895+
o2::pmr::vector<char> destP;
1896+
destP.reserve(dest.size());
1897+
loadFileToMemory(destP, path, metadata, timestamp, headers, etag, createdNotAfter, createdNotBefore, considerSnapshot);
1898+
dest.clear();
1899+
dest.reserve(destP.size());
1900+
for (const auto c : destP) {
1901+
dest.push_back(c);
1902+
}
1903+
}
1904+
18731905
void CcdbApi::loadFileToMemory(o2::pmr::vector<char>& dest, std::string const& path,
18741906
std::map<std::string, std::string> const& metadata, long timestamp,
18751907
std::map<std::string, std::string>* headers, std::string const& etag,
@@ -1956,20 +1988,32 @@ void CcdbApi::vectoredLoadFileToMemory(std::vector<RequestContext>& requestConte
19561988
bool CcdbApi::loadLocalContentToMemory(o2::pmr::vector<char>& dest, std::string& url) const
19571989
{
19581990
if (url.find("alien:/", 0) != std::string::npos) {
1959-
loadFileToMemory(dest, url, nullptr); // headers loaded from the file in case of the snapshot reading only
1960-
return true;
1991+
std::map<std::string, std::string> localHeaders;
1992+
loadFileToMemory(dest, url, &localHeaders, false);
1993+
auto it = localHeaders.find("Error");
1994+
if (it != localHeaders.end() && it->second == "An error occurred during retrieval") {
1995+
return false;
1996+
} else {
1997+
return true;
1998+
}
19611999
}
19622000
if ((url.find("file:/", 0) != std::string::npos)) {
19632001
std::string path = url.substr(7);
19642002
if (std::filesystem::exists(path)) {
1965-
loadFileToMemory(dest, path, nullptr);
1966-
return true;
2003+
std::map<std::string, std::string> localHeaders;
2004+
loadFileToMemory(dest, url, &localHeaders, o2::utils::Str::endsWith(path, ".root"));
2005+
auto it = localHeaders.find("Error");
2006+
if (it != localHeaders.end() && it->second == "An error occurred during retrieval") {
2007+
return false;
2008+
} else {
2009+
return true;
2010+
}
19672011
}
19682012
}
19692013
return false;
19702014
}
19712015

1972-
void CcdbApi::loadFileToMemory(o2::pmr::vector<char>& dest, const std::string& path, std::map<std::string, std::string>* localHeaders) const
2016+
void CcdbApi::loadFileToMemory(o2::pmr::vector<char>& dest, const std::string& path, std::map<std::string, std::string>* localHeaders, bool fetchLocalMetaData) const
19732017
{
19742018
// Read file to memory as vector. For special case of the locally cached file retriev metadata stored directly in the file
19752019
constexpr size_t MaxCopySize = 0x1L << 25;
@@ -2017,7 +2061,7 @@ void CcdbApi::loadFileToMemory(o2::pmr::vector<char>& dest, const std::string& p
20172061
totalread += nread;
20182062
} while (nread == (long)MaxCopySize);
20192063

2020-
if (localHeaders) {
2064+
if (localHeaders && fetchLocalMetaData) {
20212065
TMemFile memFile("name", const_cast<char*>(dest.data()), dest.size(), "READ");
20222066
auto storedmeta = (std::map<std::string, std::string>*)extractFromTFile(memFile, TClass::GetClass("std::map<std::string, std::string>"), CCDBMETA_ENTRY);
20232067
if (storedmeta) {

CODEOWNERS

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@
2929
/DataFormats/Detectors/CPV @peressounko @kharlov
3030
/DataFormats/Detectors/CTP @lietava
3131
/DataFormats/Detectors/EMCAL @mfasDa @jokonig
32-
/DataFormats/Detectors/FIT @jotwinow @afurs @andreasmolander @arvindkhuntia @mslupeck
32+
/DataFormats/Detectors/FIT @jotwinow @afurs @andreasmolander @sahilupadhyaya92
3333
/DataFormats/Detectors/FOCAL @maxrauch @mfasDa @iarsene @matthiasrichter
3434
/DataFormats/Detectors/GlobalTracking @shahor02
3535
/DataFormats/Detectors/GlobalTrackingWorkflow @shahor02
3636
/DataFormats/Detectors/HMPID @gvolpe79
37-
/DataFormats/Detectors/ITSMFT @mcoquet642 @mconcas @shahor02
37+
/DataFormats/Detectors/ITSMFT @fprino @mcoquet642 @mconcas @shahor02
3838
/DataFormats/Detectors/MUON @AliceO2Group/muon-experts @shahor02
3939
/DataFormats/Detectors/PHOS @peressounko @kharlov
4040
/DataFormats/Detectors/Passive @sawenzel
@@ -59,13 +59,13 @@
5959
/Detectors/Calibration @chiarazampolli @shahor02
6060
/Detectors/CPV @peressounko @kharlov
6161
/Detectors/EMCAL @mfasDa @jokonig
62-
/Detectors/FIT @jotwinow @afurs @andreasmolander @arvindkhuntia @mslupeck
62+
/Detectors/FIT @jotwinow @afurs @andreasmolander @sahilupadhyaya92
6363
/Detectors/FOCAL @maxrauch @mfasDa @iarsene @matthiasrichter
6464
/Detectors/Geometry @sawenzel @shahor02
6565
/Detectors/GlobalTracking @shahor02
6666
/Detectors/GlobalTrackingWorkflow @shahor02
6767
/Detectors/HMPID @gvolpe79
68-
/Detectors/ITSMFT @mcoquet642 @mconcas @shahor02
68+
/Detectors/ITSMFT @fprino @mcoquet642 @mconcas @shahor02
6969
/Detectors/MUON @AliceO2Group/muon-experts @shahor02
7070
/Detectors/PHOS @peressounko @kharlov
7171
/Detectors/Passive @sawenzel

Common/Constants/include/CommonConstants/PhysicsConstants.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ enum Pdg {
5252
kDS1 = 10433,
5353
kDS2Star = 435,
5454
kDStar = 413,
55+
kDStar0 = 423,
5556
kChiC1 = 20443,
5657
kJPsi = 443,
5758
kLambdaB0 = 5122,
@@ -101,6 +102,7 @@ constexpr double MassDSStar = 2.1122;
101102
constexpr double MassDS1 = 2.53511;
102103
constexpr double MassDS2Star = 2.5691;
103104
constexpr double MassDStar = 2.01026;
105+
constexpr double MassDStar0 = 2.00685;
104106
constexpr double MassChiC1 = 3.51067;
105107
constexpr double MassJPsi = 3.0969;
106108
constexpr double MassLambdaB0 = 5.6196;

Common/Constants/include/CommonConstants/make_pdg_header.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ class Pdg(Enum):
107107
kDS1 = 10433
108108
kDS2Star = 435
109109
kDStar = 413
110+
kDStar0 = 423
110111
kChiC1 = 20443
111112
kJPsi = 443
112113
kLambdaB0 = 5122

0 commit comments

Comments
 (0)