首页 > 其他分享 >eval

eval

时间:2024-09-10 08:55:33浏览次数:10  
标签:MemTotal mem default export eval cpu 1000

MemTotal=$(awk '/MemTotal/{print $2}' /proc/meminfo )
# MemTotal=$(echo "scale=2;$MemTotal/1000/1000"|bc)
CpuTotal=$(awk '/processor/{core++} END{print core}' /proc/cpuinfo)


export mongodb_cpu=$(($CpuTotal/5))
export core_cpu=$(($CpuTotal/10))
export nginx_cpu=$(($CpuTotal/10))
export loki_cpu=$(($CpuTotal/5))
export redis_cpu=$(($CpuTotal/10))
export victora_cpu=$(($CpuTotal/5))
export api_cpu=$(($CpuTotal/10))


export api_mem=$(($MemTotal/10/1000))
export victora_mem=$(($MemTotal/5/1000))
export redis_mem=$(($MemTotal/10/1000))
export loki_mem=$(($MemTotal/5/1000))
export mongodb_mem=$(($MemTotal/5/1000))
export core_mem=$(($MemTotal/10/1000))
export nginx_mem=$(($MemTotal/10/1000))


default_cpu(){
    if [ "${!1}" -le 2 ] ; then
        eval "$1=2.0"
    fi
}

default_mem(){
    if [ "${!1}" -le 2048 ] ; then
        eval "$1=2048" # 动态给变量赋值
    fi
}

default_cpu api_cpu
default_mem api_mem
default_cpu victora_cpu
default_mem victora_mem
default_cpu redis_cpu
default_mem redis_mem
default_cpu loki_cpu
default_mem loki_mem
default_cpu mongodb_cpu
default_mem mongodb_mem
default_cpu core_cpu
default_mem core_mem
default_cpu nginx_cpu
default_mem nginx_mem

标签:MemTotal,mem,default,export,eval,cpu,1000
From: https://www.cnblogs.com/wangend/p/18405722

相关文章

  • A COMPREHENSIVE SURVEY ON EVALUATING LARGE LANGUAGE MODEL APPLICATIONS IN THE ME
    本文是LLM系列文章,针对《ACOMPREHENSIVESURVEYONEVALUATINGLARGELANGUAGEMODELAPPLICATIONSINTHEMEDICALINDUSTRY》的翻译。关于评估医疗行业中大型语言模型应用程序的综合调查摘要1引言和背景2综述的分类和结构3医学领域LLM应用评估的现状4挑战......
  • estimate、appraise、assess和evaluate的区别
    estimate:预估。estimate的结果一定是一个具体的数字。比如:Governmentsourcesestimatealong-term50percentincreaseinrailfares.(政府消息人士估计,火车票会上涨50%)。宾语中带有数值结果是estimate的重要特征:其它几个词的宾语都是被评估的事物,强调的是评估行为本身,通常不......
  • Shell编程:文本处理器(cut、split、paste、eval 命令)
    文章目录文本处理器2cut命令-快速裁剪语法格式常用选项示例split命令-文件拆分语法格式常用选项示例paste命令-文件合并语法格式常用选项示例eval命令-变量扫描器工作原理示例文本处理器2本章讲解grep、sort、uniq、tr、cut、split、paste命令等。这......
  • An unbiased evaluation of environment management and packaging tools
    forward:https://alpopkes.com/posts/python/packaging_tools/ LastupdateThispostwaslastupdatedonAugust29th,2024.MotivationWhenIstartedwithPythonandcreatedmyfirstpackageIwasconfused.Creatingandmanagingapackageseemedmuchhard......
  • An unbiased evaluation of environment management and packaging tools
    forward:https://alpopkes.com/posts/python/packaging_tools/ LastupdateThispostwaslastupdatedonAugust29th,2024.MotivationWhenIstartedwithPythonandcreatedmyfirstpackageIwasconfused.Creatingandmanagingapackageseemedmuchhard......
  • LogicBench: Towards Systematic Evaluation of Logical Reasoning Ability of Large
    本文是LLM系列文章,针对《LogicBench:TowardsSystematicEvaluationofLogicalReasoningAbilityofLargeLanguageModels》的翻译。LogicBench:大型语言模型逻辑推理能力的系统评价摘要1引言2相关工作3LogicBench4结果和分析5结论局限性摘要最近......
  • MybatisPlus Caused by: org.apache.ibatis.builder.BuilderException: Error evalua
    报错信息:org.mybatis.spring.MyBatisSystemException:nullatorg.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:97)atorg.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessi......
  • ast.literal_eval替代eval将字符串形式的表达式解析为 Python 对象
    如果一个字符串表示一个列表,你可以使用Python的ast.literal_eval方法将其转换为真正的列表。ast.literal_eval是一个安全的方法,可以将字符串形式的表达式解析为Python对象。这里是一个例子:importast#字符串形式的列表str_list="[1,2,3,4,5]"#将字符串解析......
  • 关于Pytorch中net.eval()和torch.no_grad()的意义理解
    Q:defevaluate_accuracy(net,data_iter):#@save"""计算在指定数据集上模型的精度"""ifisinstance(net,torch.nn.Module):net.eval()#将模型设置为评估模式metric=Accumulator(2)#正确预测数、预测总数withtorch.no_grad():......
  • M3KE: A Massive Multi-Level Multi-Subject Knowledge Evaluation Benchmark for Chi
    文章目录题目摘要简介相关工作M3KE实验结论题目M3KE:面向中文大型语言模型的海量多层次多学科知识评估基准论文地址:https://arxiv.org/abs/2305.10263项目地址:https://github.com/tjunlp-lab/M3KE摘要    大型语言模型最近在跨任务泛化、指令跟随等多个......