Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QC 1123]: using hash when description is too long #2171

Merged
merged 6 commits into from
Mar 13, 2024

Conversation

justonedev1
Copy link
Collaborator

No description provided.

@knopers8
Copy link
Collaborator

There are some tests failing on macOS. It's not clear to me why only there...

Copy link
Collaborator

@knopers8 knopers8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot! I have some improvement suggestions, but it's good to go in after they are addressed in any way.


#include <Headers/DataHeader.h>

namespace o2::common::hash
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
namespace o2::common::hash
namespace o2::quality_control::core

Since the header is anyway a part of the QualityControl framework library and the intended use is within QC, I would not put it in the general O2 namespace.

namespace o2::common::hash
{

o2::header::DataDescription createDataDescription(const std::string& name, size_t hash_length = 4);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
o2::header::DataDescription createDataDescription(const std::string& name, size_t hash_length = 4);
o2::header::DataDescription createDataDescription(const std::string& name, size_t hashLength = 4);

@@ -109,7 +109,7 @@ class AggregatorRunner : public framework::Task
static framework::DataProcessorLabel getLabel() { return { "qc-aggregator" }; }
static std::string createAggregatorRunnerIdString() { return "qc-aggregator"; };
static std::string createAggregatorRunnerName();
static header::DataDescription createAggregatorRunnerDataDescription(const std::string& aggregatorName);
static header::DataDescription createAggregatorRunnerDataDescription(const std::string& aggregatorName, size_t hashSize = 4);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
static header::DataDescription createAggregatorRunnerDataDescription(const std::string& aggregatorName, size_t hashSize = 4);
static header::DataDescription createAggregatorRunnerDataDescription(const std::string& aggregatorName);

This could be discussed, but I think it would be safer to assume always the same hash length for a given QC actor type. Otherwise, someone who wants to subscribe to any QC Data Processor would have to check the InfrastructureGenerator implementation (instead of just relying on information in a header) to use the correct hash length and would be exposed to incompatibilities if we change it.

I would propose that hashLength is a constant inside each of such create*DataDescription methods.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, I will change it for all of the factory methods. I just saw there is written N for hash length in ticket, so I kinda propagated it everywhere...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be clear, the general function in HashDataDescription should still have the argument, the component-specific ones should use constants.

} else {

std::stringstream ss{};
ss << std::hex << std::hash<std::string>{}(name);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps mac failures are related to the implementation of std::hash? I think it would be good to have the hash to return the same result on any platform and any execution, because we might generate a workflow template on one OS and use it in a different one.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it does... I thought that it might happen, but I still wanted to try it

Copy link
Collaborator Author

@justonedev1 justonedev1 Mar 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had an implementation of djb2 hash, but I took it away when I saw that std::hash is used for timers.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then indeed it's weird that it does not fail for timers...

Copy link
Collaborator Author

@justonedev1 justonedev1 Mar 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/AliceO2Group/QualityControl/blob/master/Framework/src/TaskRunner.cxx#L307-L320

I guess that there is not a test for exact task name of timers

Comment on lines 268 to 273
framework::OutputSpec Check::createOutputSpec(const std::string& checkName)
framework::OutputSpec Check::createOutputSpec(const std::string& detector, const std::string& checkName)
{
return { "QC", createCheckDataDescription(checkName), 0, framework::Lifetime::Sporadic };
using Origin = o2::header::DataOrigin;
Origin header;
header.runtimeInit(std::string{ "C" }.append(detector.substr(0, Origin::size)).c_str());
return { header, createCheckDataDescription(checkName), 0, framework::Lifetime::Sporadic };
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes duplicate #2170 . Could you please remove them from here and address the comment in the other PR?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, sorry. I based this branch by mistake on the branch for that task.

@justonedev1 justonedev1 requested a review from knopers8 March 13, 2024 11:19
Copy link
Collaborator

@knopers8 knopers8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@knopers8 knopers8 merged commit c3cdc0e into AliceO2Group:master Mar 13, 2024
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants