检测到您已登录华为云国际站账号,为了您更好的体验,建议您访问国际站服务网站 https://www.huaweicloud.com/intl/zh-cn
不再显示此消息
import exceptions from huaweicloudsdkfunctiongraph.v2 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded
remove命令 remove 命令是对已经部署的资源进行移除的操作。 命令解析 参数解析 操作案例 remove function命令 参数解析 操作案例 remove trigger命令 参数解析 操作案例 remove version命令 参数解析 操作案例 remove alias命令
import exceptions from huaweicloudsdkfunctiongraph.v2 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded
function字段介绍 function字段 表1 function字段说明 参数名 必填 类型 参数描述 functionName True String 函数名称 handler True String 函数执行入口,规则:xx.xx,必须包含“.” runtime True
import exceptions from huaweicloudsdkfunctiongraph.v2 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded
import exceptions from huaweicloudsdkfunctiongraph.v2 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded
案例概述 场景介绍 MetaERP业务场景进行微服务Serverless化改造,如图1所示,将低频使用但资源占用大的微服务逻辑,拆分成独立函数,常驻实例缩容到0;剩余微服务逻辑以Spring兼容方式进行函数化,实现函数化后的微服务快速冷启动和弹性,常驻实例减半。 图1 MFA Serverless改造前后架构
构建程序 通过Web托管方式改造微服务。改造过程中,如果微服务是基于spring框架,则需要使用FunctionGraph提供的SDK,即在pom.xml文件中添加步骤1中依赖。此时,您只需修改配置以及打包方式即可将微服务改造成serverless函数。具体操作步骤如下: 配置微服务依赖。
添加事件源 添加APIG触发器(每个函数分别创建触发器),通过HTTP请求调用函数。 填写API名称,选择分组、发布环境、认证、请求协议、超时时间等配置,单击”确定”完成触发器创建,如图1所示。 图1 创建触发器 创建后可以获得一个调用URL,通过这个URL进行函数的调用,如图2所示。
import exceptions from huaweicloudsdkfunctiongraph.v2 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded
import exceptions from huaweicloudsdkfunctiongraph.v2 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded
import exceptions from huaweicloudsdkfunctiongraph.v2 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded
import exceptions from huaweicloudsdkfunctiongraph.v2 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded
import exceptions from huaweicloudsdkfunctiongraph.v2 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded
现软连接导致的依赖缺失错误,因此需要删除现有“node_modules”子目录。 在Windows系统中重新安装,操作步骤如下: 退出Docker容器(原生Linux系统忽略)。 exit 删除项目目录中的“node_modules”子目录(如果您使用的是Linux操作系统,可以将项目中的package
import exceptions from huaweicloudsdkfunctiongraph.v2 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded
import exceptions from huaweicloudsdkfunctiongraph.v2 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded
import exceptions from huaweicloudsdkfunctiongraph.v2 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded
import exceptions from huaweicloudsdkfunctiongraph.v2 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded
import exceptions from huaweicloudsdkfunctiongraph.v2 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded