Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Framework/Core/include/Framework/O2ControlLabels.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ const extern DataProcessorLabel uniqueProxyLabel;
// Thus, AliECS will not perform host and port allocation automatically. It takes priority over `uniqueProxyLabel`.
const extern DataProcessorLabel preserveRawChannelsLabel;

// This label makes AliECS templates add the property `qcConfiguration` to the tasks, allowing them
// to reconfigure in init with a freshly templated config.
const extern DataProcessorLabel qcReconfigurable;

} // namespace ecs
} // namespace o2::framework

Expand Down
49 changes: 39 additions & 10 deletions Framework/Core/src/O2ControlHelpers.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,41 @@ std::vector<RawChannel> extractRawChannels(const DeviceSpec& spec, const DeviceE
return rawChannels;
}

bool isUniqueProxy(const DeviceSpec& spec)
{
return std::find(spec.labels.begin(), spec.labels.end(), ecs::uniqueProxyLabel) != spec.labels.end();
}

bool shouldPreserveRawChannels(const DeviceSpec& spec)
{
return std::find(spec.labels.begin(), spec.labels.end(), ecs::preserveRawChannelsLabel) != spec.labels.end();
}

bool isQcReconfigurable(const DeviceSpec& spec)
{
return std::find(spec.labels.begin(), spec.labels.end(), ecs::qcReconfigurable) != spec.labels.end();
}

void dumpProperties(std::ostream& dumpOut, const DeviceExecution& execution, const DeviceSpec& spec, const std::string& indLevel)
{
// get the argument `--config`
std::string configPath;
auto it = std::find_if(execution.args.begin(), execution.args.end(), [](char* v) { return v != nullptr && strcmp(v, "--config") == 0; });

// get the next argument and find `/o2/components/` in it, then take what comes after in the string.
if (it != execution.args.end()) {
std::string configParam = *(++it);
std::string prefix = "/o2/components/"; // keep only the path to the config file, i.e. stuff after "/o2/components/"
size_t pos = configParam.find(prefix);
if (pos != std::string::npos) {
configPath = configParam.substr(pos + prefix.length());
}
}

dumpOut << indLevel << "properties:\n";
dumpOut << indLevel << indScheme << "qcConfiguration: " << configPath << "\n";
}

void dumpCommand(std::ostream& dumpOut, const DeviceExecution& execution, std::string indLevel)
{
dumpOut << indLevel << "shell: true\n";
Expand Down Expand Up @@ -260,16 +295,6 @@ std::string findBinder(const std::vector<DeviceSpec>& specs, const std::string&
throw std::runtime_error("Could not find a device which binds the '" + channel + "' channel.");
}

bool isUniqueProxy(const DeviceSpec& spec)
{
return std::find(spec.labels.begin(), spec.labels.end(), ecs::uniqueProxyLabel) != spec.labels.end();
}

bool shouldPreserveRawChannels(const DeviceSpec& spec)
{
return std::find(spec.labels.begin(), spec.labels.end(), ecs::preserveRawChannelsLabel) != spec.labels.end();
}

void dumpRole(std::ostream& dumpOut, const std::string& taskName, const DeviceSpec& spec, const std::vector<DeviceSpec>& allSpecs, const DeviceExecution& execution, const std::string indLevel)
{
dumpOut << indLevel << "- name: \"" << spec.id << "\"\n";
Expand Down Expand Up @@ -374,6 +399,10 @@ void dumpTask(std::ostream& dumpOut, const DeviceSpec& spec, const DeviceExecuti
}
}

if (implementation::isQcReconfigurable(spec)) {
implementation::dumpProperties(dumpOut, execution, spec, indLevel);
}

dumpOut << indLevel << "command:\n";
implementation::dumpCommand(dumpOut, execution, indLevel + indScheme);
}
Expand Down
1 change: 1 addition & 0 deletions Framework/Core/src/O2ControlLabels.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ namespace o2::framework::ecs

const DataProcessorLabel uniqueProxyLabel = {"ecs-unique-proxy"};
const DataProcessorLabel preserveRawChannelsLabel = {"ecs-preserve-raw-channels"};
const DataProcessorLabel qcReconfigurable = {"qc-reconfigurable"};
}