Commit 0edb97cf by Tomasz Ciesielczyk

project update

parent a83e1966
<component name="libraryTable">
<library name="lightstorage">
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/lightstorage.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="ojalgo-45.1.0">
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/ojalgo-45.1.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
\ No newline at end of file
......@@ -6,7 +6,6 @@
<module fileurl="file://$PROJECT_DIR$/.idea/modules/m2dc-powercapping/m2dc-powercapping_main.iml" filepath="$PROJECT_DIR$/.idea/modules/m2dc-powercapping/m2dc-powercapping_main.iml" group="m2dc-powercapping" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/m2dc-powercapping/m2dc-powercapping_test.iml" filepath="$PROJECT_DIR$/.idea/modules/m2dc-powercapping/m2dc-powercapping_test.iml" group="m2dc-powercapping" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/m2dc-rtm.iml" filepath="$PROJECT_DIR$/.idea/modules/m2dc-rtm.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/m2dc-rtm-fanmanager.iml" filepath="$PROJECT_DIR$/.idea/modules/m2dc-rtm-fanmanager.iml" group="m2dc-rtm-fanmanager" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/m2dc-rtm-fanmanager/m2dc-rtm-fanmanager_main.iml" filepath="$PROJECT_DIR$/.idea/modules/m2dc-rtm-fanmanager/m2dc-rtm-fanmanager_main.iml" group="m2dc-rtm-fanmanager" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/m2dc-rtm-fanmanager/m2dc-rtm-fanmanager_test.iml" filepath="$PROJECT_DIR$/.idea/modules/m2dc-rtm-fanmanager/m2dc-rtm-fanmanager_test.iml" group="m2dc-rtm-fanmanager" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/m2dc-rtm-rest.iml" filepath="$PROJECT_DIR$/.idea/modules/m2dc-rtm-rest.iml" group="m2dc-rtm-rest" />
......
......@@ -52,6 +52,15 @@
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../../../lib/lightstorage_2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="library" name="Gradle: org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.2.30" level="project" />
<orderEntry type="module" module-name="m2dc-rtm-utils_main" />
<orderEntry type="library" name="Gradle: org.ojalgo:ojalgo:45.1.0" level="project" />
......
......@@ -52,6 +52,15 @@
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../../../lib/lightstorage_2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="library" name="Gradle: org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.2.30" level="project" />
<orderEntry type="module" module-name="m2dc-rtm-utils_main" />
<orderEntry type="library" name="Gradle: org.jetbrains.kotlin:kotlin-stdlib:1.2.30" level="project" />
......
group 'm2dc-rtm'
version '1.0-SNAPSHOT'
buildscript {
ext.kotlin_version = '1.2.30'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
apply plugin: 'kotlin'
repositories {
mavenCentral()
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
compile project(':m2dc-rtm-utils')
}
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
\ No newline at end of file
package psnc.m2dc.rtm.fm
import psnc.m2dc.rtm.dao.LightStorage
import psnc.m2dc.rtm.model.rest.TemperatureLimit
object StorageKeys {
private const val fm = "fm_"
var TEMPERATURE_LIMIT = LightStorage.getNullableMapWrapper<TemperatureLimit>("${fm}TEMPERATURE_LIMIT")
}
\ No newline at end of file
# Root logger option
log4j.rootLogger=info, file, stdout
# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} [%t] %-5p:: %m%n
# Direct log messages to a log file
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=D:\\Temp\\rtm_rest_api.log
log4j.appender.file.MaxFileSize=10000KB
log4j.appender.file.MaxBackupIndex=10
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} [%t] %-5p:: %m%n
\ No newline at end of file
package psnc.m2dc.rtm.commands.java
val APP_VERSION = "1.0.440_55159"
\ No newline at end of file
val APP_VERSION = "1.0.440_55347"
\ No newline at end of file
......@@ -49,7 +49,7 @@ fun main(args: Array<String>) {
NodeMetadataCommand::class,
ConfigCommand::class,
StatusCommand::class,
SensorCommand::class,
APICommand::class,
PowerCappingCommand::class,
EnergySaverCommand::class,
RTMClient.Help::class,
......
......@@ -30,7 +30,7 @@ object RTMClient {
CommandLine.usage(NodeMetadataCommand(), System.out)
CommandLine.usage(ConfigCommand(), System.out)
CommandLine.usage(StatusCommand(), System.out)
CommandLine.usage(SensorCommand(), System.out)
CommandLine.usage(APICommand(), System.out)
CommandLine.usage(PowerCappingCommand(), System.out)
CommandLine.usage(EnergySaverCommand(), System.out)
}
......
package psnc.m2dc.rtm.client
const val APP_VERSION = "1.1.426_53009"
\ No newline at end of file
const val APP_VERSION = "1.1.440_55348"
\ No newline at end of file
......@@ -13,8 +13,8 @@ import psnc.m2dc.rtm.utils.toJson
* todo: delete or update this class
* Created by Tomek on 2018-11-29.
*/
@CommandLine.Command(name = "sensor", description = ["manage sensor measurements"])
class SensorCommand : Runnable {
@CommandLine.Command(name = "api", description = ["manage apis"])
class APICommand : Runnable {
@CommandLine.ParentCommand
private lateinit var parent: RTMCLI
......@@ -48,9 +48,9 @@ class SensorCommand : Runnable {
if (RTMRestClient.instance.debug)
logDebug("get sensor data $sensorId ")
val s = nodeId.joinToString(",", "", "", -1, "") { it }
return RTMRestClient.instance.connect(HandlersMap.nodes_sensor_value.replace(":${Handlers.RESTParams
return RTMRestClient.instance.connect(HandlersMap.nodes_api_value.replace(":${Handlers.RESTParams
.node_id_list}", s).replace
(":${Handlers.RESTParams.sensor_id}", sensorId),
(":${Handlers.RESTParams.api_id}", sensorId),
Connection.Method.GET )
.get<Any>(Handlers.RESTKeys.result.name, RTMRestClient.instance.debug)
......@@ -58,19 +58,19 @@ class SensorCommand : Runnable {
fun getNodeSensorList(resId: List<String>): Any? {
val s = resId.joinToString(",", "", "", -1, "") { it }
return RTMRestClient.instance.connect(HandlersMap.node_sensor_list.replace(":${Handlers.RESTParams
return RTMRestClient.instance.connect(HandlersMap.node_api_list.replace(":${Handlers.RESTParams
.node_id_list}", s), Connection
.Method.GET, "")
.get<Any>(Handlers.RESTKeys.sensors.name, RTMRestClient.instance.debug)
.get<Any>(Handlers.RESTKeys.api.name, RTMRestClient.instance.debug)
}
fun getNodeSensorTypeValues(resId: List<String>, sensorType: String): Any? {
val s = resId.joinToString(",", "", "", -1, "") { it }
return RTMRestClient.instance.connect(HandlersMap.nodes_sensor_type_value.replace(":${Handlers.RESTParams
return RTMRestClient.instance.connect(HandlersMap.nodes_api_type_value.replace(":${Handlers.RESTParams
.node_id_list}", s).replace(":${Handlers.RESTParams
.sensor_type}", sensorType), Connection
.api_type}", sensorType), Connection
.Method.GET, "")
.get<Any>(Handlers.RESTKeys.result.name, RTMRestClient.instance.debug)
......
package psnc.m2dc.rtm.client.commands
import org.jsoup.Connection
import picocli.CommandLine
import psnc.m2dc.rtm.client.RTMCLI
import psnc.m2dc.rtm.client.RTMRestClient
import psnc.m2dc.rtm.rest.Handlers
import psnc.m2dc.rtm.rest.HandlersMap
import psnc.m2dc.rtm.utils.printConsole
import psnc.m2dc.rtm.utils.toJson
@CommandLine.Command(name = "fm", description = ["FM API"])
class FanManagerCommand : Runnable {
enum class CommandName {
start, stop, termaldata
}
@CommandLine.ParentCommand
private lateinit var parent: RTMCLI
@CommandLine.Parameters(index = "0", description = ["command type, available options: \${COMPLETION-CANDIDATES}"])
private lateinit var command: CommandName
override fun run() {
parent.run()
when (command) {
CommandName.start -> startFM()?.toJson(true)
CommandName.stop -> stop()?.toJson(true)
CommandName.termaldata -> termalData()?.toJson(true)
}
}
private fun startFM(): Any? {
if (RTMRestClient.instance.debug)
println(" FM Start ")
return printConsole("TODO: start FM")
}
private fun stop(): Any? {
if (RTMRestClient.instance.debug)
println(" FM Stop ")
return printConsole("TODO: stop FM")
}
private fun termalData(): Any? {
if (RTMRestClient.instance.debug)
println(" FM get termal data")
return RTMRestClient.instance.connect(HandlersMap.fm_termal_data, Connection.Method.POST,
"").get(Handlers.RESTKeys.result.name, RTMRestClient.instance.debug)
}
}
\ No newline at end of file
......@@ -42,11 +42,11 @@ class PowerSettingCommand : Runnable {
private fun getAvailablePerformance(resId: List<String>?): HashMap<Double, ArrayList<String>>? {
debugConsole("getPerformance: ")
var path = HandlersMap.pcm_resource_performance_list.replace(":${Handlers.RESTParams
var path = HandlersMap.rtm_resource_performance_list.replace(":${Handlers.RESTParams
.node_id_list}", "nodes")
if (resId != null) {
val s = resId.joinToString(",", "", "", -1, "") { it }
path = HandlersMap.pcm_resource_performance_list.replace(":${Handlers.RESTParams.node_id_list}", s)
path = HandlersMap.rtm_resource_performance_list.replace(":${Handlers.RESTParams.node_id_list}", s)
}
val result = RTMRestClient.instance.connect(path, Connection.Method.GET)
return result.get(Handlers.RESTKeys.performance.toString(), RTMRestClient.instance.debug)
......@@ -54,11 +54,11 @@ class PowerSettingCommand : Runnable {
private fun getPerformance(resId: List<String>?): HashMap<String, ActionCache.Setting>? {
debugConsole("getPerformance: ")
var path = HandlersMap.pcm_current_resource_performance.replace(":${Handlers.RESTParams
var path = HandlersMap.rtm_current_resource_performance.replace(":${Handlers.RESTParams
.node_id_list}", "nodes")
if (resId != null) {
val s = resId.joinToString(",", "", "", -1, "") { it }
path = HandlersMap.pcm_current_resource_performance.replace(":${Handlers.RESTParams.node_id_list}", s)
path = HandlersMap.rtm_current_resource_performance.replace(":${Handlers.RESTParams.node_id_list}", s)
}
val result = RTMRestClient.instance.connect(path, Connection.Method.GET)
// result.print<String>("performance_map")
......@@ -69,7 +69,7 @@ class PowerSettingCommand : Runnable {
private fun setPerformance(resId: List<String>, performance: Double, profile: String?): String? {
debugConsole("setPerformance: ")
val s = resId.joinToString(",", "", "", -1, "") { it }
val path = HandlersMap.pcm_current_resource_performance.replace(":${Handlers.RESTParams.node_id_list}", s)
val path = HandlersMap.rtm_current_resource_performance.replace(":${Handlers.RESTParams.node_id_list}", s)
return RTMRestClient.instance.connect(path, Connection.Method.POST,
JsonBuilder().addObj(Handlers.RESTKeys.performance, performance).addObj(Handlers.RESTKeys.profile, profile).toJson()).get(
Handlers.RESTKeys.result.toString(), RTMRestClient.instance.debug)
......
......@@ -53,13 +53,13 @@ class PriorityCommand : Runnable {
}
list
})
return RTMRestClient.instance.connect(HandlersMap.pcm_priority, Connection.Method.POST, jb.toJson())
return RTMRestClient.instance.connect(HandlersMap.rtm_priority, Connection.Method.POST, jb.toJson())
.get(Handlers.RESTKeys.result.name, RTMRestClient.instance.debug)
}
private fun getPriority(): List<NodePriority>? {
debugConsole("get nodePriorities")
return RTMRestClient.instance.connect(HandlersMap.pcm_priority,
return RTMRestClient.instance.connect(HandlersMap.rtm_priority,
Connection.Method.GET).get(Handlers.RESTKeys.nodePriorities.name,
RTMRestClient.instance.debug)
}
......
......@@ -26,10 +26,10 @@ class ResourceDAO(val storage: TreeStorage) {
else -> null
}
fun getApiDetails(sensorType: String, resourceId: String): List<ResourceApi> {
fun getApiDetails(apiType: String, resourceId: String): List<ResourceApi> {
val type = this.getType(resourceId) ?: throw NullPointerException("Type name not found for $resourceId")
return DAO.Settings.sensorMap?.getApi(sensorType, type) ?: {
logWarn("api details not found for $resourceId:$sensorType")
return DAO.Settings.apiMap?.getApi(apiType, type) ?: {
logWarn("api details not found for $resourceId:$apiType")
ArrayList<ResourceApi>()
}()
}
......@@ -39,8 +39,8 @@ class ResourceDAO(val storage: TreeStorage) {
fun getResourceManagementMethodApi(managementMethodType: ManagementMethodType, resourceId: String): ManagementApi {
val type = this.getType(resourceId) ?: throw NullPointerException("Type name not found for $resourceId")
DAO.Settings.sensorMap!!.getApiTypes(managementMethodType).keys.forEach { sensorType ->
DAO.Settings.sensorMap?.getApi(sensorType, type)?.firstOrNull()?.details?.api?.let { return it }
DAO.Settings.apiMap!!.getApiTypes(managementMethodType).keys.forEach { sensorType ->
DAO.Settings.apiMap?.getApi(sensorType, type)?.firstOrNull()?.details?.api?.let { return it }
}
throw NoSuchResourceException("getResourceManagementMethodApi :$resourceId")
......
......@@ -3,10 +3,10 @@ package psnc.m2dc.rtm.dao
import com.google.gson.reflect.TypeToken
import psnc.m2dc.rtm.model.rest.ResourceAction
import psnc.m2dc.rtm.model.rpm.ApiMap
import psnc.m2dc.rtm.model.rpm.ComponentPowerModel
import psnc.m2dc.rtm.model.rpm.PowerMeasurement
import psnc.m2dc.rtm.model.rpm.PowerModelDetails
import psnc.m2dc.rtm.model.rpm.SensorMap
import psnc.m2dc.rtm.properties.RTMProperties
import psnc.m2dc.rtm.properties.keys.Keys
import psnc.m2dc.rtm.utils.fromJson
......@@ -23,10 +23,10 @@ object SettingsDAO : DataDAO() {
val model_map by lazy {
LightStorage.getMapWrapper(ComponentPowerModel.default("default"), "model_map")
}
val sensorMap by lazy {
RTMProperties.getJson<SensorMap>(RTMProperties.parsePath(Keys.Default.sensor_map_file.get()))
// ?.let { newMap -> newMap.typeMap.forEach { typeName, sensorNameList ->
// val method = newMap.typeMethodMap[typeName]
val apiMap by lazy {
RTMProperties.getJson<ApiMap>(RTMProperties.parsePath(Keys.Default.api_map_file.get()))
// ?.let { newMap -> newMap.apiNameMap.forEach { typeName, sensorNameList ->
// val method = newMap.typeMap[typeName]
// sensorNameList.forEach { sensorName ->
// sensorMap.add(sensorName, typeName, method)
// }
......
......@@ -38,30 +38,13 @@ object ApiType {
val temperature = "temperature"
val set_property = "set_property"
val suspend = "suspend"
val recs_turn_off = "recs_turn_off"
val power_usage = "power_usage"
// val recs_turn_off = "recs_turn_off"
// val power_usage = "power_usage"
val sub_component = "sub_component"
}
//enum class SensorType(val typeName: String) {
// DEFAULT_TYPE("current_util"), node_power("CURRENT_POWER_USAGE"),
// current_power_usage("CURRENT_POWER_USAGE"), current_util(
// "CURRENT_UTIL"),
// current_temperature("TEMPERATURE");
//
// override fun toString(): String {
// return this.typeName
// }
//}
enum class ManagementApi {
recs, ssh, ipmi, file, none
}
//
//enum class SensorType(val key: String) {
// DEFAULT_TYPE("Blind"),
// CURRENT_POWER_USAGE("CURRENT_POWER_USAGE"),
// CURRENT_UTIL("CURRENT_UTIL"),
// TEMPERATURE("TEMPERATURE")
//}
\ No newline at end of file
......@@ -24,76 +24,45 @@ parentId: String? = null)
//}
data class SensorMap(val typeMap: HashMap<String, ArrayList<String>> = HashMap(),
val typeMethodMap: HashMap<String, ManagementMethodType> = HashMap()) {
fun getApiTypes(managementMethodType: ManagementMethodType) = //TODO: prepare inversed typeMethodMap?
this.typeMethodMap.filter {
data class ApiMap(val apiNameMap: HashMap<String, ArrayList<String>> = HashMap(),
val typeMap: HashMap<String, ManagementMethodType> = HashMap()) {
fun getApiTypes(managementMethodType: ManagementMethodType) = //TODO: prepare inversed typeMap?
this.typeMap.filter {
it.value == managementMethodType
}
fun getApi(sensorTypeName: String, resourceTypeId: String): List<ResourceApi> {
fun getApi(apiTypeName: String, resourceTypeId: String): List<ResourceApi> {
val result = ArrayList<ResourceApi>()
val resourceType: ResourceType? = DAO.ResourcesManagerApi.getResourceType(resourceTypeId)
val apiDetails = resourceType?.apiMap?.get(sensorTypeName) ?: return result
// val category = sensorTypeMap[sensorTypeName]!!
val method = typeMethodMap[sensorTypeName]!! // ?: ManagementMethodType.test
val apiDetails = resourceType?.apiMap?.get(apiTypeName) ?: return result
val method = typeMap[apiTypeName]!! // ?: ManagementMethodType.test
apiDetails.forEach { ad ->
result.add(ResourceApi(ad, method))
}
return result
}
fun add(sensorName: String, sensorType: String, method: ManagementMethodType?) {
fun add(apiTypeName: String, apiType: String, method: ManagementMethodType?) {
val m = (this.typeMap[sensorType] ?: {
val l = ArrayList<String>();this.typeMap[sensorType] = l
val m = (this.apiNameMap[apiType] ?: {
val l = ArrayList<String>();this.apiNameMap[apiType] = l
l
}.invoke())
if (!m.contains(sensorName)) {
m.add(sensorName)
if (!m.contains(apiTypeName)) {
m.add(apiTypeName)
}
method?.let { this.typeMethodMap.putIfAbsent(sensorType, it) }
method?.let { this.typeMap.putIfAbsent(apiType, it) }
// method.let { this.categoryMethodMap.put(category, method) }
}
companion object {
fun default(): SensorMap {
val json = """{ "typeMap": { "current_util": ["cpu_util", "core_util", "gpu_util","current_util"], "current_power_usage": ["gpu_power_usage","node_power","current_power_usage"], "temperature":[ "outletTemperature","inletTemperature","highestTemperature"], "current_temperature":[ "outletTemperature" ], "test_all_get_value":["test_all_get_value"], "node_resource_details":["node_resource_details"], "ssh_set_property":["ssh_set_property"], "ssh_suspend":["ssh_node_suspend"], "recs_turn_off":["recs_turn_off"] }, "typeMethodMap": { "current_util": "get_value", "current_power_usage": "power", "temperature": "temperature", "current_temperature": "temperature", "test_all_get_value": "get_value", "node_resource_details": "node_resource_details", "ssh_set_property":"set_property", "ssh_suspend": "suspend", "recs_turn_off": "turn_off" }}"""
fun default(): ApiMap {
val json = """{ "apiNameMap": { "current_util": ["cpu_util", "core_util", "gpu_util","current_util"], "current_power_usage": ["gpu_power_usage","node_power","current_power_usage"], "temperature":[ "outletTemperature","inletTemperature","highestTemperature"], "current_temperature":[ "outletTemperature" ], "test_all_get_value":["test_all_get_value"], "node_resource_details":["node_resource_details"], "ssh_set_property":["ssh_set_property"], "ssh_suspend":["ssh_node_suspend"], "recs_turn_off":["recs_turn_off"] }, "typeMap": { "current_util": "get_value", "current_power_usage": "power", "temperature": "temperature", "current_temperature": "temperature", "test_all_get_value": "get_value", "node_resource_details": "node_resource_details", "ssh_set_property":"set_property", "ssh_suspend": "suspend", "recs_turn_off": "turn_off" }}"""
return RTMProperties.parseJson(json)
}
}
}
/*
fun getApi(sensorTypeName: String, resource: Resource): List<ResourceApi> {
// if (resource.id == "compute15_core_0") {
// println("")
// }
val result = ArrayList<ResourceApi>()
// _print("${resource.id}/${DAO.ResourcesManagerApi.getResourceType(resource.typeId)}")
val details = DAO.ResourcesManagerApi.getResourceType(resource).apiMap[sensorTypeName] ?: return result
// val category = sensorTypeMap[sensorTypeName]!!
val method = typeMethodMap[sensorTypeName]!! // ?: ManagementMethodType.test
details.forEach { ad ->
result.add(ResourceApi(ad, method))
}
return result
}
//data class ResourceApi(val id: String, val name: String, val type: String = ResourceApi.SensorType.DEFAULT_TYPE.toString(), val
//parentId: String?, val method: ManagementMethodType? = null) {
// enum class SensorType(val typeName: String) {
// DEFAULT_TYPE("BLIND"), CURRENT_POWER_USAGE("CURRENT_POWER_USAGE"), CURRENT_UTIL(
// "CURRENT_UTIL"),
// TEMPERATURE("TEMPERATURE");
//
// }
//}
*/
......@@ -43,7 +43,6 @@ class RTMProperties {
conf = INIConfiguration()
basePath = ""
// storage = initStorage(this.getPath(Keys.FileStorage.storage_location, "rtm.json").toString())
}
......@@ -71,7 +70,7 @@ class RTMProperties {
setup()
if (Keys.Default.print_conf.get())
printConf()
ONLINE_DATA_TIMEOUT = Keys.RTM.online_data_timeout.get()
ONLINE_DATA_TIMEOUT = Keys.FileStorage.default_key_timeout.get()
} catch (e: Exception) {
log.error("Init properties: ${e.message}")
......
......@@ -33,7 +33,7 @@ $[null] -> empty value"""
val mock_list = RTMProperty(Default + "mock_list", Array<String>(0,{""}), description = "availalable mock items: SSH, IPMI, RECS")
//val test_resource_list = Default + "test_resource_list"
val debug = RTMProperty(Default + "debug", false, description = "turn debug mode on/off")
val sensor_map_file = RTMProperty(Default + "sensor_map_file", "\$[basePath]/sensor_map.json", description = "Sensor map file location")
val api_map_file = RTMProperty(Default + "api_map_file", "\$[basePath]/api_map.json", description = "API map file location")
//val test_mode = Default + "test_mode"
val min_active_load = RTMProperty(Default + "min_active_load", 5.0, description = "load border")
val min_active_component_load = RTMProperty(Default + "min_active_component_load", 10.0, description = "load border")
......
......@@ -3,7 +3,6 @@ package psnc.m2dc.rtm.properties.keys
import psnc.m2dc.rtm.model.rest.NodePriority
import psnc.m2dc.rtm.properties.RTMMapProperty
import psnc.m2dc.rtm.properties.RTMProperty
import psnc.m2dc.rtm.utils.FloatMapWrapper
import psnc.m2dc.rtm.utils.GenericTypeMapWrapper
class PCM {
......@@ -21,8 +20,8 @@ class PCM {
val power_buffer = RTMProperty(PCM + "power_buffer", 0.15, description = " power limit with relative safety buffer: final_power_limit = power_limit*(1.0-power_buffer)-absolute_power_buffer")
val absolute_power_buffer = RTMProperty(PCM + "absolute_power_buffer", 5.0, description = "Absolute power (in Watts) buffer limit with safety buffer: final_power_limit = power_limit*(1.0-power_buffer) - absolute_power_buffer")
val scan_timeout_ms = RTMProperty(PCM + "scan_timeout_ms", 60000L)
val scan_thread = RTMProperty(PCM + "scan_thread", true)
// val scan_timeout_ms = RTMProperty(PCM + "scan_timeout_ms", 60000L)
// val scan_thread = RTMProperty(PCM + "scan_thread", true)
// val simple_performance_restore = RTMProperty(
// PCM + "simple_performance_restore", true,
// Boolean::class.java)
......@@ -35,8 +34,8 @@ class PCM {
GenericTypeMapWrapper.get<NodePriority>(psnc.m2dc.rtm.utils.NodePriorityMapWrapper()),
"$[file]\$[basePath]/conf/priority.map.json")
val default_temperature_limit_map = RTMMapProperty(
PCM + "default_temperature_limit_map",
GenericTypeMapWrapper.get<Float>(FloatMapWrapper))
// val default_temperature_limit_map = RTMMapProperty(
// PCM + "default_temperature_limit_map",
// GenericTypeMapWrapper.get<Float>(FloatMapWrapper))
}
\ No newline at end of file
......@@ -46,7 +46,8 @@ class RTM {
val resource_type_map = RTMMapProperty(RTM + "resource_type_map", GenericTypeMapWrapper.get<ResourceType>(ResourceTypeMapWrapperInstance),"\$[file]\$[basePath]/models/type.map.json")
val scan_timeout_ms = RTMProperty(RTM + "scan_timeout_ms", 60000L)
val scan_thread = RTMProperty(RTM + "scan_thread", true)
val online_data_timeout = RTMProperty(RTM + "online_data_timeout", 15000L /* 1000L*/)
// moved to filestorage keys
// val online_data_timeout = RTMProperty(RTM + "online_data_timeout", 15000L /* 1000L*/)
val debug_actions = RTMProperty(RTM + "debug_actions", false)
val power_setting_evaluation_mode = RTMProperty(RTM + "power_setting_evaluation_mode", "BALANCED")
val management_threadpool_size = RTMProperty(RTM + "management_threadpool_size", 10)
......
......@@ -422,7 +422,7 @@ class RPMApiImpl() : RPMApi {
try {
DAO.Resource.getType(resourceId)?.let { resourceType ->
DAO.Settings.sensorMap!!.getApi(apiType, resourceType).firstOrNull()?.let { api ->
DAO.Settings.apiMap!!.getApi(apiType, resourceType).firstOrNull()?.let { api ->
if (!ActionCache.checkFailureStatus(api.details.api, resourceId)) {
//no failure
apiDetails = api.details.api
......@@ -601,9 +601,9 @@ printConsole("ipmi")
// init {
// storage = initStorage()
// // DataDAOUtils(storage)
// this.storage.put(SensorMap::class.java.simpleName,
// RTMProperties.getJson<SensorMap>(RTMProperties.parsePath(Keys.Default.sensor_map_file.get()))
// ?: SensorMap.default())
// this.storage.put(ApiMap::class.java.simpleName,
// RTMProperties.getJson<ApiMap>(RTMProperties.parsePath(Keys.Default.sensor_map_file.get()))
// ?: ApiMap.default())
//
//// IPMICredentials.loadFromProperties()
//// val ipmiApi = IPMIApiImpl.init(IPMICredentials.loadFromProperties())
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -114,7 +114,7 @@ internal class RPMApiTest {
@Test
fun getSensorMap() {
Assert.assertEquals(true, DAO.Settings.sensorMap!!.typeMap.size > 0)
Assert.assertEquals(true, DAO.Settings.apiMap!!.apiNameMap.size > 0)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment