Skip to content

Commit 287446c

Browse files
committed
Upload dataset and nlp timeout issue resolved
Signed-off-by: zesk1999 <zesk1999@gmail.com>
1 parent af7e373 commit 287446c

File tree

15 files changed

+4729
-8523
lines changed

15 files changed

+4729
-8523
lines changed

sustainml_cpp/include/sustainml_cpp/idl/SustainMLService.idl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,40 +6,34 @@ exception InternalError
66
interface AppRequirementsService
77
{
88
string update_configuration(in string configuration) raises (InternalError);
9-
string send_data(in string data) raises (InternalError);
109
};
1110

1211
// 2. HWConstraints
1312
interface HWConstraintsService
1413
{
1514
string update_configuration(in string configuration) raises (InternalError);
16-
string send_data(in string data) raises (InternalError);
1715
};
1816

1917
// 3. HWResources
2018
interface HWResourcesService
2119
{
2220
string update_configuration(in string configuration) raises (InternalError);
23-
string send_data(in string data) raises (InternalError);
2421
};
2522

2623
// 4. CarbonFootprint
2724
interface CarbonFootprintService
2825
{
2926
string update_configuration(in string configuration) raises (InternalError);
30-
string send_data(in string data) raises (InternalError);
3127
};
3228

3329
// 5. MLModelMetadata
3430
interface MLModelMetadataService
3531
{
3632
string update_configuration(in string configuration) raises (InternalError);
37-
string send_data(in string data) raises (InternalError);
3833
};
3934

4035
// 6. MLModel
4136
interface MLModelService
4237
{
4338
string update_configuration(in string configuration) raises (InternalError);
44-
string send_data(in string data) raises (InternalError);
4539
};

sustainml_cpp/src/cpp/core/GenericServiceNodeImpl.hpp

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
// limitations under the License.
1414

1515
/**
16-
* @file GenericServiceNode.cpp
16+
* @file GenericServiceNode.hpp
1717
*/
1818

1919
#ifndef SUSTAINML_CORE_GENERICSERVICENODEIMPL_HPP
2020
#define SUSTAINML_CORE_GENERICSERVICENODEIMPL_HPP
2121

22-
#include <string>
2322
#include <iostream>
23+
#include <string>
2424

2525
#include <core/NodeImpl.hpp>
2626
#include <types/types.hpp>
@@ -43,7 +43,10 @@ template <typename ServerBase>
4343
class GenericServiceNodeImpl : public ServerBase
4444
{
4545
public:
46-
GenericServiceNodeImpl(NodeImpl& node, const char* tag)
46+
47+
GenericServiceNodeImpl(
48+
NodeImpl& node,
49+
const char* tag)
4750
: node_(node)
4851
, tag_(tag)
4952
{
@@ -74,27 +77,11 @@ class GenericServiceNodeImpl : public ServerBase
7477
throw ::InternalError("update_configuration: unknown error");
7578
}
7679

77-
// If your listener reports failures via res.success():
78-
if (!res.success())
79-
{
80-
// If you have an error string field, put it here. If not:
81-
throw ::InternalError("update_configuration: res.success==false");
82-
}
83-
8480
return res.configuration();
8581
}
8682

87-
std::string send_data(
88-
const eprosima::fastdds::dds::rpc::RpcRequest& /*info*/,
89-
const std::string& data) override
90-
{
91-
(void)data;
92-
93-
// If not implemented yet, raise InternalError (matches IDL)
94-
throw ::InternalError("send_data not implemented");
95-
}
96-
9783
private:
84+
9885
NodeImpl& node_;
9986
const char* tag_;
10087
};

sustainml_cpp/src/cpp/core/NodeImpl.cpp

