diff --git a/nodemanager/Version.h b/nodemanager/Version.h index 8b95c80..5abc13d 100644 --- a/nodemanager/Version.h +++ b/nodemanager/Version.h @@ -562,6 +562,11 @@ namespace hpc "Added built-in proxy support", } }, + { "2.2.2.0", + { + "Added task completion uri configuration", + } + }, }; return versionHistory; diff --git a/nodemanager/config/nodemanager.json b/nodemanager/config/nodemanager.json index cb9802b..cd434e8 100644 --- a/nodemanager/config/nodemanager.json +++ b/nodemanager/config/nodemanager.json @@ -4,6 +4,7 @@ "UseDefaultCA":false, "ClusterAuthenticationKey":"", "HeartbeatUri":"https://{0}:40001/api/evanclv9/computenodereported", + "TaskCompletionUri":"http://evanc7:1328/api/evanclv9/taskcompleted", "MetricInstanceIdsUri":"https://{0}:40001/api/evanclv9/getinstanceids", "MetricUri":"udp://EVANCV7.fareast.corp.microsoft.com:9894/api/4aed4836-c0c8-4e92-853d-cac4698582d1/metricreported", "RegisterUri":"https://{0}:40001/api/evanclv9/registerrequested", diff --git a/nodemanager/core/NodeManagerConfig.h b/nodemanager/core/NodeManagerConfig.h index b354e80..755e1a5 100644 --- a/nodemanager/core/NodeManagerConfig.h +++ b/nodemanager/core/NodeManagerConfig.h @@ -42,6 +42,7 @@ namespace hpc AddConfigurationItem(std::vector, NamingServiceUri); AddConfigurationItem(std::string, MetricUri); AddConfigurationItem(std::string, HeartbeatUri); + AddConfigurationItem(std::string, TaskCompletionUri); static std::string ResolveRegisterUri() { @@ -75,7 +76,13 @@ namespace hpc static std::string ResolveTaskCompletedUri(const std::string& uri) { - return ResolveUri(uri, [](std::shared_ptr namingClient) { return namingClient->GetServiceLocation(NodeManagerConfig::GetDefaultServiceName()); }); + std::string configUri = NodeManagerConfig::GetTaskCompletionUri(); + if (configUri.empty()) + { + configUri = uri; + } + + return ResolveUri(configUri, [](std::shared_ptr namingClient) { return namingClient->GetServiceLocation(NodeManagerConfig::GetDefaultServiceName()); }); } protected: @@ -90,7 +97,16 @@ namespace hpc size_t pos = u.find("{0}"); if (pos != std::string::npos) { - return u.replace(pos, 3, resolver(NamingClient::GetInstance(NodeManagerConfig::GetNamingServiceUri()))); + auto namingServiceUri = NodeManagerConfig::GetNamingServiceUri(); + if (namingServiceUri.size() > 0) + { + // only when naming service configured. + return u.replace(pos, 3, resolver(NamingClient::GetInstance(NodeManagerConfig::GetNamingServiceUri()))); + } + else + { + return ""; + } } return std::move(u); diff --git a/nodemanager/main.cpp b/nodemanager/main.cpp index ceae84e..fa47a07 100644 --- a/nodemanager/main.cpp +++ b/nodemanager/main.cpp @@ -111,6 +111,8 @@ int main(int argc, char* argv[]) RemoteCommunicator rc(executor, config, NodeManagerConfig::GetListeningUri()); rc.Open(); + Logger::Info("Main: entering sleep loop."); + while (true) { sleep(100);