在单个函数调用中部署并运行代码。

aegisblade的Python项目详细描述


安装

我们建议使用virtualenv为python应用程序创建一个独立的环境。在

安装python包作为应用程序的依赖项。在

$ pip install aegisblade

或者对于python3

^{pr2}$

Hello World示例

const{aegisblade}=require('aegisblade');constos=require("os");/** * In this example the `helloWorld()` function will be run on a * server using AegisBlade.  */asyncfunctionhelloWorld(){console.log(`The server's hostname is ${os.hostname()}`);return`Hello World from ${os.hostname()}`;}// Any target function to be run on AegisBlade must be exported.module.exports={helloWorld};/** * The `main()` function will run on your local machine * and start the job running the `helloWorld()` function * on a server using AegisBlade. */asyncfunctionmain(){letjob=awaitaegisblade.run(helloWorld);console.log(`Job Id: ${job.id}`);console.log("Waiting for the job to finish running...");letjobReturnValue=awaitjob.getReturnValue();letjobLogs=awaitjob.getLogs();console.log(`Job Return Value: ${jobReturnValue}`);console.log(`Job Logs: ${jobLogs}`);}//  Using the `require.main === module` idiom to only run main when this script//    is called directly is especially important when using AegisBlade to prevent//    infinite loops of jobs creating jobs.if(require.main===module){(async()=>{try{awaitmain();}catch(err){console.error(err);}})();}

关于python2的注释

官方的python组织在2020年1月之后将不再支持python2。在

不过,由于它的流行用法,在可预见的将来,我们可能会继续支持Python2.7客户机。在

参考文献

Python Client Reference Docs

联系人

盾形盾-@aegisbladehq-welovedevs@aegisblade.com

项目链接:https://github.com/aegisblade/aegis-nodejs

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java Apache Flink外部Jar   创建和强制转换对象数组时发生java错误   Java,添加数组   具有相同包结构和类的java JAR   java Jenkins未能构建Maven项目   java为什么一个forloop比另一个更快,尽管它们做的“一样”?   servlets在将“/”站点迁移到Java EE包时处理contextpath引用   无法解析java MavReplugin:2.21或其某个依赖项   泛型如何编写比较器来泛化Java中的两种类型的对象?   java Android Emulator未在netbeans上加载   多线程Java使用线程对数组中的数字求和:在同步块中使用新变量作为锁:差异   java如何在JSP/servlet中设置<input>标记的值?