Lines changed: 60 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -187,99 +187,108 @@ bool NodeImpl::init(
187187
{
188188
if (name == common::APP_REQUIREMENTS_NODE)
189189
{
190-
std::shared_ptr<AppRequirementsServiceServer_IServerImplementation> impl = std::make_shared<sustainml::core::AppRequirementsServiceNodeImpl>(*this, "APP_REQUIREMENTS");
190+
std::shared_ptr<AppRequirementsServiceServer_IServerImplementation> impl =
191+
std::make_shared<sustainml::core::AppRequirementsServiceNodeImpl>(*this,
192+
"APP_REQUIREMENTS");
191193
rpc_impl_ = impl;
192194
rpc_service_name_ = "AppRequirementsService";
193195

194196
rpc_server_ = create_AppRequirementsServiceServer(
195-
*participant_,
196-
rpc_service_name_.c_str(),
197-
rqos,
198-
1u,
199-
impl);
197+
*participant_,
198+
rpc_service_name_.c_str(),
199+
rqos,
200+
1u,
201+
impl);
200202

201203
std::cout << "[DEBUG NodeImpl] create_AppRequirementsServiceServer returned "
202-
<< (rpc_server_ ? "non-null" : "null") << std::endl;
204+
<< (rpc_server_ ? "non-null" : "null") << std::endl;
203205
}
204206
else if (name == common::HW_CONSTRAINTS_NODE)
205207
{
206-
std::shared_ptr<HWConstraintsServiceServer_IServerImplementation> impl = std::make_shared<sustainml::core::HWConstraintsServiceNodeImpl>(*this, "HW_CONSTRAINTS");
208+
std::shared_ptr<HWConstraintsServiceServer_IServerImplementation> impl =
209+
std::make_shared<sustainml::core::HWConstraintsServiceNodeImpl>(*this, "HW_CONSTRAINTS");
207210
rpc_impl_ = impl;
208211
rpc_service_name_ = "HWConstraintsService";
209212

210213
rpc_server_ = create_HWConstraintsServiceServer(
211-
*participant_,
212-
rpc_service_name_.c_str(),
213-
rqos,
214-
1u,
215-
impl);
214+
*participant_,
215+
rpc_service_name_.c_str(),
216+
rqos,
217+
1u,
218+
impl);
216219

217220
std::cout << "[DEBUG NodeImpl] create_HWConstraintsServiceServer returned "
218-
<< (rpc_server_ ? "non-null" : "null") << std::endl;
221+
<< (rpc_server_ ? "non-null" : "null") << std::endl;
219222
}
220223
else if (name == common::HW_RESOURCES_NODE)
221224
{
222-
std::shared_ptr<HWResourcesServiceServer_IServerImplementation> impl = std::make_shared<sustainml::core::HWResourcesServiceNodeImpl>(*this, "HW_RESOURCES");
225+
std::shared_ptr<HWResourcesServiceServer_IServerImplementation> impl =
226+
std::make_shared<sustainml::core::HWResourcesServiceNodeImpl>(*this, "HW_RESOURCES");
223227
rpc_impl_ = impl;
224228
rpc_service_name_ = "HWResourcesService";
225229

226230
rpc_server_ = create_HWResourcesServiceServer(
227-
*participant_,
228-
rpc_service_name_.c_str(),
229-
rqos,
230-
1u,
231-
impl);
231+
*participant_,
232+
rpc_service_name_.c_str(),
233+
rqos,
234+
1u,
235+
impl);
232236

233237
std::cout << "[DEBUG NodeImpl] create_HWResourcesServiceServer returned "
234-
<< (rpc_server_ ? "non-null" : "null") << std::endl;
238+
<< (rpc_server_ ? "non-null" : "null") << std::endl;
235239
}
236240
else if (name == common::CARBON_FOOTPRINT_NODE)
237241
{
238-
std::shared_ptr<CarbonFootprintServiceServer_IServerImplementation> impl = std::make_shared<sustainml::core::CarbonFootprintServiceNodeImpl>(*this, "CARBON_FOOTPRINT");
242+
std::shared_ptr<CarbonFootprintServiceServer_IServerImplementation> impl =
243+
std::make_shared<sustainml::core::CarbonFootprintServiceNodeImpl>(*this,
244+
"CARBON_FOOTPRINT");
239245
rpc_impl_ = impl;
240246
rpc_service_name_ = "CarbonFootprintService";
241247

242248
rpc_server_ = create_CarbonFootprintServiceServer(
243-
*participant_,
244-
rpc_service_name_.c_str(),
245-
rqos,
246-
1u,
247-
impl);
249+
*participant_,
250+
rpc_service_name_.c_str(),
251+
rqos,
252+
1u,
253+
impl);
248254

