阿里云FPGA云服务器(FaaS) Python SDK正式发布啦!

本文涉及的产品
简介: 介绍阿里云FPGA云服务器(FaaS) python SDK 用法

安装

pip install aliyun-python-sdk-faas
  • 说明

    1. 在使用Python SDK前,需要在aliyun-python-sdk-core里增加一个endpoint,具体为:/usr/local/lib/python2.7/site-packages/aliyunsdkcore/endpoints.xml的648行,增加如下语句

      `
      <Product><ProductName>faas</ProductName><DomainName>faas.cn-hangzhou.aliyuncs.com</DomainName></Product>
      `
      

## 卸载

pip uninstall aliyun-python-sdk-faas

## 创建镜像

from aliyunsdkcore import client
clt = client.AcsClient(<用户AK>,<用户AS>,'cn-hangzhou')
from aliyunsdkfaas.request.v20170824 import CreateFpgaImageTaskRequest
request = CreateFpgaImageTaskRequest.CreateFpgaImageTaskRequest()
request.set_Bucket(<DCP/bitstream所在的OSS bucket>)
request.set_Object(<DCP/bitstream在OSS中的object name>)
request.set_FpgaType(<Fpga类型>)
request.set_ShellUUID(<shell类型>)
request.set_Name(<给镜像取个方便记的名字>)
request.set_RoleArn(<给faas-admin帐号创建的角色>)
request.set_Encrypted(<是否加密,True/False>)
request.set_KeyId(<如果加密,指定KMS中key的ID>)
result = clt.do_action_with_exception(request)
print result

## 删除镜像

from aliyunsdkcore import client
clt = client.AcsClient(<用户AK>,<用户AS>,'cn-hangzhou')
from aliyunsdkfaas.request.v20170824 import DeleteFpgaImageRequest
request = DeleteFpgaImageRequest.DeleteFpgaImageRequest()
request.set_FpgaImageUUID(<需要删除的镜像UUID>)
result = clt.do_action_with_exception(request)
print result

## 查看镜像

from aliyunsdkcore import client
clt = client.AcsClient(<用户AK>,<用户AS>,'cn-hangzhou')
from aliyunsdkfaas.request.v20170824 import DescribeFpgaImagesRequest
request = DescribeFpgaImagesRequest.DescribeFpgaImagesRequest()
result = clt.do_action_with_exception(request)
print result

## 查看实例

from aliyunsdkcore import client
clt = client.AcsClient(<用户AK>,<用户AS>,'cn-hangzhou')
from aliyunsdkfaas.request.v20170824 import DescribeFpgaInstancesRequest
request = DescribeFpgaInstancesRequest.DescribeFpgaInstancesRequest()
request.set_InstanceId(<指定实例名>)
request.set_RoleArn(<给faas-admin帐号创建的角色>)
result = clt.do_action_with_exception(request)
print result

## 下载镜像

from aliyunsdkcore import client
clt = client.AcsClient(<用户AK>,<用户AS>,'cn-hangzhou')
from aliyunsdkfaas.request.v20170824 import LoadFpgaImageTaskRequest
request = LoadFpgaImageTaskRequest.LoadFpgaImageTaskRequest()
request.set_InstanceId(<指定实例名>)
request.set_FpgaUUID(<需要操作的FPGA>)
request.set_FpgaType(<Fpga类型>)
request.set_FpgaImageUUID(<需要下载的镜像UUID>)
request.set_FpgaImageType(<镜像类型>)
request.set_ShellUUID(<指定shell>)
request.set_RoleArn(<给faas-admin帐号创建的角色>)
result = clt.do_action_with_exception(request)
print result

## 查看下载结果

