esmini LongSpeedAction修改

esmini的LongSpeedAction,如果shape设置为step的话,DynamicsDimension实际就无效了,

因为step的意思就是直接设置,在LongSpeedAction的Start过程中设置完就结束了,Step就不在

执行。

如果我们在step的情况下,想让LongSpeedAction持续一段时间再结束,可以这么修改。

在Start中去掉OSCAction::End()

    if (transition_dynamics_.shape_ == DynamicsShape::STEP)
	{
		object_->SetSpeed(target_->GetValue());
		if (!(target_->type_ == Target::TargetType::RELATIVE && ((TargetRelative*)target_)->continuous_ == true))
		{
			//OSCAction::End();
		}
	}

在Step中加上这一句

    if (transition_dynamics_.shape_ == DynamicsShape::STEP && transition_dynamics_.dimension_ == DynamicsDimension::TIME)
	{
		elapsed_ += dt;
		if (elapsed_ >= transition_dynamics_.target_value_)
			OSCAction::End();
		return;
	}

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
以下是一个简单的示例,演示如何将 PDC 算法接入到 esmini 中: 1. 安装 PDC 算法库和依赖库,例如 numpy、scikit-learn 等。 2. 编写 Python 脚本,该脚本可以调用 PDC 算法的 API 接口,将 Elasticsearch 集群的监控数据作为输入,获取 PDC 算法的预测结果。例如: ```python import requests import json import numpy as np # 设置 PDC 算法的 API 地址和参数 url = "http://pdc-api.example.com/predict" params = {"cpu_usage": [0.2, 0.3, 0.4], "memory_usage": [0.5, 0.6, 0.7], "network_usage": [0.1, 0.2, 0.3]} # 调用 PDC 算法的 API 接口,获取预测结果 response = requests.post(url, json=params) result = json.loads(response.text) # 处理预测结果,例如将其转换为 numpy 数组 prediction = np.array(result["prediction"]) ``` 3. 将该脚本集成到 esmini 的监控规则中,例如: ```json { "name": "PDC Prediction Rule", "description": "Use PDC algorithm to predict Elasticsearch cluster performance", "conditions": "cpu_usage > 0.8 or memory_usage > 0.8", "actions": [ { "type": "execute_script", "script": "path/to/pdc_script.py" }, { "type": "send_email", "to": "admin@example.com", "subject": "Elasticsearch cluster performance prediction", "body": "PDC predicted abnormal performance in Elasticsearch cluster" }, { "type": "log_event", "message": "PDC predicted abnormal performance in Elasticsearch cluster" } ] } ``` 4. 在 esmini 中启用该规则,即可实现将 PDC 算法接入到 Elasticsearch 监控中,并根据预测结果触发相应的报警和日志记录。可以根据实际需求对规则进行调整和优化,提高监控的准确性和可靠性。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值