249255
std::cout << "[DEBUG NodeImpl] create_CarbonFootprintServiceServer returned "
250-
<< (rpc_server_ ? "non-null" : "null") << std::endl;
256+
<< (rpc_server_ ? "non-null" : "null") << std::endl;
251257
}
252258
else if (name == common::ML_MODEL_METADATA_NODE)
253259
{
254-
std::shared_ptr<MLModelMetadataServiceServer_IServerImplementation> impl = std::make_shared<sustainml::core::MLModelMetadataServiceNodeImpl>(*this, "ML_MODEL_METADATA");
260+
std::shared_ptr<MLModelMetadataServiceServer_IServerImplementation> impl =
261+
std::make_shared<sustainml::core::MLModelMetadataServiceNodeImpl>(*this,
262+
"ML_MODEL_METADATA");
255263
rpc_impl_ = impl;
256264
rpc_service_name_ = "MLModelMetadataService";
257265

258266
rpc_server_ = create_MLModelMetadataServiceServer(
259-
*participant_,
260-
rpc_service_name_.c_str(),
261-
rqos,
262-
1u,
263-
impl);
267+
*participant_,
268+
rpc_service_name_.c_str(),
269+
rqos,
270+
1u,
271+
impl);
264272

265273
std::cout << "[DEBUG NodeImpl] create_MLModelMetadataServiceServer returned "
266-
<< (rpc_server_ ? "non-null" : "null") << std::endl;
274+
<< (rpc_server_ ? "non-null" : "null") << std::endl;
267275
}
268276
else if (name == common::ML_MODEL_NODE)
269277
{
270-
std::shared_ptr<MLModelServiceServer_IServerImplementation> impl = std::make_shared<sustainml::core::MLModelServiceNodeImpl>(*this, "ML_MODEL");
278+
std::shared_ptr<MLModelServiceServer_IServerImplementation> impl =
279+
std::make_shared<sustainml::core::MLModelServiceNodeImpl>(*this, "ML_MODEL");
271280
rpc_impl_ = impl;
272281
rpc_service_name_ = "MLModelService";
273282

274283
rpc_server_ = create_MLModelServiceServer(
275-
*participant_,
276-
rpc_service_name_.c_str(),
277-
rqos,
278-
1u,
279-
impl);
284+
*participant_,
285+
rpc_service_name_.c_str(),
286+
rqos,
287+
1u,
288+
impl);
280289

281290
std::cout << "[DEBUG NodeImpl] create_MLModelServiceServer returned "
282-
<< (rpc_server_ ? "non-null" : "null") << std::endl;
291+
<< (rpc_server_ ? "non-null" : "null") << std::endl;
283292
}
284293
else
285294
{
@@ -291,33 +300,34 @@ bool NodeImpl::init(
291300
{
292301
EPROSIMA_LOG_ERROR(NODE,
293302
"RpcException while creating RPC server for node '" << name
294-
<< "': " << e.what());
303+
<< "': " << e.what());
295304
}
296305
catch (const std::exception& e)
297306
{
298307
EPROSIMA_LOG_ERROR(NODE,
299308
"std::exception while creating RPC server for node '" << name
300-
<< "': " << e.what());
309+
<< "': " << e.what());
301310
}
302311

303312
if (!rpc_server_)
304313
{
305314
EPROSIMA_LOG_WARNING(NODE,
306315
"No RPC server created for node '" << name
307-
<< "' (service_name='" << rpc_service_name_ << "'). Node will run without RPC.");
316+
<< "' (service_name='" << rpc_service_name_ <<
317+
"'). Node will run without RPC.");
308318
}
309319

310320
if (rpc_server_)
311321
{
312322
rpc_server_thread_ = std::thread([this]()
313-
{
314-
rpc_server_->run();
315-
});
323+
{
324+
rpc_server_->run();
325+
});
316326
}
317327

318328
std::cout << "[DEBUG NodeImpl] RPC server created on node '"
319-
<< name
320-
<< "' with service '" << rpc_service_name_ << "'" << std::endl;
329+
<< name
330+
<< "' with service '" << rpc_service_name_ << "'" << std::endl;
321331

322332
//! Register Common Types
323333

0 commit comments

Comments
 (0)