from aliyunsdkcore import client
clt = client.AcsClient(<用户AK>,<用户AS>,'cn-hangzhou')
from aliyunsdkfaas.request.v20170824 import DescribeLoadTaskStatusRequest
request = DescribeLoadTaskStatusRequest.DescribeLoadTaskStatusRequest()
request.set_FpgaUUID(<需要操作的FPGA>)
request.set_InstanceId(<指定实例名>)
request.set_RoleArn(<给faas-admin帐号创建的角色>)
result = clt.do_action_with_exception(request)
print result

##发布自己FPGA镜像到阿里云镜像市场

from aliyunsdkcore import client
clt = client.AcsClient(<用户AK>,<用户AS>,'cn-hangzhou')
from aliyunsdkfaas.request.v20170824 import PublishFpgaImageRequest
request = PublishFpgaImageRequest.PublishFpgaImageRequest()
request.set_FpgaImageUUID(<需要发布的镜像UUID>)
request.set_ImageID(<在云市场发布的ECS镜像ID>)
result = clt.do_action_with_exception(request)
print result
目录
相关文章
|
14天前
|
弹性计算
阿里云ECS使用体验
在申请高校学生免费体验阿里云ECS云服务器后的一些使用体验和感受。
|
1天前
|
弹性计算
阿里云ECS的使用心得
本文主要讲述了我是如何了解到ECS,使用ECS的一些经验,以及自己的感悟心得
|
2天前
|
应用服务中间件 Linux 开发工具
如何在阿里云服务器快速搭建部署Nginx环境
以下是内容的摘要: 本文档主要介绍了在阿里云上购买和配置服务器的步骤,包括注册阿里云账号、实名认证、选择和购买云服务器、配置安全组、使用Xshell和Xftp进行远程连接和文件传输,以及安装和配置Nginx服务器的过程。在完成这些步骤后,你将能够在服务器上部署和运行自己的网站或应用。
|
2天前
|
消息中间件 运维 Serverless
阿里云函数计算是一种FaaS(Function as a Service)云服务
【4月更文挑战第17天】阿里云函数计算是一种FaaS(Function as a Service)云服务
12 3
|
3天前
|
自然语言处理 Cloud Native Serverless
通义灵码牵手阿里云函数计算 FC ,打造智能编码新体验
近日,通义灵码正式进驻函数计算 FC WebIDE,让使用函数计算产品的开发者在其熟悉的云端集成开发环境中,无需再次登录即可使用通义灵码的智能编程能力,实现开发效率与代码质量的双重提升。
|
3天前
|
人工智能 Serverless 数据处理
利用阿里云函数计算实现 Serverless 架构的应用
阿里云函数计算是事件驱动的Serverless服务,免服务器管理,自动扩展资源。它降低了基础设施成本,提高了开发效率,支持Web应用、数据处理、AI和定时任务等多种场景。通过实例展示了如何用Python实现图片压缩应用,通过OSS触发函数自动执行。阿里云函数计算在云计算时代助力企业实现快速迭代和高效运营。
3 0
|
3天前
|
弹性计算 运维 安全
阿里云ecs使用体验
整了台服务器部署项目上线
|
7天前
|
弹性计算 应用服务中间件 Linux
阿里云ECS服务器上从零开始搭建nginx服务器
阿里云ECS服务器上从零开始搭建nginx服务器
|
7天前
|
域名解析 网络协议 应用服务中间件
阿里云服务器配置免费https服务
阿里云服务器配置免费https服务
|
8天前
|
存储 安全 Serverless
用 Github Actions 自动部署阿里云函数计算 FC
介绍了如何配置阿里云函数计算(FC)与GitHub Actions集成以实现自动部署。首先在阿里云创建函数,然后在项目根目录创建`s.yaml`文件配置Serverless Devs。接着在GitHub仓库中设置 Secrets 存储阿里云账号信息,并创建名为`aliyun-fc-deploy.yaml`的工作流文件来定义GitHub Actions。当代码推送到`master`分支时,Actions会自动部署到函数计算。最后,成功配置后,提交代码会触发自动部署,并可在GitHub Actions和阿里云控制台查看部署状态。
311 1