mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-13 08:41:16 +00:00
DDS plugin: Automatically set session and device id if not provided
Resolves #187
This commit is contained in:
parent
07fe02a0a0
commit
1bb77bf47b
|
@ -8,8 +8,8 @@
|
||||||
<declrequirement name="SinkWorker" type="wnname" value="sink"/>
|
<declrequirement name="SinkWorker" type="wnname" value="sink"/>
|
||||||
|
|
||||||
<decltask name="Sampler">
|
<decltask name="Sampler">
|
||||||
|
<exe>fairmq-ex-dds-sampler --color false --channel-config name=data1,type=push,method=bind --rate 100 -P dds</exe>
|
||||||
<env reachable="false">fairmq-ex-dds-env.sh</env>
|
<env reachable="false">fairmq-ex-dds-env.sh</env>
|
||||||
<exe>fairmq-ex-dds-sampler --id sampler --color false --channel-config name=data1,type=push,method=bind --rate 100 -P dds</exe>
|
|
||||||
<requirements>
|
<requirements>
|
||||||
<name>SamplerWorker</name>
|
<name>SamplerWorker</name>
|
||||||
</requirements>
|
</requirements>
|
||||||
|
@ -19,8 +19,8 @@
|
||||||
</decltask>
|
</decltask>
|
||||||
|
|
||||||
<decltask name="Processor">
|
<decltask name="Processor">
|
||||||
|
<exe>fairmq-ex-dds-processor --color false --channel-config name=data1,type=pull,method=connect name=data2,type=push,method=connect -P dds</exe>
|
||||||
<env reachable="false">fairmq-ex-dds-env.sh</env>
|
<env reachable="false">fairmq-ex-dds-env.sh</env>
|
||||||
<exe>fairmq-ex-dds-processor --id processor_%taskIndex% --color false --channel-config name=data1,type=pull,method=connect name=data2,type=push,method=connect -P dds</exe>
|
|
||||||
<requirements>
|
<requirements>
|
||||||
<id>ProcessorWorker</id>
|
<id>ProcessorWorker</id>
|
||||||
</requirements>
|
</requirements>
|
||||||
|
@ -31,8 +31,8 @@
|
||||||
</decltask>
|
</decltask>
|
||||||
|
|
||||||
<decltask name="Sink">
|
<decltask name="Sink">
|
||||||
|
<exe>fairmq-ex-dds-sink --color false --channel-config name=data2,type=pull,method=bind -P dds</exe>
|
||||||
<env reachable="false">fairmq-ex-dds-env.sh</env>
|
<env reachable="false">fairmq-ex-dds-env.sh</env>
|
||||||
<exe>fairmq-ex-dds-sink --id sink --color false --channel-config name=data2,type=pull,method=bind -P dds</exe>
|
|
||||||
<requirements>
|
<requirements>
|
||||||
<name>SinkWorker</name>
|
<name>SinkWorker</name>
|
||||||
</requirements>
|
</requirements>
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
<declrequirement name="SinkWorker" type="wnname" value="sink"/>
|
<declrequirement name="SinkWorker" type="wnname" value="sink"/>
|
||||||
|
|
||||||
<decltask name="Sampler">
|
<decltask name="Sampler">
|
||||||
|
<exe>fairmq-ex-dds-sampler --color false --channel-config name=data1,type=push,method=bind -P dds --iterations 10</exe>
|
||||||
<env reachable="false">fairmq-ex-dds-env.sh</env>
|
<env reachable="false">fairmq-ex-dds-env.sh</env>
|
||||||
<exe>fairmq-ex-dds-sampler --id sampler --color false --channel-config name=data1,type=push,method=bind -P dds --iterations 10</exe>
|
|
||||||
<requirements>
|
<requirements>
|
||||||
<name>SamplerWorker</name>
|
<name>SamplerWorker</name>
|
||||||
</requirements>
|
</requirements>
|
||||||
|
@ -19,8 +19,8 @@
|
||||||
</decltask>
|
</decltask>
|
||||||
|
|
||||||
<decltask name="Processor">
|
<decltask name="Processor">
|
||||||
|
<exe>fairmq-ex-dds-processor --color false --channel-config name=data1,type=pull,method=connect name=data2,type=push,method=connect -P dds</exe>
|
||||||
<env reachable="false">fairmq-ex-dds-env.sh</env>
|
<env reachable="false">fairmq-ex-dds-env.sh</env>
|
||||||
<exe>fairmq-ex-dds-processor --id processor_%taskIndex% --color false --channel-config name=data1,type=pull,method=connect name=data2,type=push,method=connect -P dds</exe>
|
|
||||||
<requirements>
|
<requirements>
|
||||||
<id>ProcessorWorker</id>
|
<id>ProcessorWorker</id>
|
||||||
</requirements>
|
</requirements>
|
||||||
|
@ -31,8 +31,8 @@
|
||||||
</decltask>
|
</decltask>
|
||||||
|
|
||||||
<decltask name="Sink">
|
<decltask name="Sink">
|
||||||
|
<exe>fairmq-ex-dds-sink --color false --channel-config name=data2,type=pull,method=bind -P dds --iterations 10</exe>
|
||||||
<env reachable="false">fairmq-ex-dds-env.sh</env>
|
<env reachable="false">fairmq-ex-dds-env.sh</env>
|
||||||
<exe>fairmq-ex-dds-sink --id sink --color false --channel-config name=data2,type=pull,method=bind -P dds --iterations 10</exe>
|
|
||||||
<requirements>
|
<requirements>
|
||||||
<name>SinkWorker</name>
|
<name>SinkWorker</name>
|
||||||
</requirements>
|
</requirements>
|
||||||
|
|
|
@ -63,8 +63,6 @@ bool DeviceRunner::HandleGeneralOptions(const fair::mq::ProgOptions& config, boo
|
||||||
<< " / __/ / /_/ / / / _ / / / / /_/ / " << FAIRMQ_REPO_URL << endl
|
<< " / __/ / /_/ / / / _ / / / / /_/ / " << FAIRMQ_REPO_URL << endl
|
||||||
<< " /_/ \\__,_/_/_/ /_/ /_/ \\___\\_\\ " << FAIRMQ_LICENSE << " © " << FAIRMQ_COPYRIGHT << endl;
|
<< " /_/ \\__,_/_/_/ /_/ /_/ \\___\\_\\ " << FAIRMQ_LICENSE << " © " << FAIRMQ_COPYRIGHT << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
config.PrintOptions();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -169,6 +167,9 @@ auto DeviceRunner::Run() -> int
|
||||||
// Instantiate and run plugins
|
// Instantiate and run plugins
|
||||||
fPluginManager.InstantiatePlugins();
|
fPluginManager.InstantiatePlugins();
|
||||||
|
|
||||||
|
// Log IDLE configuration
|
||||||
|
fConfig.PrintOptions();
|
||||||
|
|
||||||
// Run the device
|
// Run the device
|
||||||
fDevice->RunStateMachine();
|
fDevice->RunStateMachine();
|
||||||
|
|
||||||
|
|
|
@ -55,18 +55,18 @@ DDS::DDS(const string& name,
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
TakeDeviceControl();
|
TakeDeviceControl();
|
||||||
fControllerThread = thread(&DDS::HandleControl, this);
|
|
||||||
fHeartbeatThread = thread(&DDS::HeartbeatSender, this);
|
|
||||||
} catch (PluginServices::DeviceControlError& e) {
|
|
||||||
LOG(debug) << e.what();
|
|
||||||
} catch (exception& e) {
|
|
||||||
LOG(error) << "Error in plugin initialization: " << e.what();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
auto DDS::HandleControl() -> void
|
fHeartbeatThread = thread(&DDS::HeartbeatSender, this);
|
||||||
{
|
|
||||||
try {
|
std::string deviceId(GetProperty<std::string>("id"));
|
||||||
|
if (deviceId.empty()) {
|
||||||
|
SetProperty<std::string>("id", dds::env_prop<dds::task_path>());
|
||||||
|
}
|
||||||
|
std::string sessionId(GetProperty<std::string>("session"));
|
||||||
|
if (sessionId == "default") {
|
||||||
|
SetProperty<std::string>("session", dds::env_prop<dds::dds_session_id>());
|
||||||
|
}
|
||||||
|
|
||||||
auto control = GetProperty<string>("control");
|
auto control = GetProperty<string>("control");
|
||||||
bool staticMode(false);
|
bool staticMode(false);
|
||||||
if (control == "static") {
|
if (control == "static") {
|
||||||
|
@ -121,6 +121,18 @@ auto DDS::HandleControl() -> void
|
||||||
});
|
});
|
||||||
|
|
||||||
if (staticMode) {
|
if (staticMode) {
|
||||||
|
fControllerThread = thread(&DDS::StaticControl, this);
|
||||||
|
}
|
||||||
|
} catch (PluginServices::DeviceControlError& e) {
|
||||||
|
LOG(debug) << e.what();
|
||||||
|
} catch (exception& e) {
|
||||||
|
LOG(error) << "Error in plugin initialization: " << e.what();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto DDS::StaticControl() -> void
|
||||||
|
{
|
||||||
|
try {
|
||||||
TransitionDeviceStateTo(DeviceState::Running);
|
TransitionDeviceStateTo(DeviceState::Running);
|
||||||
|
|
||||||
// wait until stop signal
|
// wait until stop signal
|
||||||
|
@ -128,8 +140,7 @@ auto DDS::HandleControl() -> void
|
||||||
while (!fDeviceTerminationRequested) {
|
while (!fDeviceTerminationRequested) {
|
||||||
fStopCondition.wait_for(lock, chrono::seconds(1));
|
fStopCondition.wait_for(lock, chrono::seconds(1));
|
||||||
}
|
}
|
||||||
LOG(debug) << "Stopping DDS control plugin";
|
LOG(debug) << "Stopping DDS plugin static controller";
|
||||||
}
|
|
||||||
} catch (DeviceErrorState&) {
|
} catch (DeviceErrorState&) {
|
||||||
ReleaseDeviceControl();
|
ReleaseDeviceControl();
|
||||||
} catch (exception& e) {
|
} catch (exception& e) {
|
||||||
|
|
|
@ -128,7 +128,7 @@ class DDS : public Plugin
|
||||||
~DDS();
|
~DDS();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
auto HandleControl() -> void;
|
auto StaticControl() -> void;
|
||||||
|
|
||||||
auto FillChannelContainers() -> void;
|
auto FillChannelContainers() -> void;
|
||||||
auto SubscribeForConnectingChannels() -> void;
|
auto SubscribeForConnectingChannels() -> void;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<declrequirement name="SinkWorker" type="wnname" value="sink"/>
|
<declrequirement name="SinkWorker" type="wnname" value="sink"/>
|
||||||
|
|
||||||
<decltask name="Sampler">
|
<decltask name="Sampler">
|
||||||
<exe reachable="true">fairmq-bsampler --id sampler --color false --channel-config name=data,type=push,method=bind -P dds --msg-rate 10</exe>
|
<exe reachable="true">fairmq-bsampler --color false --channel-config name=data,type=push,method=bind -P dds --msg-rate 10</exe>
|
||||||
<requirements>
|
<requirements>
|
||||||
<name>SamplerWorker</name>
|
<name>SamplerWorker</name>
|
||||||
</requirements>
|
</requirements>
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
</decltask>
|
</decltask>
|
||||||
|
|
||||||
<decltask name="Sink">
|
<decltask name="Sink">
|
||||||
<exe reachable="true">fairmq-sink --id sink_%taskIndex% --color false --channel-config name=data,type=pull,method=connect -P dds</exe>
|
<exe reachable="true">fairmq-sink --color false --channel-config name=data,type=pull,method=connect -P dds</exe>
|
||||||
<requirements>
|
<requirements>
|
||||||
<name>SinkWorker</name>
|
<name>SinkWorker</name>
|
||||||
</requirements>
|
</requirements>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user