以编程方式使用simulagora的python库

simulagora的Python项目详细描述


摘要

直接从 命令行或通过python程序。

先决条件

您需要正确安装cwclientlib,这本身就需要 Python2.7和Python requests

当然,还需要在Simulagora上注册一个帐户。

使用Simulagora客户端

  1. 登录Simulagora并在 dedicated URL

  2. 在用户的.config目录中创建cwclientlibrc文件(仅 可自行阅读),例如:

    [simulagora]
    url = https://www.simulagora.com
    token-id = the token id
    secret = the token itself
    

示例

直接来自命令行的示例。列出你能做的研究 访问:

$ simulagora studies
[{'eid': 4173, 'name': u'Study 1'},
 {'eid': 4277, 'name': u'Study 2'},
 {'eid': 4310, 'name': u'Study 3'}]
$ simulagora executables
[{'eid': 2454, 'name': u'Attente (secondes)'},
 {'eid': 2470, 'name': u'paraview'},
 {'eid': 4672, 'name': u'bash_command #0'},
 {'eid': 4883, 'name': u'lmgc90_donut'}]

使用python的更完整的示例。创建“活塞测试代码”研究 和一个同名文件夹,上传其中的数据,并运行一个代码aster计算 把这些数据作为“m1.large”服务器的输入 Simulagora机器图像(当前代码为ASTER 11.5):

fromsimulagoraimportSimulagorafromtimeimportsleepclient=Simulagora.for_instance('simulagora')# create the folder, upload the files and get their identifiersfolder=client.create_folder('Code Aster piston test')file_eids=client.upload_files(folder,'piston.comm','piston.mmed','piston.export')# get the "bash command" executable which will run the "as_run" commandexecutable=client.find_one('Executable',name='bash command')params={'command':'as_run piston.export'}# get the server type, create the study and the run, then start itserver_type=client.find_one('CloudServerType',name='m3.xlarge')study=client.create_study('Code Aster piston test')run=client.create_run(study,executable,server_type,file_eids,params)client.start_run(run)# check its state every 5 seconds until its crashed or completedstate=Nonewhilestatenotin('wfs_run_crashed','wfs_run_completed'):state=client.state(run)sleep(5)print"Run "+state.rsplit('_',1)[-1]

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

推荐PyPI第三方库


热门话题
java JavaFX触控事件未触发Ubuntu 20.04触控笔记本电脑   java如何在AWT中关闭窗口?   java Dagger 2:注入具有构造函数参数的成员   创建对象的Java调用类   对象我想在A.java中添加两个数字,并在B.java中打印结果(如何?)   java如何使用AWS SDK for Android从数字海洋空间下载图像?   java Facebook sdk 4.0.1无法使用Android studio获取某些字段   4分钟后web应用程序(Angular 8和Rest API)中的java自动会话超时   在Eclipse for Java EE developers edition中禁用HTML警告   java按字母顺序排列字符串我错过了什么明显的东西吗?   java在Jshell中println和printf有什么不同