Skip to content

Commit

Permalink
Merge branch 'dev' into pr12854
Browse files Browse the repository at this point in the history
  • Loading branch information
ktf authored May 8, 2024
2 parents dc4bf48 + 3783e50 commit 2d2e2f0
Show file tree
Hide file tree
Showing 669 changed files with 15,579 additions and 6,425 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/reports.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.7
uses: actions/setup-python@v1
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: 3.7
python-version: '3.10'
- uses: actions/cache@v2
name: Configure pip caching
with:
Expand Down Expand Up @@ -81,7 +81,7 @@ jobs:
run: |
set -x
mkdir -p doc/data
# We create new files once per month, mostly so that
# We create new files once per month, mostly so that
# we can keep the query results small. It does not
# matter if we get results from different months,
# as what matters is how we merge them.
Expand All @@ -96,7 +96,6 @@ jobs:
# being published
LAST_RELEASE="${{ github.event.inputs.LAST_RELEASE_DATE }}"
MERGED_AFTER=${LAST_RELEASE:-$(date -v -14d +%Y-%m-%d)}
# Here we convert all the json files to per subsystem
# logs, using the MERGED_AFTER date to further filter them.
# Notice we can have duplicates in each file,
Expand All @@ -106,7 +105,7 @@ jobs:
for f in doc/data/*_prs.json; do
for x in Algorithm Analysis Common DataFormats Detectors EventVisualisation Examples Framework Generators Steer Testing Utilities; do
cat $f | jq ".repository.pullRequests.edges[].node | select(.files.edges[].node.path | test(\"$x\")) | del(.files) | select(.state == \"MERGED\" and .mergedAt >= \"${MERGED_AFTER}\")" > /tmp/${x}_prs.json
if [ ! X`jq -s length /tmp/${x}_prs.json` = X0 ]; then
if [ ! X`jq -s length /tmp/${x}_prs.json` = X0 ]; then
cat /tmp/${x}_prs.json | jq -r '"- [#\(.number)](https://github.com/AliceO2Group/AliceO2/pull/\(.number)) \(.mergedAt | split("T")[0]): \(.title) by [@\(.author.login)](https://github.com/\(.author.login))"' | sort -u >> /tmp/${x}_prs.md
fi
done
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ compile_commands.json
.vscode
.ycm_extra_conf.py
Session.vim
CMakeLists.txt.user

# Datafiles
gphysi.dat
Expand Down
8 changes: 3 additions & 5 deletions CCDB/include/CCDB/BasicCCDBManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,11 @@ class CCDBManagerInstance
void setFatalWhenNull(bool b) { mFatalWhenNull = b; }

/// A convenience function for MC to fetch
/// valid start and end timestamps given an ALICE run number.
/// valid start and end timestamps for recorded TF data given an ALICE run number.
/// In absence of STF/ETF fields in the RCT with fall back to CTP SOX/EOX then to
/// ECS SOR/EOR.
/// On error it fatals (if fatal == true) or else returns the pair -1, -1.
std::pair<int64_t, int64_t> getRunDuration(int runnumber, bool fatal = true);

/// A convenience function for MC to fetch
/// valid start and end timestamps given an ALICE run number.
/// On error it fatals (if fatal == true) or else returns the pair -1, -1.
static std::pair<int64_t, int64_t> getRunDuration(o2::ccdb::CcdbApi const& api, int runnumber, bool fatal = true);

std::string getSummaryString() const;
Expand Down
4 changes: 3 additions & 1 deletion CCDB/include/CCDB/CCDBDownloader.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ typedef struct DownloaderRequestData {
HeaderObjectPair_t hoPair;
std::map<std::string, std::string>* headers;
std::string userAgent;
curl_slist* optionsList;

std::function<bool(std::string)> localContentCallback;
} DownloaderRequestData;
Expand Down Expand Up @@ -296,6 +297,7 @@ class CCDBDownloader
int hostInd;
int locInd;
DownloaderRequestData* requestData;
curl_slist** options;
} PerformData;
#endif

Expand Down Expand Up @@ -421,6 +423,6 @@ typedef struct DataForClosingSocket {
curl_socket_t socket;
} DataForClosingSocket;

} // namespace o2
} // namespace o2::ccdb

#endif // O2_CCDB_CCDBDOWNLOADER_H
33 changes: 20 additions & 13 deletions CCDB/src/BasicCCDBManager.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,29 @@ std::pair<int64_t, int64_t> CCDBManagerInstance::getRunDuration(o2::ccdb::CcdbAp
auto response = api.retrieveHeaders("RCT/Info/RunInformation", std::map<std::string, std::string>(), runnumber);
if (response.size() != 0) {
std::string report{};
auto strt = response.find("SOX");
auto strt = response.find("STF");
auto stop = response.find("ETF");
long valStrt = (strt == response.end()) ? -1L : boost::lexical_cast<int64_t>(strt->second);
if (valStrt < 1) {
report += fmt::format(" Missing/invalid SOX -> use SOR");
strt = response.find("SOR");
valStrt = (strt == response.end()) ? -1L : boost::lexical_cast<int64_t>(strt->second);
}
auto stop = response.find("EOX");
long valStop = (stop == response.end()) ? -1L : boost::lexical_cast<int64_t>(stop->second);
if (valStop < 1) {
report += fmt::format(" | Missing/invalid EOX -> use EOR");
stop = response.find("EOR");
if (valStrt < 0 || valStop < 0) {
report += "Missing STF/EFT -> use SOX/EOX;";
strt = response.find("SOX");
valStrt = (strt == response.end()) ? -1L : boost::lexical_cast<int64_t>(strt->second);
if (valStrt < 1) {
report += fmt::format(" Missing/invalid SOX -> use SOR");
strt = response.find("SOR");
valStrt = (strt == response.end()) ? -1L : boost::lexical_cast<int64_t>(strt->second);
}
stop = response.find("EOX");
valStop = (stop == response.end()) ? -1L : boost::lexical_cast<int64_t>(stop->second);
}
if (!report.empty()) {
LOGP(warn, "{}", report);
if (valStop < 1) {
report += fmt::format(" | Missing/invalid EOX -> use EOR");
stop = response.find("EOR");
valStop = (stop == response.end()) ? -1L : boost::lexical_cast<int64_t>(stop->second);
}
if (!report.empty()) {
LOGP(warn, "{}", report);
}
}
if (valStrt > 0 && valStop >= valStrt) {
return std::make_pair(valStrt, valStop);
Expand Down
6 changes: 5 additions & 1 deletion CCDB/src/CCDBDownloader.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -535,8 +535,10 @@ void CCDBDownloader::transferFinished(CURL* easy_handle, CURLcode curlCode)
}
}
--(*performData->requestsLeft);
curl_slist_free_all(*performData->options);
delete requestData;
delete performData->codeDestination;
curl_easy_cleanup(easy_handle);
}
} break;
}
Expand Down Expand Up @@ -681,6 +683,7 @@ void CCDBDownloader::asynchSchedule(CURL* handle, size_t* requestCounter)
curl_easy_getinfo(handle, CURLINFO_PRIVATE, &requestData);
headerMap = &(requestData->hoPair.header);
hostsPool = &(requestData->hosts);
auto* options = &(requestData->optionsList);

// Prepare temporary data about transfer
auto* data = new CCDBDownloader::PerformData(); // Freed in transferFinished
Expand All @@ -692,6 +695,7 @@ void CCDBDownloader::asynchSchedule(CURL* handle, size_t* requestCounter)
data->hostInd = 0;
data->locInd = 0;
data->requestData = requestData;
data->options = options;

// Prepare handle and schedule download
setHandleOptions(handle, data);
Expand Down Expand Up @@ -719,4 +723,4 @@ std::string CCDBDownloader::prepareLogMessage(std::string host_url, std::string
return fmt::format("CcdbDownloader finished transfer {}{}{} for {} (agent_id: {}) with http code: {}", host_url, (host_url.back() == '/') ? "" : "/", upath, (ts < 0) ? getCurrentTimestamp() : ts, userAgent, httpCode);
}

} // namespace o2
} // namespace o2::ccdb
1 change: 1 addition & 0 deletions CCDB/src/CcdbApi.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1656,6 +1656,7 @@ void CcdbApi::scheduleDownload(RequestContext& requestContext, size_t* requestCo
data->timestamp = requestContext.timestamp;
data->localContentCallback = localContentCallback;
data->userAgent = mUniqueAgentID;
data->optionsList = options_list;

curl_easy_setopt(curl_handle, CURLOPT_URL, fullUrl.c_str());
initCurlOptionsForRetrieve(curl_handle, (void*)(&data->hoPair), writeCallback, false);
Expand Down
74 changes: 29 additions & 45 deletions CCDB/test/testCcdbApiDownloader.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include <fairlogger/Logger.h>

#include <boost/test/unit_test.hpp>
#include <boost/optional/optional.hpp>
#include <boost/asio/ip/host_name.hpp>
#include <uv.h>

Expand Down Expand Up @@ -129,7 +128,7 @@ std::vector<CURL*> prepareAsyncHandles(size_t num, std::vector<o2::pmr::vector<c

auto data = new DownloaderRequestData();
data->hoPair.object = dest;
data->hosts.push_back("http://ccdb-test.cern.ch:8080");
data->hosts.emplace_back("http://ccdb-test.cern.ch:8080");
data->path = "Analysis/ALICE3/Centrality";
data->timestamp = 1646729604010;
data->localContentCallback = nullptr;
Expand Down Expand Up @@ -164,15 +163,20 @@ BOOST_AUTO_TEST_CASE(asynch_schedule_test)
}

while (transfersLeft > 0) {
downloader.runLoop(0);
downloader.runLoop(false);
}

for (int i = 0; i < TRANSFERS; i++) {
long httpCode;
curl_easy_getinfo(handles[i], CURLINFO_HTTP_CODE, &httpCode);
BOOST_CHECK(httpCode == 200);
BOOST_CHECK(dests[i]->size() != 0);
curl_easy_cleanup(handles[i]);
// I would claim that accessing the handles after they are complete
// is actually not supported by the current API, because it was
// previously relying on leaking the handles. Disabling the whole
// thing until we verify that's actually the case.
//
// long httpCode;
// curl_easy_getinfo(handles[i], CURLINFO_HTTP_CODE, &httpCode);
// BOOST_CHECK_EQUAL(httpCode, 200);
// BOOST_CHECK_NE(dests[i]->size(), 0);
// curl_easy_cleanup(handles[i]);
delete dests[i];
}
curl_global_cleanup();
Expand All @@ -191,13 +195,11 @@ BOOST_AUTO_TEST_CASE(perform_test)

CURLcode curlCode = downloader.perform(handle);

BOOST_CHECK(curlCode == CURLE_OK);
std::cout << "CURL code: " << curlCode << "\n";
BOOST_CHECK_EQUAL(curlCode, CURLE_OK);

long httpCode;
curl_easy_getinfo(handle, CURLINFO_HTTP_CODE, &httpCode);
BOOST_CHECK(httpCode == 200);
std::cout << "HTTP code: " << httpCode << "\n";
BOOST_CHECK_EQUAL(httpCode, 200);

curl_easy_cleanup(handle);
curl_global_cleanup();
Expand All @@ -220,19 +222,13 @@ BOOST_AUTO_TEST_CASE(blocking_batch_test)

auto curlCodes = downloader.batchBlockingPerform(handleVector);
for (CURLcode code : curlCodes) {
BOOST_CHECK(code == CURLE_OK);
if (code != CURLE_OK) {
std::cout << "CURL Code: " << code << "\n";
}
BOOST_CHECK_EQUAL(code, CURLE_OK);
}

for (CURL* handle : handleVector) {
long httpCode;
curl_easy_getinfo(handle, CURLINFO_HTTP_CODE, &httpCode);
BOOST_CHECK(httpCode == 200);
if (httpCode != 200) {
std::cout << "HTTP Code: " << httpCode << "\n";
}
BOOST_CHECK_EQUAL(httpCode, 200);
curl_easy_cleanup(handle);
}

Expand Down Expand Up @@ -261,19 +257,13 @@ BOOST_AUTO_TEST_CASE(test_with_break)
auto curlCodes = downloader.batchBlockingPerform(handleVector);

for (CURLcode code : curlCodes) {
BOOST_CHECK(code == CURLE_OK);
if (code != CURLE_OK) {
std::cout << "CURL Code: " << code << "\n";
}
BOOST_CHECK_EQUAL(code, CURLE_OK);
}

for (CURL* handle : handleVector) {
long httpCode;
curl_easy_getinfo(handle, CURLINFO_HTTP_CODE, &httpCode);
BOOST_CHECK(httpCode == 200);
if (httpCode != 200) {
std::cout << "HTTP Code: " << httpCode << "\n";
}
BOOST_CHECK_EQUAL(httpCode, 200);
curl_easy_cleanup(handle);
}

Expand All @@ -292,19 +282,13 @@ BOOST_AUTO_TEST_CASE(test_with_break)

auto curlCodes2 = downloader.batchBlockingPerform(handleVector2);
for (CURLcode code : curlCodes2) {
BOOST_CHECK(code == CURLE_OK);
if (code != CURLE_OK) {
std::cout << "CURL Code: " << code << "\n";
}
BOOST_CHECK_EQUAL(code, CURLE_OK);
}

for (CURL* handle : handleVector2) {
long httpCode;
curl_easy_getinfo(handle, CURLINFO_HTTP_CODE, &httpCode);
BOOST_CHECK(httpCode == 200);
if (httpCode != 200) {
std::cout << "HTTP Code: " << httpCode << "\n";
}
BOOST_CHECK_EQUAL(httpCode, 200);
curl_easy_cleanup(handle);
}

Expand Down Expand Up @@ -357,18 +341,18 @@ BOOST_AUTO_TEST_CASE(external_loop_test)

CURLcode curlCode = downloader->perform(handle);

BOOST_CHECK(curlCode == CURLE_OK);
BOOST_CHECK_EQUAL(curlCode, CURLE_OK);

long httpCode;
curl_easy_getinfo(handle, CURLINFO_HTTP_CODE, &httpCode);
BOOST_CHECK(httpCode == 200);
BOOST_CHECK_EQUAL(httpCode, 200);

curl_easy_cleanup(handle);
curl_global_cleanup();

// Check if test timer and external loop are still alive
BOOST_CHECK(uv_is_active((uv_handle_t*)testTimer) != 0);
BOOST_CHECK(uv_loop_alive(uvLoop) != 0);
BOOST_CHECK_NE(uv_is_active((uv_handle_t*)testTimer), 0);
BOOST_CHECK_NE(uv_loop_alive(uvLoop), 0);

// Downloader must be closed before uv_loop.
// The reason for that are the uv_poll handles attached to the curl multi handle.
Expand All @@ -384,11 +368,11 @@ BOOST_AUTO_TEST_CASE(external_loop_test)
BOOST_AUTO_TEST_CASE(trim_host_url_test)
{
CCDBDownloader downloader;
BOOST_CHECK(downloader.trimHostUrl("http://localhost:8080") == "http://localhost:8080");
BOOST_CHECK(downloader.trimHostUrl("http://localhost") == "http://localhost");
BOOST_CHECK(downloader.trimHostUrl("http://localhost:8080/some/path") == "http://localhost:8080");
BOOST_CHECK(downloader.trimHostUrl("http://localhost/some/path") == "http://localhost");
BOOST_CHECK(downloader.trimHostUrl("http://localhost:8080/Task/Detector/1?HTTPOnly=true") == "http://localhost:8080");
BOOST_CHECK_EQUAL(downloader.trimHostUrl("http://localhost:8080"), "http://localhost:8080");
BOOST_CHECK_EQUAL(downloader.trimHostUrl("http://localhost"), "http://localhost");
BOOST_CHECK_EQUAL(downloader.trimHostUrl("http://localhost:8080/some/path"), "http://localhost:8080");
BOOST_CHECK_EQUAL(downloader.trimHostUrl("http://localhost/some/path"), "http://localhost");
BOOST_CHECK_EQUAL(downloader.trimHostUrl("http://localhost:8080/Task/Detector/1?HTTPOnly=true"), "http://localhost:8080");
}

} // namespace ccdb
Expand Down
8 changes: 3 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ include(CTest)
set(ALIGPU_BUILD_TYPE "O2")

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
string(TOUPPER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_UPPER)
set_property(GLOBAL PROPERTY REPORT_UNDEFINED_PROPERTIES)

cmake_host_system_information(RESULT _totalmem QUERY TOTAL_PHYSICAL_MEMORY)
Expand All @@ -37,13 +38,10 @@ set_property(GLOBAL PROPERTY JOB_POOLS analysis=${ANALYSIS_COMPILE_POOL})

include(O2BuildSanityChecks)
o2_build_sanity_checks()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)

find_package(ONNXRuntime::ONNXRuntime CONFIG)
if (ONNXRuntime::ONNXRuntime_FOUND)
add_definitions(-DZDC_FASTSIM_ONNX)
endif()
include(dependencies/FindONNXRuntime.cmake)

include(O2CheckCXXFeatures)
o2_check_cxx_features()
Expand Down
Loading

0 comments on commit 2d2e2f0

Please sign in to comment.