欢迎使用 RenderbusSDK!

初窥SDK

概览

我们开放一个简单的Python渲染SDK来更方便地使用我们的云渲染服务;
这个官方渲染SDK由 RENDERBUS 的 RD和TD 团队一起维护开发;
这个渲染SDK在 python2.7 and python3.6 下测试通过。

为什么要使用渲染SDK

1. 自动化。SDK将使用云渲染服务的流程(分析场景、上传资产、渲染、下载)全部自动化。且可嵌入到客户自身的调度中(如DeadLine、Qube等)
2. 开源。用户可自定义开发或提交开发建议
3. 跨版本。支持python2和python3
4. 跨平台。支持Windows和Linux
5. 安全性高。使用动态签名算法认证(HmacSHA256 + Base64 + UTC时间戳限时认证 + 随机数防止重放攻击),更安全
6. 提供多种使用方式。支持本地分析和不本地分析
7. 独立性好。将API与业务逻辑独立开来,易扩展
8. 有详细文档

支持的软件

  • Maya
  • Houdini
  • Clarisse

准备工作

  1. 您需要一个 RENDERBUS 账号
  2. 您还需要在 RENDERBUS 开发者中心 申请使用渲染SDK,并获取AccessID和AccessKey

安装相应模块

详细的安装方法参考 安装指南

开始使用

参数设置请参考

重要

使用前请确保本地Python环境和PIP可用。

安装指南

方法一(推荐):

注解

中国用户如果访问Python官方地址网络受限,可以从自定义PIP服务器下载安装。

  • 从Python官方pypi下载(推荐)

    pip install rayvision_maya

    pip install rayvision_clarissa

    pip install rayvision_houdini

  • 从自定义PIP服务器安装

    再使用具体渲染模块之前,比如想使用houdini渲染,请参考以下安装方法依次安装模块 rayvision_log, rayvision_api , rayvision_utils , rayvision_sync, 然后安装 rayvision_houdini

    pip install rayvision_log -i https://pip.renderbus.com/simple/

    pip install rayvision_api -i https://pip.renderbus.com/simple/

    pip install rayvision_utils -i https://pip.renderbus.com/simple/

    pip install rayvision_sync -i https://pip.renderbus.com/simple/

方法二:

  • 直接从GitHub下载源码:

git clone https://github.com/renderbus/rayvision_log.git

git clone https://github.com/renderbus/rayvision_api.git

git clone https://github.com/renderbus/rayvision_utils.git

git clone https://github.com/renderbus/rayvision_sync.git

方法三:

  • 在IDE中配置PIP源以下地址: https://pip.renderbus.com/simple/
  • 以pycharm为例:
_images/pycharm配置PIP地址.png _images/pycharm安装自定义包.png

SDK 入门教程

一. 登陆认证

render_para = {
    "domain": "task.renderbus.com",
    "platform": "2",
    "access_id": "xxxx",
    "access_key": "xxxx",
}

api = RayvisionAPI(
        access_id=render_para['access_id'],
        access_key=render_para['access_key'],
        domain=render_para['domain'],
        platform=render_para['platform']
    )

RayvisionAPI 参数说明:

参数 类型 是否必须 默认值 说明
domain string task.renderbus.com 国内用户:task.renderbus.com,国外用户:jop.foxrenderfarm.com
platform string 2 平台ID,例如: W2:"2", W6/青云:"6", GPU一区:"21"
access_id string 授权id,用于标识API调用者身份
access_key string 授权密钥,用于加密签名字符串和服务器端验证签名字符串

二. 分析场景

分析是独立(Maya / Houdini / Clarisse)

以分析Houdini为例

from rayvision_houdini.analyze_houdini import AnalyzeHoudini

analyze_info = {
    "cg_file": r"D:\files\CG FILE\flip_test_slice4.hip",
    "workspace": "c:/workspace",
    "software_version": "17.5.293",
    "project_name": "Project1",
    "plugin_config": {
        'renderman': '22.6'
    }
}
analyze_obj = AnalyzeHoudini(**analyze_info)
analyze_obj.analyse()

说明:

  • "workspace"用来控制生成json文件位置,如果不设置workspace,默认生成位置:

    windows : os.environ["USERPROFILE"] + "renderfarm_sdk"  
    Linux:os.environ["HOME"] + “renderfarm_sdk”
    
  • 分析生成的task.json中“task_id”、“user_id”、"project_id"为空,用户可以选择自己写 入这三个参数 ,或者在check的时候自动写入此3个参数。

AnalyzeHoudini 参数说明:

参数 类型 是否必须 默认值 说明
cg_file string 需要分析的场景文件
software_version string 场景使用的软件版本
project_name string None 项目名
plugin_config dict None 插件配置,如 {'renderman': '22.6'}
workspace string None 分析生成json文件位置(避免重复会自动添加一个时间戳文件夹)

三. 添加特殊字段和更新json文件接口

只支持对task.json和upload.json文件参数的更新和修改.

1. 修改task.json

update_task_info(update_info, task_path)

https://blog-tao625.oss-cn-shenzhen.aliyuncs.com/izone/blog/20200402094336.pngtask_info

from rayvision_api.utils import update_task_info, append_to_task, append_to_upload
update_task = {
    "pre_frames": "100",  # 设置优先渲染首帧
    "stop_after_test": "1"  # 渲染完优先帧后停止渲染
}
update_task_info(update_task, analyze_obj.task_json)

2. task.json添加自定义参数

添加的自定义参数将会集成到key为"additional_info"的字典中【注意】:自定义参数不会立即生效,如果有这种需求的客户请联系公司客服。

https://blog-tao625.oss-cn-shenzhen.aliyuncs.com/izone/blog/20200402094058.pngadditional_info

custom_info_to_task = {
    "env": "houdini_env"
}
append_to_task(custom_info_to_task, analyze_obj.task_json)

3. 自定义upload.json

支持自定义添加文件路径到upload.json,会自动去重 append_to_upload(files_paths, upload_path)

https://blog-tao625.oss-cn-shenzhen.aliyuncs.com/izone/blog/20200402094235.pngupload

custom_info_to_upload = [
    r"D:\houdini\CG file\Cam003\cam.abc",
]
append_to_upload(custom_info_to_upload, analyze_obj.upload_json)

四. 校验json文件

校验的时候会检查task.json中是否有user_id,project_id,task_id, 如果没有则会调用接口从服务器获取相关参数并写入task.json

check_obj = RayvisionCheck(api, analyze_obj)
task_id = check_obj.execute(analyze_obj.task_json, analyze_obj.upload_json)

五. 上传

现在提供2种方式:

1.先上传json文件再根据“upload.json”上传资源文件:

先上传四个json文件,然后传输引擎自动根据upload.json文件开始上传场景、资源等文件

upload(self,task_id,task_json_path,tips_json_path,asset_json_path,upload_json_path, max_speed=None)

CONFIG_PATH = [
    r"C:\workspace\work\tips.json",
    r"C:\workspace\work\task.json",
    r"C:\workspace\work\asset.json",
    r"C:\workspace\work\upload.json",
]
upload_obj = RayvisionUpload(api)
upload_obj.upload(str(task_id), *CONFIG_PATH)

2.上传json文件和用户资源完全独立:

上传资源:upload_asset(self, upload_json_path, max_speed=None, is_db=True)

上传json文件: upload_config(self, task_id, config_file_list, max_speed=None)

CONFIG_PATH = [
    r"C:\workspace\work\tips.json",
    r"C:\workspace\work\task.json",
    r"C:\workspace\work\asset.json",
]
UPLOAD = RayvisionUpload(api)
UPLOAD.upload_asset(r"C:\workspace\work\upload.json", is_db=False)
UPLOAD.upload_config("5165465", CONFIG_PATH)

【注意】:上传json文件的时候需要任务ID,上传资源文件则不需要任务ID;upload_assetis_db参数用来控制是否需要使用本地数据库,默认使用本地数据库;

六. 提交任务

api.submit(int(task_id))

七. 下载

下载现在提供3种方式:

1. 支持自定义下载每个渲染任务底下的层级目录结构

download(self, task_id_list=None, max_speed=None, print_log=True, download_filename_format="true",local_path=None, server_path=None)

download = RayvisionDownload(api)
download.download(download_filename_format="true", server_path="18164087_muti_layer_test/l_ayer2")

注意:此方法在“server_path”不为空的时候则需要提供任务ID,有自定义“server_path”的时候任务ID不生效

2. 实时下载,即任务渲染完成一帧即开始下载

auto_download(self, task_id_list=None, max_speed=None, print_log=False, sleep_time=10, download_filename_format="true", local_path=None)

download = RayvisionDownload(api)
download.auto_download([18164087], download_filename_format="false")

说明:此方法任务ID不能为空

3. 任务所有帧渲染完成才开始下载

auto_download_after_task_completed(self, task_id_list=None, max_speed=None, print_log=True, sleep_time=10, download_filename_format="true", local_path=None):

download = RayvisionDownload(api)
download.auto_download_after_task_completed([18164087], download_filename_format="false")

说明: 此方法任务ID不能为空

八. 附加: 传输配置文件

1. 传输配置设置包括:

选择数据库类型,数据库文件路径设置,传输日志路径设置

2. 默认使用的传输配置文件:db_config.ini, 如下图

https://blog-tao625.oss-cn-shenzhen.aliyuncs.com/izone/blog/20200415114705.pngdb_config.ini

用户也可根据默认配置为模板修改配置并指定数据库配置文件位置,指定自定义配置文件方法如下

from rayvision_sync.upload import RayvisionUpload

UPLOAD = RayvisionUpload(api, db_config_path=r"D:\test\upload\db_config.ini")

3. db_config.ini 参数说明:

参数 说明 默认值
transfer_log_path 传输引擎日志文件路径
on 是否使用本地数据库, true / false: 是 / 否 true
type 选择数据库, 目前仅支持"redis" 和 "sqlite" sqlite
db_path 数据库文件保存路径
host redis数据库host 127.0.0.1
port redis数据库port 6379
password redis数据库password
table_index redis数据库保存文件的仓库名,选择redis数据库则不能为空
timeout redis客户端连接超时时间,客户端在这段时间内没有发出任何指令,那么关闭该连接,单位ms 5000
temporary 使用sqlite数据库时,上传的记录数据是否在完成上传后删除, 默认"false"不删除 false

4. transfer_log_path 和 db_path 取值的优先级规则如下:

  • db_config.ini有设置自定义路径则优先使用自定义路径;

  • 无自定义路径则如下:

    transfer_log_path

    • 优先使用环境变量'RAYVISION_LOG'

    • 次之使用:

      window: 环境变量"USERPROFILE"位置/<renderfarm_sdk>Linux:环境变量"HOME"位置/<renderfarm_sdk>

    db_path

    • 优先使用环境变量'RAYVISION_LOG'

    • 次之使用:

      window: 环境变量"USERPROFILE"位置/<renderfarm_sdk>Linux:环境变量"HOME"位置/<renderfarm_sdk>

5. rayvision_houdini 分析生成的db数据库位置

houdini脚本在分析的时候会将一些分析命令和文件保存在sqlite数据库文件中
  • 优先使用自定义自定义路径,自定义路径设置方法如下:

    调用"AnalyzeHoudini"分析类的时候设置custom_db_path参数值即可

class AnalyzeHoudini(object):
    def __init__(self, cg_file, software_version, project_name=None,
                 plugin_config=None, render_software="Houdini",
                 local_os=None, workspace=None, custom_exe_path=None,
                 platform="2", custom_db_path=None):
  • 未设置自定义路径则使用以下规则:
  • 优先使用环境变量'RAYVISION_HOUDINI'

  • 次之使用:

    window: 环境变量"USERPROFILE"位置/<renderfarm_sdk>Linux:环境变量"HOME"位置/<renderfarm_sdk>

rayvision_api包

注解

API的入口功能模块。

注解

task 包主要是校验分析结果和配置一些初始task信息

注解

为任务设置资产信息和一般配置信息

任务模块(RayvisionTask)

注解

operators 包主要是对于公司内部渲染接口的调用。

这个包主要是关于`rayvision_api`设置环境和调用渲染平台服务接口的相关操作

环境配置(RenderEnv)

Set the rendering environment configuration.

class rayvision_api.operators.env.RenderEnvOperator(connect)

基类:object

The rendering environment configuration.

add_render_env(data)

Adjust user rendering environment configuration.

参数:data (dict) --

Rendering environment configuration. e.g.:

{
'cgId': "2000", 'cgName': 'Maya', 'cgVersion': '2018', 'renderLayerType': 0, 'editName': 'tests', 'renderSystem': 1, 'pluginIds': [2703]

}

返回:
Render env info.
e.g.:
{
'editName': 'tests'

}

返回类型:dict
delete_render_env(edit_name)

Delete user rendering environment configuration.

参数:edit_name (str) -- Rendering environment custom name.
get_render_env(name)

Get the user rendering environment configuration.

参数:
  • name (str) -- The name of the DCC.
  • e.g. -- maya, houdini, 3dsmax
返回:

Software info.
e.g.:
[
{

"cgId": 2000, "editName": "testRenderEnv332", "cgName": "Maya", "cgVersion": "2020", "osName": 0, "renderLayerType": 0, "isDefault": 0, "respUserPluginInfoVos": [

{

"pluginId": 1166, "pluginName": "wobble", "pluginVersion": "wobble 0.9.5"

}

]

}, {

"cgId": 2000, "editName": "testRenderEnv222", "cgName": "Maya", "cgVersion": "2020", "osName": 0, "renderLayerType": 0, "isDefault": 0, "respUserPluginInfoVos": [

{

"pluginId": 1166, "pluginName": "wobble", "pluginVersion": "wobble 0.9.5"

}

]

返回类型:

list

set_default_render_env(edit_name)

Set the default render environment configuration.

参数:edit_name (str) -- Rendering environment custom name.
update_render_env(data)

Modify the user rendering environment configuration.

参数:data (dict) --

Rendering environment configuration. e.g.:

{
'cgId': "2000", 'cgName': 'Maya', 'cgVersion': '2018', 'renderLayerType': 0, 'editName': 'tests', 'renderSystem': 1, 'pluginIds': [2703],

}.

查询(Query)

API query operation.

class rayvision_api.operators.query.QueryOperator(connect)

基类:object

API query operation.

all_frame_status()

Get the overview of task rendering frame.

返回:
Frames status info.
e.g.:
{
"executingFramesTotal": 1, "doneFramesTotal": 308, "failedFramesTotal": 2, "waitingFramesTotal": 153, "totalFrames": 577

}

返回类型:dict
error_detail(code, language='0')

Get analysis error code.

参数:
  • code (string) --

    Required value, error code. e.g.:

    10010. 15000.
  • language (str, optional) -- Not required, language, 0: Chinese (default) 1: English.
返回:

Detailed list of error messages.
e.g.:
[
{

"id": 5, "code": "15000", "type": 1, "languageFlag": 0, "desDescriptionCn": "启动 3ds max 卡住或者失败", "desSolutionCn": "1.检查启用对应版本的 3ds max

是否有特殊弹窗,有的话手动关闭;n2.检查操作系 统是否设置了高级别的权限",

"solutionPath": "

http://note.youdao.com/noteshare?id=d8f1ea0c46dfb524af798f6b1d31cf6f",

"isRepair": 0, "isDelete": 1, "isOpen": 1, "lastModifyAdmin": "", "updateTime": 1534387709000

},

]

返回类型:

list

get_frame_thumbnall(frame_id, frame_status=4)

Load thumbnail.

参数:
  • frame_id (int) -- Frame id.
  • frame_status (int) -- State of the frame, only complete with thumbnails.
返回:

Thumbnail path.
Example:
[

"small_pic100000100001138Render_264_renderbus_0008[-]jpg.jpg"

]

返回类型:

list

get_raysync_user_key()

Get the user rendering environment configuration.

返回:
User login raysync information.
Example:
{
'raySyncUserKey': '8ccb94d67c1e4c17fd0691c02ab7f753cea64e3d', 'userName': 'test', 'platform': 2,

}

返回类型:dict
get_task_list(page_num=1, page_size=2, status_list=None, search_keyword=None, start_time=None, end_time=None)

Get task list.

An old to the new row, the old one.

参数:
  • page_num (int) -- Required value, current page.
  • page_size (int) -- Required value, numbers displayed per page.
  • status_list (list<int>) -- status code list,query the status of the task in the list.
  • search_keyword (string) -- Optional, scenario name or job ID.
  • start_time (string) -- Optional, search limit for start time.
  • end_time (string) -- Optional, search limit for end time.
返回:

Task info, please see the documentation for details.
e.g.:
{

"pageCount": 32, "pageNum": 1, "total": 32, "size": 1, "items": [

{

"sceneName": "衣帽间.max", "id": 18278, "taskAlias": "P18278", "taskStatus": 0, "statusText": "render_task_status_0", "preTaskStatus": 25, "preStatusText": "render_task_status_25", "totalFrames": 0, "abortFrames": null, "executingFrames": null,

},

]

}

返回类型:

dict

get_task_processing_img(task_id, frame_type=None)

Get the task progress diagram,currently only Max software is supported.

参数:
  • task_id (int) -- Task id.
  • frame_type (int) -- Apply colours to a drawing type, nonessential 2 represents the photon frame, 5 gets the main picture progress, and returns the result dynamically according to the stage of the rendering task
  • Example --
    {
    "taskId":389406

    }

Returns: Task progress diagram information
dict:
Example:
{

"block":16, "currentTaskType":"Render", "grabInfo":[

[
{
"couponFee":"0.00", "frameIndex":"0", "renderInfo":"", "frameBlock":"1", "frameEst":"0", "grabUrl":"/mnt/output/d20/small_pic/10001500/10001834/389406/Render_2018110900083_0_frame_0[_]block_0[_]_STP00000_Renderbus_0000[-]tga.jpg", "feeAmount":"0.20", "frameUsed":"66", "frameStatus":"4", "framePercent":"100", "isMaxPrice":"0", "startTime":"2018-11-09 18:28:26", "endTime":"2018-11-09 18:29:32"

}

]

], "height":1500, "sceneName":"com_589250.max-Camera007", "startTime":"2018-11-09 18:27:40", "width":2000

}

get_transfer_server_msg()

Get the user rendering environment configuration.

返回:
Connect raysync information.
Example:
{
'raysyncTransfer': {
'port': 2542, 'proxyIp': 'render.raysync.cn', 'proxyPort': 32011, 'serverIp': '127.0.0.1', 'serverPort': 2121, 'sslPort': 2543

}

}

返回类型:dict
platforms()

Get platforms.

返回:
Platforms info.
e.g.:
[
{
"platform": 2, "name": "query_platform_w2"

},

]

返回类型:list
restart_failed_frames(task_param_list)

Re-submit the failed frame.

参数:task_param_list (list of str) -- Task ID list.
restart_frame(task_id, select_all, ids_list=None)

Re-submit the specified frame.

参数:
  • task_id (int) -- Task ID number.
  • ids_list (list, optional) -- Frame ID list, valid when select_all is 0.
  • select_all (int) -- Whether to re-request all, 1 all re-raised, 0 specified frame re-request.
supported_plugin(name)

Get supported rendering software plugins.

参数:name (str) --

The name of the DCC. e.g.:

maya, houdini
返回:
Plugin info.
e.g.:
{
"cgPlugin": [
{
"cvId": 19, "pluginName": "zblur", "pluginVersions": [
{
"pluginId": 1652, "pluginName": "zblur", "pluginVersion": "zblur 2.02.019"

}

]

},

], "cgVersion": [

{
"id": 23, "cgId": 2005, "cgName": "CINEMA 4D", "cgVersion": "R19"

}

]

}

返回类型:dict
supported_software()

Get supported rendering software.

返回:
Software info.
e.g.:
{
"isAutoCommit": 2, "renderInfoList": [
{
"cgId": 2000, "cgName": "Maya", "cgType": "ma;mb", "iconPath": "/img/softimage/maya.png", "isNeedProjectPath": 3, "isNeedAnalyse": 1, "isSupportLinux": 1

}

], "defaultCgId": 2001

}

返回类型:dict
task_frames(task_id, page_num, page_size, search_keyword=None)

Get task rendering frame details.

参数:
  • task_id (int) -- The task ID number, which is the unique identifier of the task, required field.
  • page_num (int) -- Current page number.
  • page_size (int) -- Displayed data size per page.
  • search_keyword (str, optional) -- Is a string, which is queried according to the name of a multi-frame name of a machine rendering, optional.
返回:

Frames info list, please see the documentation for details.
e.g.:
{

"pageCount": 9, "pageNum": 1, "total": 17, "size": 2, "items": [

{

"id": 1546598, "userId": null, "framePrice": null, "feeType": null, "platform": null, "frameIndex": "0-1", "frameStatus": 4, "feeAmount": 0.44, "startTime": 1535960273000, "endTime": 1535960762000,

},

],

}

返回类型:

dict

task_info(task_ids_list)

Get task details.

参数:task_ids_list (list of int) -- Shell task ID list.
返回:
Task details.
e.g.:
{
"pageCount": 1, "pageNum": 1, "total": 1, "size": 100, "items": [
{
"sceneName": "3d66.com_593362_2018.max", "id": 19084, "taskAlias": "P19084", "taskStatus": 0, "statusText": "render_task_status_0", "preTaskStatus": 25, "preStatusText": "render_task_status_25", "totalFrames": 0, "abortFrames": null, "executingFrames": null, "doneFrames": null, "failedFrames": 0, "framesRange": "0", "projectName": "", "renderConsume": null, "taskArrears": 0, "submitDate": 1535958477000, "startTime": null, "completedDate": null, "renderDuration": null, "userName": "xiaoguotu_ljian", "producer": null, "taskLevel": 60, "taskUserLevel": 0, "taskLimit": null, "taskOverTime": null, "userId": 10001520, "outputFileName": null, "munuTaskId": "", "layerParentId": 0, "cgId": 2001, "taskKeyValueVo": {
"tiles": null, "allCamera": null, "renderableCamera": null

}

}

"userAccountConsume": null

}

返回类型:dict

任务自定义标记(Tag)

API operation on tags.

class rayvision_api.operators.tag.TagOperator(connect)

基类:object

Task tag settings.

add_label(new_name, status=1)

Add a custom label.

参数:
  • new_name (str) -- Label name.
  • status (int, optional) -- Label status,0 or 1,default is 1.
delete_label(del_name)

Delete custom label.

参数:del_name (str) -- The name of the label to be deleted.
get_label_list()

Get custom labels.

返回:
Label list info.
e.g.:
{
"projectNameList": [
{
"projectId": 3671, "projectName": "myLabel"

}

]

}

返回类型:dict
get_project_list()

Get custom labels.

返回:
Label list info.
e.g.:
[
{
"projectId": 3671, "projectName": "myLabel"

}

]

返回类型:list

任务(Task)

Interface to operate on the task.

class rayvision_api.operators.task.TaskOperator(connect)

基类:object

API task related operations.

TASK_PARAM = 'taskIds'
abort_task(task_param_list)

Give up the task.

参数:task_param_list (list) -- Task ID list.
create_task(count=1, task_user_level=50, out_user_id=None, labels=None)

Create a task ID.

参数:
  • count (int, optional) -- The quantity of task ID.
  • task_user_level (int) -- Set the user's task level to either 50 or 60, default is 50.
  • out_user_id (int, optional) -- Non-required, external user ID, used to distinguish users accessing third parties.
  • labels (list or tuple, optional) -- Custom task labels.
返回:

The information of the task.
e.g.:
{

"taskIdList": [1658434], "aliasTaskIdList": [2W1658434], "userId": 100093088

}

返回类型:

dict

delete_task(task_param_list)

Delete task.

参数:task_param_list (list) -- Task ID list.
full_speed(task_id_list)

Full to render.

参数:
  • task_id_list (list of int) -- Task list.
  • Example --
    {
    "taskIds":[485],

    }

set_task_overtime_top(task_id_list, overtime)

Set the task timeout stop time.

参数:
  • task_id_list (list of int) -- Task list.
  • overtime (int or float) -- Timeout time, unit: second.
  • Example --
    {
    "taskIds":[485], "overTime":1800

    }

start_task(task_param_list)

Start task.

参数:task_param_list (list) -- Task ID list.
stop_task(task_param_list)

Stop the task.

参数:task_param_list (list) -- Task ID list.
submit_task(task_id=None, asset_lsolation_model=None, out_user_id=None, only_id=False)

Submit a task to rayvision render farm.

参数:
  • task_id (int) -- Submit task ID.
  • asset_lsolation_model (str) -- Asset isolation type, Optional value, default is null, optional value:'TASK_ID_MODEL' or 'OUT_USER_MODEL'.
  • out_user_id (str) -- The asset isolates the user ID, Optional value, when asset_lsolation_model='OUT_USER_MODEL' ,'out_user_id' cant be empty.
task_id

The ID number of the render task.

Notes

As long as we do not initialize the class again or submit the task successfully, we can always continue to get the task id from the class instance.

Type:int
update_priority(task_id, priority)

Update the render priority for the task by given task id.

参数:
  • task_id (int) -- The ID number of the render task.
  • priority (int) -- The priority for the current render task.

用户信息(User)

Interface to operate the user.

class rayvision_api.operators.user.UserOperator(connect)

基类:object

API user information operator.

get_transfer_bid()

Get user transfer BID.

返回:
Transfer bid info.
e.g.:
{
"config_bid": "30201", "output_bid": "20201", "input_bid": "10201"

}

返回类型:dict
info
query_user_profile()

Get user profile.

返回:
User profile info.
e.g.:
{
"userId": 10001136, "userName": "rayvision", "platform": 2, "phone": "173333333333", "email": "", "company": "", "name": "", "job": "", "communicationNumber": "", "softType": 2000, "softStatus": 1, "businessType": 1, "status": 1, "infoStatus": 0, "accountType": 1,

}

返回类型:dict
query_user_setting()

Get user setting.

返回:
The information of the user settings.
e.g.:
{
"infoStatus": null, "accountType": null, "shareMainCapital": 0, "subDeleteTask": 0, "useMainBalance": 0, "singleNodeRenderFrames": "1", "maxIgnoreMapFlag": "1", "autoCommit": "2", "separateAccountFlag": 0, "mifileSwitchFlag": 0, "assfileSwitchFlag": 0, "manuallyStartAnalysisFlag": 0, "downloadDisable": 0, "taskOverTime": 12

}

返回类型:dict
update_user_settings(task_over_time)

Update user settings.

参数:task_over_time (int) -- The task timeout is set in seconds.
user_id

RayvisionAPI

rayvision_api的入口脚本

Initialize user, task, query, environment, tag interface.

class rayvision_api.core.RayvisionAPI(access_id=None, access_key=None, domain='task.renderbus.com', platform='4', protocol='https', logger=None)

基类:object

Create the request object.

Including user action, task action, query action, environment operation and tag action.

check_and_add_project_name(project_name)

Get the tag id.

Call the API interface to obtain all the label information of the user, determine whether the label name to be added already exists, and obtain the label id if it exists. If the label does not exist, the API interface is repeatedly requested. The request is up to three times. If the third time does not exist, the empty string is returned.

参数:project_name (str) -- The name of the tag to be added.
返回:Tag id.
返回类型:int
connect

The current connect instance.

Type:rayvision.api.Connect
get_user_id()

Get user id.

Example

user_profile_info = {
"userId": 10001136, "userName": "rayvision", "platform": 2, "phone": "173333333333", "email": "", "company": "", "name": "", "job": "", "communicationNumber": "", "softType": 2000, "softStatus": 1, "businessType": 1, "status": 1, "infoStatus": 0, "accountType": 1,

}

返回:The ID number of the current user.
返回类型:int
submit(task_id)

Submit a task.

参数:task_id (int) -- Task id.
submit_by_data(task_info, file_name=None, upload_info='', asset_info='')
user_info

Connect

Request, request header and request result processing.

class rayvision_api.connect.Connect(access_id, access_key, protocol, domain, platform, headers=None, session=None)

基类:object

Connect operation with the server, request.

headers

Get request headers dic.

post(api_url, data=None, validator=True)

Send an post request and return data object if no error occurred.

Request processing through the decorator, if the request fails more than five times, then the exception is ran out.

参数:
  • api_url (rayvision_api.api.url.URL or str) --

    The URL address of the corresponding action network Request.

    e.g.:
    /api/render/common/queryPlatforms /api/render/user/queryUserProfile /api/render/user/queryUserSetting
  • data (dict, optional) -- Request data.
  • validator (bool, optional) -- Validator the data.
返回:

Response data.

返回类型:

dict or List

Raises:

RayVisionAPIError -- The request failed, It returns the error ID, the error message, and the request address.

API接口使用方法

准备工作

所有的接口调用都是通过rayvision_api模块,在使用前必须先实例化一个api对象:

user_info = {
    "domain_name": "task.renderbus.com",
    "platform": "2",
    "access_id": "xxxxxxxxxxxxxxxxxxxxxx",
    "access_key": "xxxxxxxxxxxxxxxxxxxxx",
}

api = RayvisionAPI(access_id=user_info['access_id'],
                   access_key=user_info['access_key'],
                   domain=user_info['domain_name'],
                   platform=user_info['platform'])

说明

  1. 以下接口调用会直接使用以上实例的api进行调用;
  2. 返回示例中显示的是原始接口结果,实际在rayvision_api中接口返回给用户的只是“data”参数值;

获取平台列表

接口路径:  /api/render/common/queryPlatforms

请求参数:缺省

返回参数

参数 类型 说明 备注
platform Integer 平台号
name String 平台名描述

请求示例:

# 自动根据“domain”参数内容区分国内外
platform = api.query.platforms()

返回示例

{
    "version": "1.0.0",
    "result": true,
    "message": "success",
    "code": 200,
    "data": [
        {
            "platform": 2,
            "name": "query_platform_w2"
        }
    ],
    "serverTime": 1535949047370
}

获取用户详情

接口路径: /api/render/user/queryUserProfile

请求参数:缺省

请求示例

user_profile = api.user.query_user_profile()

返回示例

{
    "version": "1.0.0",
    "result": true,
    "message": "success",
    "code": 200,
    "data": {
        "userId": 10001136,
        "userName": "rayvision",
        "platform": 2,
        "phone": "173333333333",
        "email": "",
        "company": "",
        "name": "",
        "job": "",
        "communicationNumber": "",
        "softType": 2000,
        "softStatus": 1,
        "businessType": 1,
        "status": 1,
        "infoStatus": 0,
        "accountType": 1,
        "userType": 1,
        "mainUserId": 0,
        "level": 49,
        "pictureLever": null,
        "zone": 1,
        "rmbbalance": 0,
        "usdbalance": 0,
        "rmbCumulative": 0,
        "usdCumulative": 0,
        "credit": 0,
        "coupon": 49.93,
        "description": "",
        "country": "中国",
        "city": "广东 中山",
        "address": "",
        "cpuPrice": 0.67,
        "gpuPrice": 20,
        "shareMainCapital": 0,
        "subDeleteTask": 0,
        "useMainBalance": 0,
        "hideBalance": 0,
        "hideJobCharge": 0,
        "useLevelDirectory": 1,
        "downloadDisable": 0,
        "displaySubaccount": 1,
        "subaccountLimits": 5,
        "houdiniFlag": 0,
        "c4dFlag": 0,
        "blenderFlag": 0,
        "keyshotFlag": 0,
        "studentEndTime": null
    },
    "serverTime": 1535953580730
}

获取用户设置

接口路径:/api/render/user/queryUserSetting

请求参数:缺省

返回参数

参数 类型 说明 备注
infoStatus Integer
accountType Integer
shareMainCapital Integer 共用主账号资产 0 不共用 1共用
subDeleteTask Integer 是否允许子账号删除任务 0不允许 1 允许
useMainBalance Integer 是否允许子账号使用主账号余额或信用额度  0不允许 1 允许
singleNodeRenderFrames String 一机渲多帧
maxIgnoreMapFlag String 是否忽略max错误贴图 0不忽略,1忽略
autoCommit String 是否启动场景参数渲染 1不启用,2启用
separateAccountFlag Integer 主子账号分离设置
mifileSwitchFlag Integer mi文件分析风险开关
assfileSwitchFlag Integer 不分析ass文件开关标识
manuallyStartAnalysisFlag Integer 手动开启分析开关
downloadDisable Integer 禁用下载 1禁用,0不禁用
taskOverTime Integer 超时时间-小时
taskOverTimeSec Integer 超时时间-秒
ignoreMapFlag Integer 本地分析忽略贴图丢失
isVrayLicense Integer 使用付费版vray渲染
justUploadConfigFlag Integer 本地分析max只上传配置文件
justUploadCgFlag Integer maya渲染只上传cg文件
mandatoryAnalyseAllAgent Integer 本地分析强制分析所有代理

请求示例

user_setting = api.user.query_user_setting()

返回示例

{
    "version": "1.0.0",
    "result": true,
    "message": "success",
    "code": 200,
    "data": {
        "infoStatus": null,
        "accountType": null,
        "shareMainCapital": 0,
        "subDeleteTask": 0,
        "useMainBalance": 0,
        "singleNodeRenderFrames": "1",
        "maxIgnoreMapFlag": "1",
        "autoCommit": "2",
        "separateAccountFlag": 0,
        "mifileSwitchFlag": 0,
        "assfileSwitchFlag": 0,
        "manuallyStartAnalysisFlag": 0,
        "downloadDisable": 0,
		"taskOverTime": 12,
		"taskOverTimeSec": 3600
    },
    "serverTime": 1535954828406
}

更新用户设置

接口路径:/api/render/user/updateUserSetting

请求参数

参数 类型 说明 备注
task_over_time Integer 任务超时时间设置(单位:秒)

返回参数:缺省

请求示例

update_user_setting = api.user.update_user_settings(task_over_time=43200)

返回示例

{
    "version": "1.0.0",
    "result": true,
    "message": "success",
    "code": 200,
    "data": null,
    "serverTime": 1535957894211
}

获取用户传输BID

接口路径:/api/render/task/getTransferBid

请求参数:缺省

返回参数

参数 类型 说明 备注
config_bid String 配置文件传输ID
output_bid String 下载传输ID
input_bid String 资产上传传输ID

请求示例

user_transfer_bid = api.user.get_transfer_bid()

返回示例

{
    "version": "1.0.0",
    "result": true,
    "message": "success",
    "code": 200,
    "data": {
        "parent_input_bid": "10206"
        "config_bid": "30201",
        "output_bid": "20201",
        "input_bid": "10206"
    },
    "serverTime": 1535957964631
}

创建任务号

接口路径:/api/render/task/createTask

请求参数

参数 类型 说明 备注
count Integer 非必须,创建任务号数量 默认为 1
out_user_id Long 非必须,外部用户ID 用于区分第三方接入的用户
task_user_level Integer 非必须,任务用户级别 可选50和60,默认为50
labels List\<String> 非必须,标签

返回参数

参数 类型 说明 备注
aliasTaskIdList List\<String> 任务ID别名
taskIdList List\<Integer> 任务ID

请求示例

create_task_id = api.task.create_task(count=1, 
                                      task_user_level=50,
                                      labels=["label_test1", "label_test2"])

返回示例

{
    "version": "1.0.0",
    "result": true,
    "message": "success",
    "code": 200,
    "data": {
        "aliasTaskIdList": [
            "2W19097"
        ],
        "taskIdList": [
            19097
        ],
        "userId": 10007893
    },
    "serverTime": 1535959487092
}

提交任务

接口路径:/api/render/task/submitTask

请求参数

参数 类型 说明 备注
task_id Integer 提交任务ID
asset_lsolation_model String 资产隔离类型 可选值,默认为空,可选值:'TASK_ID_MODEL'、'OUT_USER_MODEL'
out_user_id String 资产隔离用户ID 可选值,asset_lsolation_model='OUT_USER_MODEL' 时out_user_id不能为空

asset_lsolation_model说明

ASSET_ISOLATION_PATH(资产隔离路径,引用见 场景文件上传)

模式 说明 适用场景 清理规则
TASK_ID_MODEL 将taskId分割为三段,每段最少3位,高位不足时补0, 如 taskId=12345, 则 ASSET_ISOLATION_PATH="000/012/345", 如果任务ID超过9位: 如:11223344556677, 最终得到的隔离路径位 ASSET_ISOLATION_PATH="11223344/556/677" 效果图API企业用户,针对资产文件没有重复性, 引用平台任务号做资产隔离, 避免文件名冲突导致的渲染效果异常 最多保留15天
OUT_USER_MODEL 将outUserId分割为三段,每段最少3位,高位不足时补0, 如 outUserId=12345, 则 ASSET_ISOLATION_PATH="000/012/345", 如果outUserId超过9位, 如:11223344556677, 最终得到的隔离路径位 ASSET_ISOLATION_PATH="11223344/556/677" 动画API企业用户,引用第三方用户ID左资产隔离, 避免出现第三方用户的资产文件冲突导致的渲染结果异常 目录在连续20天内没有新的渲染任务引用,则删除

返回参数:缺省

请求示例

submit_task = api.task.submit_task(task_id=create_task_id[0])

返回示例

{
    "version": "1.0.0",
    "result": true,
    "message": "success",
    "code": 200,
    "data": null,
    "serverTime": 1535957894211
}

注意:进行提交之前需要先调用传输接口上传相关的分析配置文件

获取分析错误码

接口路径: /api/render/common/queryErrorDetail

请求参数

参数 类型 说明 备注
code String 必须值,错误码
language String 非必须,语言 0:中文(默认) 1:英文

返回参数:List<CodeInfo>

参数 类型 说明 备注
id
code Integer 错误码
type Integer 类型 0警告-可忽略,1错误-不可忽略
languageFlag Integer 语言类型 0中文,1英文
desDescriptionCn String 中文描述
desSolutionCn String 解决方案
solutionPath String 解决方案连接
isRepair Integer 是否可修复 1 可修复,0不可修复
isOpen Integer 错误是否开启拦截 0 不开启,1 开启
updateTime Date 最后更新时间

请求示例

error_detail = api.query.error_detail(code="50001")

返回示例

{
    "version": "1.0.0",
    "result": true,
    "message": "success",
    "code": 200,
    "data": [
        {
            "id": 5,
            "code": "15000",
            "type": 1,
            "languageFlag": 0,
            "desDescriptionCn": "启动3ds max卡住或者失败",
            "desSolutionCn": "1.检查启用对应版本的3ds max是否有特殊弹窗,有的话手动关闭;\n2.检查操作系统是否设置了高级别的权限",
            "solutionPath": "http://note.youdao.com/noteshare?id=d8f1ea0c46dfb524af798f6b1d31cf6f",
            "isRepair": 0,
            "isDelete": 1,
            "isOpen": 1,
            "lastModifyAdmin": "",
            "updateTime": 1534387709000
        }
    ],
    "serverTime": 1535962451356
}

获取任务列表

接口路径:/api/render/task/getTaskList

请求参数

参数 类型 说明 备注
page_num Integer 必须值,当前页数 默认:1
page_size Integer 必须值,每页显示数量 默认:2
status_list List\<Integer> 非必须,状态码列表,查询列表中状态的任务 参见任务状态说明
search_keyword String 非必须,场景名或者作业ID 模糊搜索
start_time String 非必须,搜索提交时间下限 格式 yyyy-MM-dd HH:mm:ss
end_time String 非必须,搜索提交时间上限 格式 yyyy-MM-dd HH:mm:ss

任务状态说明

状态 状态码 说明
WAITING 0 等待
RENDERING 5 渲染中
PRE_RENDERING 8 预处理中
STOP 10 停止
ARREARAGE_STOP 20 欠费停止
TIME_OUT_STOP 23 超时停止
FINISHED 25 已完成
FINISHED_HAS_FAILED 30 已完成有失败帧
ABANDON 35 放弃
FINISHED_TEST 40 测试完成
FAILED 45 失败
ANALYSE 50 分析中

返回参数:List<TaskInfo>

参数 类型 说明 备注
sceneName String 场景名
id Integer 任务id
taskAlias String 任务别名
taskStatus Byte 任务状态 1/等待,5/渲染,10/停止,15/用户停止,20/因欠费停止,25/完成,30/完成包含失败帧,35/放弃,40/测试完成,45/失败
statusText String 任务状态文本
preTaskStatus Byte 预处理任务状态
preStatusText String 预处理状态文本
totalFrames Integer 总帧数
abortFrames Integer 放弃帧数
executingFrames Integer 正在运行的帧数
doneFrames Integer 完成的帧数
failedFrames Integer 失败帧数
framesRange String 帧范围
projectName String 项目名
renderConsume BigDecimal 任务渲染消费的总费用
taskArrears BigDecimal 任务欠费金额
submitDate Date 提交时间
startTime Date 开始时间
completedDate Date 完成时间
renderDuration Long 任务渲染总时长 单位:秒
userName String 用户名
producer String 制作人
taskLevel Byte 任务优先级
taskUserLevel Integer 用户层面的优先级
taskLimit Integer 任务机器限制
taskOverTime Long 任务超时提醒
outputFileName String 输出文件名
munuTaskId String 调度器id
layerParentId String 针对maya任务,层父id
cgId Integer 任务类型 2001/maya,2000/max
taskKeyValueVo Object 任务关键字集合
userAccountConsume Bigdecimal 用户账户扣费
couponConsume Bigdecimal 优惠券扣费
isOpen Byte 前端的展开按钮是否展开
taskType String 任务类型 /预处理,/光子渲染,/渲染主图
renderCamera String 渲染相机
cloneParentId Integer 克隆任务挂在那个任务下的id
cloneOriginalId Integer 从哪个任务克隆的
shareMainCapital Byte 该任务是否共享主账号资产 0 不共享 , 1 共享
taskRam Integer 任务渲染内存
respRenderingTaskList List\<TaskInfo> 展开的任务的子任务 跟此对象一样
layerName String 层名
taskTypeText String 任务类型 光子/主图
isDelete Byte 是否删除 0:已删除,1:未删除

taskKeyValueVo实体

参数 类型 说明 备注
tiles String 分块数
allCamera String 全部相机
renderableCamera String 渲染相机

请求示例

task_list = api.query.get_task_list(page_num=1, page_size=1)

返回示例

{
    "version": "1.0.0",
    "result": true,
    "message": "success",
    "code": 200,
    "data": {
        "pageCount": 32,
        "pageNum": 1,
        "total": 32,
        "size": 1,
        "items": [
            {
                "sceneName": "衣帽间.max",
                "id": 18278,
                "taskAlias": "P18278",
                "taskStatus": 0,
                "statusText": "render_task_status_0",
                "preTaskStatus": 25,
                "preStatusText": "render_task_status_25",
                "totalFrames": 0,
                "abortFrames": null,
                "executingFrames": null,
                "doneFrames": null,
                "failedFrames": 0,
                "framesRange": "0",
                "projectName": "",
                "renderConsume": null,
                "taskArrears": 0,
                "submitDate": 1535602289000,
                "startTime": null,
                "completedDate": null,
                "renderDuration": null,
                "userName": "xiaoguotu_ljian",
                "producer": null,
                "taskLevel": 79,
                "taskUserLevel": 0,
                "taskLimit": 200,
                "taskOverTime": null,
                "userId": 10001520,
                "outputFileName": null,
                "munuTaskId": "",
                "layerParentId": 0,
                "cgId": 2001,
                "taskKeyValueVo": {
                            "tiles": null,
                            "allCamera": null,
                            "renderableCamera": null
                        },
                "userAccountConsume": null,
                "couponConsume": null,
                "isOpen": 1,
                "taskType": "",
                "renderCamera": "VRayCam003",
                "cloneParentId": null,
                "cloneOriginalId": null,
                "shareMainCapital": 0,
                "taskRam": null,
                "respRenderingTaskList": [
                    {
                        "sceneName": "衣帽间.max",
                        "id": 18280,
                        "taskAlias": "P18280",
                        "taskStatus": 25,
                        "statusText": "render_task_status_25",
                        "preTaskStatus": null,
                        "preStatusText": null,
                        "totalFrames": 1,
                        "abortFrames": 0,
                        "executingFrames": 0,
                        "doneFrames": 1,
                        "failedFrames": 0,
                        "framesRange": "0",
                        "projectName": "",
                        "renderConsume": 1.57,
                        "taskArrears": 0,
                        "submitDate": 1535602289000,
                        "startTime": 1535602601000,
                        "completedDate": 1535603874000,
                        "renderDuration": 1176,
                        "userName": "xiaoguotu_ljian",
                        "producer": null,
                        "taskLevel": 79,
                        "taskUserLevel": 0,
                        "taskLimit": 200,
                        "taskOverTime": 86400000,
                        "userId": 10001520,
                        "outputFileName": "18280_衣帽间",
                        "munuTaskId": "2018083000075",
                        "layerParentId": 18278,
                        "cgId": 2001,
                        "taskKeyValueVo": {
                            "tiles": null,
                            "allCamera": null,
                            "renderableCamera": null
                        },
                        "userAccountConsume": 0,
                        "couponConsume": 1.57,
                        "isOpen": 0,
                        "taskType": "RenderPhoton",
                        "renderCamera": "VRayCam003",
                        "cloneParentId": 0,
                        "cloneOriginalId": 0,
                        "shareMainCapital": 0,
                        "taskRam": null,
                        "respRenderingTaskList": null,
                        "layerName": null,
                        "taskTypeText": "render_photons_task",
                        "isDelete": 1
                    },
                    {
                        "sceneName": "衣帽间.max",
                        "id": 18281,
                        "taskAlias": "P18281",
                        "taskStatus": 25,
                        "statusText": "render_task_status_25",
                        "preTaskStatus": null,
                        "preStatusText": null,
                        "totalFrames": 17,
                        "abortFrames": 0,
                        "executingFrames": 0,
                        "doneFrames": 17,
                        "failedFrames": 0,
                        "framesRange": "0",
                        "projectName": "",
                        "renderConsume": 6.7,
                        "taskArrears": 0,
                        "submitDate": 1535602289000,
                        "startTime": 1535603885000,
                        "completedDate": 1535604765000,
                        "renderDuration": 5028,
                        "userName": "xiaoguotu_ljian",
                        "producer": null,
                        "taskLevel": 79,
                        "taskUserLevel": 0,
                        "taskLimit": 200,
                        "taskOverTime": 86400000,
                        "userId": 10001520,
                        "outputFileName": "18281_衣帽间",
                        "munuTaskId": "2018083000079",
                        "layerParentId": 18278,
                        "cgId": 2001,
                        "taskKeyValueVo": {
                            "tiles": null,
                            "allCamera": null,
                            "renderableCamera": null
                        },
                        "userAccountConsume": 0,
                        "couponConsume": 6.7,
                        "isOpen": 0,
                        "taskType": "Render",
                        "renderCamera": "VRayCam003",
                        "cloneParentId": 0,
                        "cloneOriginalId": 0,
                        "shareMainCapital": 0,
                        "taskRam": null,
                        "respRenderingTaskList": null,
                        "layerName": null,
                        "taskTypeText": "render_major_picture_task",
                        "isDelete": 1
                    }
                ],
                "layerName": null,
                "taskTypeText": null,
                "isDelete": 1
            }
        ]
    },
    "serverTime": 1535964116655
}

停止任务

接口路径: /api/render/task/stopTask

请求参数

参数 类型 说明 备注
task_param_list List\<Integer> 任务号集合

返回参数:缺省

请求示例

stop_task = api.task.stop_task(task_param_list=[13798105])

返回示例

{
    "version": "1.0.0",
    "result": true,
    "message": "success",
    "code": 200,
    "data": null,
    "serverTime": 1535957894211
}

开始任务

接口路径:/api/render/task/startTask

请求参数

参数 类型 说明 备注
task_param_list List\<Integer> 任务号集合

返回参数:缺省

请求示例

start_task = api.task.start_task(task_param_list=[13798105])

返回示例

{
    "version": "1.0.0",
    "result": true,
    "message": "success",
    "code": 200,
    "data": null,
    "serverTime": 1535957894211
}

放弃任务

接口路径:/api/render/task/abortTask

请求参数

参数 类型 说明 备注
task_param_list List\<Integer> 任务号集合

返回参数:缺省

请求示例

abort_task = api.task.abort_task(task_param_list=[13798105])

返回示例

{
    "version": "1.0.0",
    "result": true,
    "message": "success",
    "code": 200,
    "data": null,
    "serverTime": 1535957894211
}

删除任务

接口路径:/api/render/task/deleteTask

请求参数

参数 类型 说明 备注
task_param_list List\<Integer> 任务号集合

返回参数:缺省

请求示例

delete_task = api.task.delete_task(task_param_list=[13798105])

返回示例

{
    "version": "1.0.0",
    "result": true,
    "message": "success",
    "code": 200,
    "data": null,
    "serverTime": 1535957894211
}

获取任务渲染帧详情

接口路径:/api/render/task/queryTaskFrames

请求参数

参数 类型 说明 备注
task_id Integer 任务ID号 任务ID号,是任务的唯一标识,必填字段
search_keyword String 非必须,根据一机渲多帧名进行查询 是一个字符串,根据一机渲多帧名这个字段名进行查询,选填
page_num Integer 当前页编号 -
page_size Integer 每页显示数据大小 -

返回参数:List<FrameInfo>

参数 类型 说明 备注
id
userId Long 用户ID
framePrice Double 渲染价格
feeType Integer 扣费类型 0 按量,1 包机,2 包项目
platform Integer 平台
frameIndex String 帧序列名
frameBlock String 当前帧块数
frameStatus Integer 当前帧状态 1/等待中,2/正在执行中,3/停止,4/完成,5/失败,6/等待预处理完成,7/等待光子帧渲染完成,8/等待优先渲染完成,9/等待光子作业渲染完成,10/等待结算作业渲染完成,11/任务超时
feeAmount Double 余额扣费
couponFee Double 代金券扣费
startTime Long 开始时间(毫秒)
endTime Long 结束时间(毫秒)
frameExecuteTime Long 渲染帧耗时
frameStatusText String 帧状态描述
arrearsFee Double 渲染帧欠费金额
taskId Long 任务ID
frameType Integer 帧类型 1/预渲染(只有一帧,多相机情况也只有一帧),2/光子帧,3/合并光子帧,4/优先帧,5/渲染主图帧,6/maya/max优先渲染合成帧,7/maya/max渲染主图合成帧,8/houdini结算帧,9/max通道帧
recommitFlag Integer 重提次数 重提标识默认是0,按次数递增
taskOverTime Integer 超时时间 帧超时时间
gopName String houdini结算节点名称
frameRam Integer 帧任务渲染内存 如果为空说明没有内存要求

请求示例

task_frame = api.query.task_frames(task_id=13790691, page_num=1, page_size=1)

返回示例

{
    "version": "1.0.0",
    "result": true,
    "message": "success",
    "code": 200,
    "data": {
        "pageCount": 9,
        "pageNum": 1,
        "total": 17,
        "size": 2,
        "items": [
            {
                "id": 1546598,
                "userId": null,
                "framePrice": null,
                "feeType": null,
                "platform": null,
                "frameIndex": "0-1",
                "frameStatus": 4,
                "feeAmount": 0.44,
                "startTime": 1535960273000,
                "endTime": 1535960762000,
                "frameExecuteTime": 489,
                "frameStatusText": "task_frame_status_4",
                "arrearsFee": null,
                "munuJobId": "0",
                "taskId": 19088,
                "munuTaskId": "2018090300040",
                "frameType": 5,
                "couponFee": 0,
                "recommitFlag": 0,
                "isCopy": null,
                "frameBlock": "1",
                "taskOverTime": 86400000,
                "gopName": null,
                "frameRam": null
            },
            {
                "id": 1546599,
                "userId": null,
                "framePrice": null,
                "feeType": null,
                "platform": null,
                "frameIndex": "0-2",
                "frameStatus": 4,
                "feeAmount": 0.43,
                "startTime": 1535960856000,
                "endTime": 1535961338000,
                "frameExecuteTime": 482,
                "frameStatusText": "task_frame_status_4",
                "arrearsFee": null,
                "munuJobId": "1",
                "taskId": 19088,
                "munuTaskId": "2018090300040",
                "frameType": 5,
                "couponFee": 0,
                "recommitFlag": 0,
                "isCopy": null,
                "frameBlock": "2",
                "taskOverTime": 86400000,
                "gopName": null,
                "frameRam": null
            }
        ]
    },
    "serverTime": 1535966967143
}

获取任务总渲染帧概况

接口路径:/api/render/task/queryAllFrameStats

请求参数:缺省

返回参数

参数 类型 说明 备注
executingFramesTotal Integer 渲染中帧数
doneFramesTotal Integer 完成帧数
failedFramesTotal Integer 失败帧数
waitingFramesTotal Integer 等待帧数
abandonFramesTotal Integer 放弃帧数
totalFrames Integer 渲染总帧数

请求示例

all_frame_status = api.query.all_frame_status()

返回示例

{
    "version": "1.0.0",
    "result": true,
    "message": "success",
    "code": 200,
    "data": {
        "executingFramesTotal": 1,
        "doneFramesTotal": 308,
        "failedFramesTotal": 2,
        "waitingFramesTotal": 153,
        "abandonFramesTotal": 113,
        "totalFrames": 577
    },
    "serverTime": 1535968038725
}

重提失败帧

接口路径: /api/render/task/restartFailedFrames

请求参数

参数 类型 说明 备注
task_param_list List\<Integer> 任务号集合

返回参数:缺省

请求示例

restart_failed_frames = api.query.restart_failed_frames(task_param_list=[13788981])

返回示例

{
    "version": "1.0.0",
    "result": true,
    "message": "success",
    "code": 200,
    "data": null,
    "serverTime": 1535957894211
}

重提任务指定帧

接口路径: /api/render/task/restartFrame

请求参数

参数 类型 说明 备注
task_id Integer 任务ID
ids_list List\<Integer> 帧ID集合 select_all为0时生效
select_all Integer 是否全部重提 1全部重提,0指定帧重提

返回参数:缺省

请求示例

restart_frame = api.query.restart_frame(task_id=14362099, select_all=1)

返回示例

{
    "version": "1.0.0",
    "result": true,
    "message": "success",
    "code": 200,
    "data": null,
    "serverTime": 1535957894211
}

获取任务详情

接口路径:/api/render/task/queryTaskInfo

请求参数

参数 类型 说明 备注
task_ids_list List\<Integer> 壳任务ID集合

返回参数:List<TaskInfo>

参数 类型 说明 备注
sceneName String 场景名
id Integer 任务id
taskAlias String 任务别名
taskStatus Byte 任务状态 1/等待中,5/渲染中,10/停止中,15/用户停止, 20/欠费停止,25/已完成,30/已完成有失败帧, 35/放弃,40/测试完成,45/失败
statusText String 任务状态文本
preTaskStatus Byte 预处理任务状态
preStatusText String 预处理状态文本
totalFrames Integer 总帧数
abortFrames Integer 放弃帧数
executingFrames Integer 正在运行的帧数
doneFrames Integer 完成的帧数
failedFrames Integer 失败帧数
framesRange String 帧范围
projectName String 项目名
renderConsume BigDecimal 任务渲染消费的总费用
taskArrears BigDecimal 任务欠费金额
submitDate Date 提交时间
startTime Date 开始时间
completedDate Date 完成时间
renderDuration Long 任务渲染总时长 单位:秒
userName String 用户名
producer String 制作人
taskLevel Byte 任务优先级
taskUserLevel Integer 用户层面的优先级
taskLimit Integer 任务机器限制
taskOverTime Long 任务超时提醒
outputFileName String 输出文件名
munuTaskId String 调度器id
layerParentId String 针对maya任务,层父id
cgId Integer 任务类型 2001/maya,2000/max
taskKeyValueVo Object 任务关键字集合
userAccountConsume Bigdecimal 用户账户扣费
couponConsume Bigdecimal 优惠券扣费
isOpen Byte 前端的展开按钮是否展开
taskType String 任务类型 /预处理,/光子渲染,/渲染主图
renderCamera String 渲染相机
cloneParentId Integer 克隆任务挂在那个任务下的id
cloneOriginalId Integer 从哪个任务克隆的
shareMainCapital Byte 该任务是否共享主账号资产 (0 不共享 1共享)
taskRam Integer 任务渲染内存
respRenderingTaskList List\<TaskInfo> 展开的任务的子任务 跟此对象一样
layerName String 层名
taskTypeText String 任务类型 光子/主图
isDelete Byte 是否删除 0:已删除,1:未删除

请求示例

task_info = api.query.task_info(task_ids_list=[14400249])

返回示例

{
    "version": "1.0.0",
    "result": true,
    "message": "success",
    "code": 200,
    "data": {
        "pageCount": 1,
        "pageNum": 1,
        "total": 1,
        "size": 100,
        "items": [
            {
                "sceneName": "test_no_randerman_175.hip",
                "id": 14400249,
                "taskAlias": "2W14400249",
                "taskStatus": 25,
                "statusText": "render_task_status_25",
                "preTaskStatus": null,
                "preStatusText": null,
                "totalFrames": 1,
                "abortFrames": 0,
                "executingFrames": 0,
                "doneFrames": 1,
                "failedFrames": 0,
                "framesRange": "/out/geometry110-200[1]",
                "projectName": "analysis_multi_project_empty_placeholder",
                "renderConsume": 0.0,
                "taskArrears": 0.0,
                "submitDate": 1577765849000,
                "startTime": 1577765851000,
                "completedDate": 1577766104000,
                "renderDuration": 13,
                "userName": "ding625yutao",
                "producer": "丁玉涛",
                "taskLevel": 81,
                "taskUserLevel": 0,
                "taskLimit": 1,
                "taskOverTime": 43200,
                "overTimeStop": 86400,
                "userId": 100150764,
                "outputFileName": "14400249_test_no_randerman_175",
                "munuTaskId": "2019123100841",
                "munuTaskIds": "2019123100841",
                "layerParentId": 0,
                "cgId": 2004,
                "userAccountConsume": 0.0,
                "couponConsume": 0.039,
                "qyCouponConsume": null,
                "isOpen": 0,
                "taskType": "GopRender",
                "renderCamera": "",
                "cloneParentId": 0,
                "cloneOriginalId": 0,
                "shareMainCapital": 0,
                "taskRam": 64,
                "respRenderingTaskList": null,
                "layerName": "",
                "taskTypeText": null,
                "locationOutput": "C:/RenderFarm/Download",
                "isDelete": 1,
                "channel": 1,
                "remark": "",
                "labels": "{}",
                "isOverTime": 0,
                "taskKeyValueVo": {
                    "tiles": null,
                    "allCamera": null,
                    "renderableCamera": null
                },
                "waitingCount": null,
                "stopType": 0
            }
        ]
    },
    "serverTime": 1578046630345,
    "requestId": "py6RCN-VGFzay1TZXJ2aWNlMDc-1578046630330"
}

添加自定义标签

接口路径:/api/render/common/addLabel

请求参数

参数 类型 说明 备注
new_name String 标签名 名称唯一性
status Integer 标签状态 0:开启,1:关闭,默认为1

返回参数:缺省

请求示例

task_info = api.tag.add_label(new_name="test_tag4", status=0)

返回示例

{
    "version": "1.0.0",
    "result": true,
    "message": "success",
    "code": 200,
    "data": null,
    "serverTime": 1535957894211
}

删除自定义标签

**接口路径: **/api/render/common/deleteLabel

请求参数

参数 类型 说明 备注
del_name String label名

返回参数:缺省

请求示例

delete_label_name = api.tag.delete_label(del_name="test_tag2")

返回示例

{
    "version": "1.0.0",
    "result": true,
    "message": "success",
    "code": 200,
    "data": null,
    "serverTime": 1535957894211
}

获取自定义标签

接口路径: /api/render/common/getLabelList

请求参数:缺省

返回参数:缺省

参数 类型 说明 备注
projectNameList List\<Object> 项目list
Object.projectName String 项目名
Object.projectId Integer 项目id

请求示例:缺省

label_list = api.tag.get_label_list()

返回示例

{
    "version": "1.0.0",
    "result": true,
    "message": "success",
    "code": 200,
    "data": {
        "projectNameList": [
            {
                "projectId": 3671,
                "projectName": "myLabel"
            }
        ]
    },
    "serverTime": 1546998557770
}

获取支持的渲染软件

接口路径:/api/render/common/querySupportedSoftware

请求参数:缺省

返回参数

参数 类型 说明 备注
isAutoCommit Integer 是否自动提交
renderInfoList List\<Software> 渲染器版本信息集合
defaultCgId Integer 默认渲染器ID

Software

参数 类型 说明 备注
cgId Integer 渲染软件ID
cgName String 渲染软件名
cgType String 渲染文件后缀支持
iconPath String 渲染软件图标地址
isNeedProjectPath Integer
isNeedAnalyse Integer 是否需要分析
isSupportLinux Integer 是否支持linux

请求示例

support_software = api.query.supported_software()

返回示例

{
    "version": "1.0.0",
    "result": true,
    "message": "success",
    "code": 200,
    "data": {
        "isAutoCommit": 2,
        "renderInfoList": [
            {
                "cgId": 2000,
                "cgName": "Maya",
                "cgType": "ma;mb",
                "iconPath": "/img/softimage/maya.png",
                "isNeedProjectPath": 1,
                "isNeedAnalyse": 1,
                "isSupportLinux": 1
            },
            {
                "cgId": 2001,
                "cgName": "3ds Max",
                "cgType": "max",
                "iconPath": "/img/softimage/max.png",
                "isNeedProjectPath": 1,
                "isNeedAnalyse": 1,
                "isSupportLinux": 0
            },
            {
                "cgId": 2004,
                "cgName": "Houdini",
                "cgType": "hip;hipnc;hiplc",
                "iconPath": "/img/softimage/houdini.png",
                "isNeedProjectPath": 2,
                "isNeedAnalyse": 1,
                "isSupportLinux": 1
            },
            {
                "cgId": 2005,
                "cgName": "Cinema 4D",
                "cgType": "c4d",
                "iconPath": "/img/softimage/cinema-4D.png",
                "isNeedProjectPath": 1,
                "isNeedAnalyse": 1,
                "isSupportLinux": 0
            },
            {
                "cgId": 2007,
                "cgName": "Blender",
                "cgType": "blend",
                "iconPath": "/img/softimage/blender.png",
                "isNeedProjectPath": 1,
                "isNeedAnalyse": 1,
                "isSupportLinux": 0
            },
            {
                "cgId": 2008,
                "cgName": "VR Standalone",
                "cgType": "vrscene",
                "iconPath": "/img/softimage/VR-standalone.png",
                "isNeedProjectPath": 3,
                "isNeedAnalyse": 2,
                "isSupportLinux": 0
            },
            {
                "cgId": 2012,
                "cgName": "KeyShot",
                "cgType": "bip",
                "iconPath": "/img/softimage/keyshot.png",
                "isNeedProjectPath": 2,
                "isNeedAnalyse": 1,
                "isSupportLinux": 0
            },
            {
                "cgId": 2013,
                "cgName": "Clarisse",
                "cgType": "project;render",
                "iconPath": "/img/softimage/clarisse.png",
                "isNeedProjectPath": 3,
                "isNeedAnalyse": 1,
                "isSupportLinux": 1
            }
        ],
        "defaultCgId": 2001
    },
    "serverTime": 1578048938715,
    "requestId": "W12mkM-VGFzay1TZXJ2aWNlMDc-1578048938685"
}

获取支持的渲染软件插件

接口路径: /api/render/common/querySupportedPlugin

请求参数

参数 类型 说明 备注
name String 渲染软件ID

返回参数

参数 类型 说明 备注
cgPlugin List\<Plugin> 支持插件集合
cgVersion List\<SoftVersion> 支持软件版本集合

Plugin

参数 类型 说明 备注
cvId Integer 渲染软件版本ID(SoftVersion.id)
pluginName String  插件名
pluginVersions List\<PluginVersion> 插件版本集合

PluginVersion

参数 类型 说明 备注
pluginId Integer 插件版本ID 
pluginName String  插件名
pluginVersion  String  插件版本

SoftVersion

参数 类型 说明 备注
id Integer 渲染软件版本ID 
cgId Integer  渲染软件ID
cgName String 渲染软件名
cgVersion String 渲染软件版本

请求示例

support_software_plugin = api.query.supported_plugin(name='maya')

返回示例

{
    "version": "1.0.0",
    "result": true,
    "message": "success",
    "code": 200,
    "data": {
        "isAutoCommit": 2,
        "renderInfoList": [
            {
                "cgId": 2000,
                "cgName": "Maya",
                "cgType": "ma;mb",
                "iconPath": "/img/softimage/maya.png",
                "isNeedProjectPath": 3,
                "isNeedAnalyse": 1,
                "isSupportLinux": 1
            }
        ],
        "defaultCgId": 2001
    },
    "serverTime": 1535973558961
}

新增用户渲染环境配置

接口路径: /api/render/common/addRenderEnv

请求参数

参数 类型 说明 备注
render_env Dict 详细参数参考以下

render_env

参数 类型 说明 备注
cgId Integer 渲染软件ID SoftVersion.cgId
cgName String 渲染软件名称 SoftVersion.cgName
cgVersion String 渲染软件版本 SoftVersion.cgVersion
renderLayerType Integer maya渲染类型
editName String 渲染环境自定义名
renderSystem String 渲染系统 0 linux, 1 windows
pluginIds List\<Integer> 渲染插件集合 PluginVersion.pluginId

返回参数

参数 类型 说明 备注
editName String 渲染环境自定义名

请求示例

env = {
    "cgId": 2000,
    "cgName": "Maya",
    "cgVersion": "2020",
    "renderLayerType": 0,
    "editName": "testRenderEnv",
    "renderSystem": "0",
    "pluginIds": [1166]
}
add_user_env = api.env.add_render_env(render_env=env)

返回示例

{
    "version": "1.0.0",
    "result": true,
    "message": "success",
    "code": 200,
    "data": {
		"editName": "testRenderEnv"
	},
    "serverTime": 1535957894211
}

修改用户渲染环境配置

接口路径:/api/render/common/updateRenderEnv

请求参数

参数 类型 说明 备注
render_env Dict 必须参数 详细参数参考以下

render_env

参数 类型 说明 备注
cgId Integer 渲染软件ID SoftVersion.cgId
cgName String 渲染软件名称 SoftVersion.cgName
cgVersion String 渲染软件版本 SoftVersion.cgVersion
renderLayerType Integer maya渲染类型
editName String 渲染环境自定义名  修改是必须传递已经存在的配置名称
renderSystem Integer 渲染系统 0 linux, 1 windows
pluginIds List\<Integer> 渲染插件集合 PluginVersion.pluginId

返回参数:缺省

请求示例

update_env = {
    "cgId": 2000,
    "cgName": "Maya",
    "cgVersion": "2020",
    "renderLayerType": 0,
    "editName": "testRenderEnv",
    "renderSystem": "0",
    "pluginIds": []
}
update_user_env = api.env.update_render_env(render_env=update_env)

返回示例

{
    "version": "1.0.0",
    "result": true,
    "message": "success",
    "code": 200,
    "data": null,
    "serverTime": 1536027063801
}

删除用户渲染环境配置

接口路径:/api/render/common/deleteRenderEnv

请求参数

参数 类型 说明 备注
edit_name String 必须,渲染环境自定义名

返回参数:缺省

请求示例

delete_user_env = api.env.delete_render_env(edit_name="testRenderEnv")

返回示例

{
    "version": "1.0.0",
    "result": true,
    "message": "success",
    "code": 200,
    "data": null,
    "serverTime": 1536027063801
} 

设置默认渲染环境配置

接口路径:/api/render/common/setDefaultRenderEnv

请求参数

参数 类型 说明 备注
edit_name String 渲染环境自定义名

返回参数

请求示例

set_default_user_env = api.env.set_default_render_env(edit_name="testRenderEnv")

返回示例

{
    "version": "1.0.0",
    "result": true,
    "message": "success",
    "code": 200,
    "data": null,
    "serverTime": 1536027063801
}

获取用户渲染环境配置

接口路径:/api/render/common/getRenderEnv

请求参数

参数 类型 说明 备注
name String 渲染软件名

返回参数:List<RenderEnv>

参数 类型 说明 备注
cgId Integer 渲染软件ID
editName String 渲染环境自定义名
cgName String 渲染软件名
cgVersion String 渲染软件版本
osName Integer 渲染环境系统 0Linux,1windows
renderLayerType Integer
isDefault Integer 是否是默认配置 0不是默认配置 1是默认配置
respUserPluginInfoVos List\<PluginVersion> 渲染环境插件集合

请求示例

user_render_config = api.env.get_render_env(name='houdini')

返回示例

{
    "version": "1.0.0",
    "result": true,
    "message": "success",
    "code": 200,
    "data": [
        {
            "cgId": 2004,
            "editName": "175",
            "cgName": "Houdini",
            "cgVersion": "17.5",
            "osName": 1,
            "renderLayerType": 0,
            "isDefault": 0,
            "projectPath": "",
            "isMainUserId": 1,
            "respUserPluginInfoVos": [
                {
                    "pluginId": 5304,
                    "pluginName": "renderman",
                    "pluginVersion": "renderman 22.6"
                }
            ]
        },
        {
            "cgId": 2004,
            "editName": "pianwan",
            "cgName": "Houdini",
            "cgVersion": "17.5",
            "osName": 1,
            "renderLayerType": 0,
            "isDefault": 0,
            "projectPath": "",
            "isMainUserId": 1,
            "respUserPluginInfoVos": []
        },
        {
            "cgId": 2004,
            "editName": "houdini_test",
            "cgName": "Houdini",
            "cgVersion": "17.5",
            "osName": 0,
            "renderLayerType": 0,
            "isDefault": 0,
            "projectPath": "",
            "isMainUserId": 1,
            "respUserPluginInfoVos": []
        },
        {
            "cgId": 2004,
            "editName": "16.5",
            "cgName": "Houdini",
            "cgVersion": "16.5",
            "osName": 1,
            "renderLayerType": 0,
            "isDefault": 0,
            "projectPath": "",
            "isMainUserId": 1,
            "respUserPluginInfoVos": []
        }
    ],
    "serverTime": 1578282315348,
    "requestId": "23IhQf-VGFzay1TZXJ2aWNlMDQ-1578282315343"
}

任务进度图(仅限Max任务)

接口路径:/api/render/task/loadTaskProcessImg

请求参数

参数 类型 说明 备注
task_id Integer 任务号 必须
frame_type Integer 渲染类型 非必须,2表示光子帧,5获取主图进度,不传后台将根据渲染任务的阶段动态的返回结果

返回参数

参数 类型 说明 备注
 width Integer 图片分辨率高度 
height  Integer  图片分辨率宽度
block Integer 分块数
isRenderPhoton Boolean 是否渲染光子 true表示任务渲染了光子
currentTaskType String 当前任务的渲染状态 Render: 渲染主图 RenderPhoton: 渲染光子
sceneName String 渲染场景名+相机名
startTime String 任务开始时间
endTime String 任务结束时间
grabInfo List\<List\<Object>> 分块帧详情

分块帧详情:grabInfo

参数 类型 说明 备注
startTime String 开始时间
endTime String 结束时间
frameStatus String 帧状态
isMaxPrice String 是否封顶价
feeAmount String 余额扣费
couponFee String 优惠券扣费
frameIndex String 帧数
frameBlock String 帧块数
framePercent String 帧渲染百分比
frameUsed String 帧渲染已消耗时间
frameEst String 帧渲染预计剩余时间
renderInfo String 帧渲染进度信息
grabUrl String 帧渲染进度图连接地址

请求示例

task_processing_img = api.query.get_task_processing_img(task_id=14470635, frame_type=2)

返回示例

{
    "version": "1.0.0",
    "result": true,
    "message": "success",
    "code": 200,
    "data": {
        "isRenderPhoton": true,
        "completedTime": "2020-01-03 10:02:55",
        "currentTaskType": "RenderPhoton",
        "sceneName": "翻新就沙发.max-Camera001",
        "grabInfo": [
            [
                {
                    "couponFee": "1.04",
                    "frameIndex": "0",
                    "renderInfo": "",
                    "frameBlock": null,
                    "frameEst": "0",
                    "grabUrl": "/mnt/output/d2_1/small_pic/100033000/100033433/14470635/RenderPhoton_2020010200306_0_rayvision0000[-]tga.jpg",
                    "feeAmount": "0.00",
                    "frameUsed": "174",
                    "frameStatus": "4",
                    "framePercent": "100",
                    "isMaxPrice": "0",
                    "startTime": "2020-01-03 09:57:18",
                    "endTime": "2020-01-03 10:00:12"
                }
            ]
        ],
        "width": 700,
        "block": 1,
        "startTime": "2020-01-02 09:35:51",
        "height": 518
    },
    "serverTime": 1578299393862,
    "requestId": "qELLr0-VGFzay1TZXJ2aWNlMDc-1578299393837"
}

设置任务超时停止时间

接口地址:/api/render/task/setOverTimeStop

请求参数

参数 类型 是否必须(Y/N) 说明
task_id_list List\<Integer> Y 任务号
overtime Long Y 超时停止时间,单位秒

请求参数示例

set_task_overtime = api.task.set_task_overtime_top(task_id_list=[14684405], overtime=60)

返回示例

{
    "version": "1.0.0",
    "result": true,
    "message": "success",
    "code": 200,
    "data": "SUCCESS",
    "serverTime": 1578308287155,
    "requestId": "8VNTma-VGFzay1TZXJ2aWNlMDc-1578308286842"
}

加载缩略图

接口地址:/api/render/task/loadingFrameThumbnail

请求参数

参数 类型 是否必须(Y/N) 说明
frame_id Integer 帧id号,可通过<获取任务渲染帧详情接口>获取
frame_status Integer 这里传4(完成),只有完成有缩略图

请求示例

frame_thumbnall = api.query.get_frame_thumbnall(frame_id=230772361)

返回结果

{
    "version": "1.0.0",
    "result": true,
    "message": "success",
    "code": 200,
    "data": [
        "/mnt/output/d2_0/small_pic/100150500/100150764/13652193/2019121801523_10.60.200.102_d_inputdata5_100150500_100150764_D_houdini_CG file_Cam003_render_box_frgbg_render_box_frgbg_render[-]0001[-]exr.jpg"
    ],
    "serverTime": 1578310367990,
    "requestId": "QGyi8q-VGFzay1TZXJ2aWNlMDc-1578310367981"
}

获取镭速传输信息

接口地址:api/render/task/getTransferServerMsg

请求参数:缺省

请求示例

transfer_server_msg = api.query.get_transfer_server_msg()

返回参数

{
    "version": "1.0.0",
    "result": true,
    "message": "success",
    "code": 200,
    "data": {
        "clientVersion": "3.2.8.2",
        "protocolVersion": "3.2.8.2",
        "raysyncTransfer": {
            "serverIp": "127.0.0.1",
            "serverPort": 2121,
            "proxyIp": "42.123.110.38",
            "proxyPort": 32001,
            "sslPort": 2443,
            "port": 2442
        }
    },
    "serverTime": 1565678980735,
    "requestId": "YenJW9-1565678980088"
}

获取镭速验证key

接口地址:/api/render/user/getRaySyncUserKey

请求参数:缺省

请求示例

raysync_user_key = api.query.get_raysync_user_key()

返回参数

{
	"version": "1.0.0",
	"result": true,
	"message": "success",
	"code": 200,
	"data": {
		"channel": 2,
		"platform": 2,
		"signature": "rayvision2017",
		"version": "1.0.0",
		"userKey": "5394a44e890557d8d937b92086482dab",
		"id": 1868599,
		"userName": "wsh_12345",
		"zone": 1,
		"phone": "183160224171",
		"email": "testwangshunhui@rayvision",
		"loginTime": 1565682011157,
		"infoStatus": 0,
		"accountType": 2,
		"shareMainCapital": 0,
		"subDeleteTask": 0,
		"subDeleteCapital": 1,
		"useMainBalance": 0,
		"downloadDisable": 0,
		"raySyncUserKey": "40d59041f72809ffaa16146a36780595666c681e"
	},
	"serverTime": 1565682019430,
	"requestId": "4lkn0I-1565682010026"
}

全速渲染

接口地址:/api/render/task/fullSpeed

请求参数

参数 类型 是否必须(Y/N) 说明
task_id_list List\<Integer> 作业id

请求示例

full_speed_render = api.task.full_speed(task_id_list=[13652193])

返回参数示例:

{
    "version": "1.0.0",
    "result": true,
    "message": "success",
    "code": 200,
    "data": "成功",
    "serverTime": 1578311448826,
    "requestId": "X81MN5-VGFzay1TZXJ2aWNlMDQ-1578311448620"
}

日志管理

警告

请确保本地python环境和PIP工具能够正常使用。

演示demo

学习的最好方法就是参考例子,rayvision_log 也不例外,我们也提供了下面的一个使用 demo 样例供您参考:

import logging
from rayvision_log import init_logger

package_name = 'mylog'
init_logger(package_name)
logging.info('test')

日志路径设置

  1. 默认路径

Mac OS X:

~/Library/Logs/<AppName>/Logs/<username>/<hostname>.log

Unix:

~/.cache/<AppName>/log/Logs/<username>/<hostname>.log

Window:

C:\Users\<username>\AppData\Local\<AppAuthor>\<AppName>\Logs\<username>\<hostname>.log
  1. 自定义路径
  • 定义参数: RAYVISION_LOG_ROOT = "xxxx"
  • RAYVISION_LOG_ROOT 设置为系统环境变量
  • 日志路径将会保存在 RAYVISION_LOG_ROOT 文件夹下

日志接口

Basic logging setup.

rayvision_log.core.get_default_log_config()

Get the default logging configuration.

返回:The default logging configuration.
返回类型:dict
rayvision_log.core.init_logger(app_name)

Initialize logging with our default configuration.

An easier interface for artists to use to create loggers in their packages and applications. Any application that uses this will use the default logging configuration.

实际案例

>>> import logging
>>> from rayvision_log import init_logger
>>> app_name = "rayvision_api"
>>> init_logger(app_name)
>>> LOG = logging.getLogger(app_name)
参数:app_name (str) -- The application or package name for which to create a logger.
rayvision_log.core.set_up_logger(app_name, log_config)

Set up loggers based on given name and configuration.

Example

>>> app_name = "rayvision_api"
>>> log_config = {
                    formatters: {
                        file: {
                            format: '%(asctime)s [%(levelname)s] %(name)s: %(message)s'
                        }
                    },
                    handlers: {
                        file: {
                            class: concurrent_log_handler.ConcurrentRotatingFileHandler
                        }
                    }
                }
参数:
  • app_name (str) -- Name of the application.
  • log_config (dict) -- The configuration of the logger.

References

https://pypi.org/project/ConcurrentLogHandler/

注解

主要是校验分析结果

任务的信息校验

主要是检查任务信息(task_info)和上传(upload)资产信息, 不管是使用SDK的自动化分析还是用户自定义本地分析,最后得到的配置信息 都必须进行这一步的信息校验。

Check the analysis results.

Check the analysis of the task information and upload asset information.

class rayvision_api.task.check.RayvisionCheck(api, analyze=None, workspace=None)

基类:object

Check the analysis results.

check_analyze(analyze, workspace, is_cover=True)

Initializes the configuration file information.

check_error_warn_info(language='0')

Check the error in the analysis scenario.

According to the status code of the analyzed error information, the API interface is called to obtain detailed error information and solutions, and the warning information is printed out, and the number of error information is recorded.

参数:
  • language (str) -- The language that identifies the details of the
  • obtained, 0 (error) -- Chinese (default) 1: English.
返回:

List of detailed descriptions of errors.

返回类型:

list

static check_path(tmp_path)

Check if the path exists.

check_task_info(task_info)

Check and add the required parameter information.

check_workspace(workspace)

Check the working environment.

参数:workspace (str) -- Workspace path.
返回:Workspace path.
返回类型:str
execute(task_json, upload_json='', asset_json='', is_cover=True, only_id=True)

Check asset configuration information.

Check the scene for problems and filter unwanted configuration information. :param is_cover: Whether the updated json file overwrites the file under the original path,

by default 'True'.
get_json_info(data)
is_scene_have_error()

Check the scene.

Determine whether the scene has an error based on the number of serious errors.

Raises:RayvisionError -- There is a problem with the scene.
write(only_id=True)

Check and write to a json file.

上传

1. Upload文件切割

有的upload.json文件可能有多达数十万个资源, 这时候可能就需要对upload文件进行切割。
def cutting_upload(upload_path, max_resources_number=None, after_cutting_position=None):
    """Cut upload.json according to the number of custom files.

    Args:
        upload_path (str): upload.json absolute path.
        max_resources_number (int): Maximum number of resources in each upload file.
        after_cutting_position (str): save location of upload file generated after cutting.

    Returns:
        list: Absolute path of all upload files generated after cutting, excluding original upload files.
            e.g.:
                ['D:\\test\\test_upload\\1586250829\\upload_1.json',
                'D:\\test\\test_upload\\1586250829\\upload_2.json']

    """

使用样例:

from rayvision_sync.utils import cutting_upload
upload_pool = cutting_upload(r"D:\test\test_upload\1586250829\upload.json", max_resources_number=800)

2. 多线程上传

多个upload可以使用多线程并发上传
def multi_thread_upload(self, upload_pool, thread_num=10):
    """muti thread upload resource.

    Args:
        upload_pool (list or tuple): Store a list or ancestor of uploaded files.
        thread_num (int): Number of threads, 10 threads are enabled by default.
    """

使用样例:

from rayvision_api import RayvisionAPI
from rayvision_sync.upload import RayvisionUpload

api = RayvisionAPI(access_id="xxxxx",
                   access_key="xxxxx",
                   domain="task.renderbus.com",
                   platform="2")

UPLOAD = RayvisionUpload(api)
UPLOAD.multi_thread_upload(upload_pool, thread_num=20)

3. 使用线程池控制上传

并发上传还可以使用线程池的方式
def thread_pool_upload(self, upload_pool, pool_size=10):
    """Thread pool upload.

    Args:
        upload_pool (list or tuple): store a list or ancestor of uploaded files.
        pool_size (int): thread pool size, default is 10 threads.

    """
    pool = ThreadPoolExecutor(pool_size)
    for i in range(len(upload_pool)):
        pool.submit(self.upload_asset, upload_pool[i])
    pool.shutdown(wait=True)

使用样例:

from rayvision_api import RayvisionAPI
from rayvision_sync.upload import RayvisionUpload

api = RayvisionAPI(access_id="xxxxx",
                   access_key="xxxxx",
                   domain="task.renderbus.com",
                   platform="2")

UPLOAD = RayvisionUpload(api)
UPLOAD.thread_pool_upload(upload_pool, pool_size=20)

4. 只上传upload里面资源

上传upload资源用户只需要登录即可
def upload_asset(self, upload_json_path, max_speed=None, is_db=True):
    """Run the cmd command to upload asset files.

    Args:
        upload_json_path (str): Path to the upload.json file.
        max_speed (str): Maximum transmission speed, default value
            is 1048576 KB/S.
        is_db (bool): Whether to produce local database record upload file.

    Returns:
        bool: True is success, False is failure.

    """

使用样例:

from rayvision_api import RayvisionAPI
from rayvision_sync.upload import RayvisionUpload

api = RayvisionAPI(access_id="xxxxx",
                   access_key="xxxxx",
                   domain="task.renderbus.com",
                   platform="2")
                   
UPLOAD = RayvisionUpload(api)
UPLOAD.upload_asset(r"D:\test\test_upload\1586250829\upload.json")

5. 只上传分析生成的json配置文件

def upload_config(self, task_id, config_file_list, max_speed=None):
    """Run the cmd command to upload configuration profiles.

    Args:
        task_id (str): Task id.
        config_file_list (list): Configuration file path list.
        max_speed (str): Maximum transmission speed, default value
            is 1048576 KB/S.

    Returns:
        bool: True is success, False is failure.

    """

使用样例:

from rayvision_api import RayvisionAPI
from rayvision_sync.upload import RayvisionUpload

api = RayvisionAPI(access_id="xxxxx",
                   access_key="xxxxx",
                   domain="task.renderbus.com",
                   platform="2")

CONFIG_PATH = [
    r"C:\workspace\work\tips.json",
    r"C:\workspace\work\task.json",
    r"C:\workspace\work\asset.json",
    r"C:\workspace\work\upload.json",
]

UPLOAD = RayvisionUpload(api)
UPLOAD.upload_config("5165465", CONFIG_PATH)

6. 先上传配置文件然后自动根据upload文件上传资源(任务号必须)

def upload(self, task_id, task_json_path, tips_json_path, asset_json_path,
           upload_json_path, max_speed=None):
    """Run the cmd command to upload the configuration file.

    Args:
        task_id (str, optional): Task id.
        task_json_path (str, optional): task.json file absolute path.
        tips_json_path (str, optional): tips.json file absolute path.
        asset_json_path (str, optional): asset.json file absolute path.
        upload_json_path (str, optional): upload.json file absolute path.
        max_speed (str): Maximum transmission speed, default value
            is 1048576 KB/S.

    Returns:
        bool: True is success, False is failure.

    """

使用样例:

from rayvision_api import RayvisionAPI
from rayvision_sync.upload import RayvisionUpload

api = RayvisionAPI(access_id="xxxxx",
                   access_key="xxxxx",
                   domain="task.renderbus.com",
                   platform="2")

CONFIG_PATH = [
    r"C:\workspace\work\tips.json",
    r"C:\workspace\work\task.json",
    r"C:\workspace\work\asset.json",
    r"C:\workspace\work\upload.json",
]

upload_obj = RayvisionUpload(api)
upload_obj.upload("5165465", **CONFIG_PATH)

下载

1. 以单帧为粒度渲染完成了自动下载(任务号必须)

def auto_download(self, task_id_list=None, max_speed=None,
                  print_log=False, sleep_time=10,
                  download_filename_format="true",
                  local_path=None):
    """Automatic download (complete one frame download).

    Wait for all downloads to update undownloaded records.

    Args:
        task_id_list (list of int): List of tasks ids that need to be
            downloaded.
        max_speed (str, optional): Download speed limit,
            The unit of 'max_speed' is KB/S,default value is 1048576 KB/S,
            means 1 GB/S.
        print_log (bool, optional): Print log, True: print, False: not
            print.
        sleep_time (int, optional): Sleep time between download,
            unit is second.
        download_filename_format: File download local save style,
            "true": tape task ID and scene name,
            "false" : download directly without doing processing.
        local_path (str): Download file locally save path,
            default Window system is "USERPROFILE" environment variable address splicing "renderfarm_sdk",
            Linux system is "HOME" environment variable address splicing "renderfarm_sdk".

    Returns:
        bool: True is success.

    """

使用样例

from rayvision_api import RayvisionAPI
from rayvision_sync.download import RayvisionDownload

api = RayvisionAPI(access_id="xxx",
                   access_key="xxx",
                   domain="task.renderbus.com",
                   platform="2")

download = RayvisionDownload(api)
download.auto_download([18164087], download_filename_format="false")

2. 以任务为粒度,当任务中帧全部渲染完成开始下载(任务号必须)

def auto_download_after_task_completed(self, task_id_list=None,
                                       max_speed=None, print_log=True,
                                       sleep_time=10,
                                       download_filename_format="true",
                                       local_path=None):
    """Auto download after the tasks render completed.

    Args:
        task_id_list(list of int): List of tasks ids that need to be
            downloaded.
        max_speed(str, optional): Download speed limit,
            The unit of 'max_speed' is KB/S,default value is 1048576 KB/S,
            means 1 GB/S.
        print_log(bool, optional): Print log, True: print, False: not
            print.
        sleep_time(int, optional): Sleep time between download,
            unit is second.
        download_filename_format: File download local save style,
            "true": tape task ID and scene name,
            "false" : download directly without doing processing.
        local_path (str): Download file locally save path,
            default Window system is "USERPROFILE" environment variable address splicing "renderfarm_sdk",
            Linux system is "HOME" environment variable address splicing "renderfarm_sdk".

    Returns:
        bool: True is success.

    """

使用样例

from rayvision_api import RayvisionAPI
from rayvision_sync.download import RayvisionDownload

api = RayvisionAPI(access_id="xxx",
                   access_key="xxx",
                   domain="task.renderbus.com",
                   platform="2")

download = RayvisionDownload(api)
download.auto_download_after_task_completed([18164087], download_filename_format="false")
  1. 用户自定义output server目录结构下载(任务号非必须)
def download(self, task_id_list=None,
             max_speed=None, print_log=True,
             download_filename_format="true",
             local_path=None, server_path=None):
    """Download and update the undownloaded record.

    Args:
        task_id_list (list of int): List of tasks ids that need to be
            downloaded.
        max_speed (str, optional): Download speed limit,
            The unit of ``max_speed`` is KB/S,default value is 1048576
            KB/S, means 1 GB/S.
        print_log (bool, optional): Print log, True: print, False: not
            print.
        download_filename_format: File download local save style,
            "true": tape task ID and scene name,
            "false" : download directly without doing processing.
        local_path (str): Download file locally save path,
            default Window system is "USERPROFILE" environment variable address splicing "renderfarm_sdk",
            Linux system is "HOME" environment variable address splicing "renderfarm_sdk",
        server_path (str or list): The user customizes the file structure to be downloaded from
            the output server, and all file structures are downloaded by default,
            example: "18164087_test/l_layer".

    Returns:
        bool: True is success.

    """

使用样例:

from rayvision_api import RayvisionAPI
from rayvision_sync.download import RayvisionDownload

api = RayvisionAPI(access_id="xxx",
                   access_key="xxx",
                   domain="task.renderbus.com",
                   platform="2")

download = RayvisionDownload(api)
download.download(download_filename_format="true", server_path="18164087_muti_layer_test/l_ayer2")

Maya

主要提供了调用maya分析工具对maya资源进行相关配置文件的分析, 分析的结果保存为本地json文件,在分析的过程中会对用户传入的初始 配置信息进行校验,校验合格才开始进行文件分析。

Clarisse

主要提供了调用clarisse分析工具对maya资源进行相关配置文件的分析, 分析的结果保存为本地json文件,在分析的过程中会对用户传入的初始 配置信息进行校验,校验合格才开始进行文件分析。

A interface for clarisse.

class rayvision_clarisse.analyse_clarisse.AnalyzeClarisse(cg_file, software_version, project_name=None, plugin_config=None, render_software='Clarisse', local_os=None, workspace=None, custom_exe_path=None, platform='2')

基类:object

add_tip(code, info)

Add error message.

参数:
  • code (str) -- error code.
  • info (str or list) -- Error message description.
analyse(no_upload=False)

Analytical master method for clarrise.

analyse_cg_file()

Start analyse cg file.

Examples cmd command:

"D:/myproject/internal_news/rayvision_clarisse/rayvision_clarisse /tool/Analyze.exe" -cf "E:/copy/DHGB_sc05_zhuta_610-1570_v0102.project" -tj

"c:/workspace/work/10398483/task.json"
static check_local_os(local_os)

Check the system name.

参数:local_os (str) -- System name.
返回:str
static check_path(tmp_path)

Check if the path exists.

check_result()

Check that the analysis results file exists.

check_workspace(workspace)

Check the working environment.

参数:workspace (str) -- Workspace path.
返回:Workspace path.
返回类型:str
gather_upload_dict()

Gather upload info.

实际案例

{
"asset": [
{
"local": "E:/copy/muti_layer_test.ma", "server": "/E/copy/muti_layer_test.ma"

}

]

}

get_file_md5(file_path)

Generate the md5 values for the scenario.

print_info(info)

Print info by logger.

参数:info (str) -- Output information.
print_info_error(info)

Print error info by logger.

参数:info (str) -- Output information.
save_tips()

Write the error message to tips.json.

write_task_json()

The initialization task.json.

write_tips_info()

Write tips info.

writing_error_abort(error_code, info=None)

Collect error abort to tips_info.

参数:
  • error_code (str) -- Error code.
  • info (None, str) -- Default is None.

Houdini

主要提供了调用houdini分析工具对maya资源进行相关配置文件的分析, 分析的结果保存为本地json文件,在分析的过程中会对用户传入的初始 配置信息进行校验,校验合格才开始进行文件分析。

RayvisionAnalyse

进行CG分析的核心类,提供了一些的软件校验, 根据不同的CG软件自动调用相应的软件分析模块进行配置分析。

JsonHandle

主要是对json文件信息的读写以及部分数据的校验工作。

异常管理

Error message.

CG errors.

exception rayvision_utils.exception.exception.AnalyseFailError

基类:rayvision_utils.exception.exception.AnalyzeError

Analyse Fail Error.

exception rayvision_utils.exception.exception.AnalyzeError

基类:Exception

Analyze has a damage error.

exception rayvision_utils.exception.exception.CGExeNotExistError

基类:rayvision_utils.exception.exception.AnalyzeError

No errors in CG boot.

exception rayvision_utils.exception.exception.CGFileNameIllegalError

基类:rayvision_utils.exception.exception.AnalyzeError

CG File Name Illegal Error.

exception rayvision_utils.exception.exception.CGFileNotExistsError

基类:rayvision_utils.exception.exception.AnalyzeError

CG file does not exist error.

exception rayvision_utils.exception.exception.CGFileZipFailError

基类:rayvision_utils.exception.exception.AnalyzeError

CG file compression failed error.

exception rayvision_utils.exception.exception.CompressionFailedError

基类:Exception

Compression failed error.

exception rayvision_utils.exception.exception.DecompressionFailedError

基类:Exception

Unzip failed error.

exception rayvision_utils.exception.exception.FileNameContainsChineseError

基类:rayvision_utils.exception.exception.AnalyzeError

File Name Contains Chinese Error.

exception rayvision_utils.exception.exception.GetCGLocationError

基类:rayvision_utils.exception.exception.AnalyzeError

Error getting CG local path.

exception rayvision_utils.exception.exception.GetCGVersionError

基类:rayvision_utils.exception.exception.AnalyzeError

Error getting CG version.

exception rayvision_utils.exception.exception.GetRendererError

基类:rayvision_utils.exception.exception.AnalyzeError

Get renderer error.

exception rayvision_utils.exception.exception.MaxDamageError

基类:rayvision_utils.exception.exception.AnalyzeError

Max has a damage error.

exception rayvision_utils.exception.exception.MaxExeNotExistError

基类:rayvision_utils.exception.exception.AnalyzeError

There are no errors in the Max startup file.

exception rayvision_utils.exception.exception.MultiScatterAndVrayConfilictError

基类:rayvision_utils.exception.exception.AnalyzeError

Multi scatter and vray Confilict error.

exception rayvision_utils.exception.exception.ProjectMaxVersionError

基类:rayvision_utils.exception.exception.AnalyzeError

Project Max version error.

exception rayvision_utils.exception.exception.RayvisionAPIError(error_code, error, request)

基类:rayvision_utils.exception.exception.RayvisionError

Raise RayVisionAPIError.

exception rayvision_utils.exception.exception.RayvisionError(error_code, error, *args, **kwargs)

基类:Exception

Raise RayvisionError if something wrong.

class rayvision_utils.exception.exception.RayvisionHTTPErrorProcessor

基类:urllib.request.HTTPErrorProcessor

Process HTTP error responses.

Inherit HTTPErrorProcessor in urllib2.

http_response(request, response)

Override the http_response method of HTTPErrorProcessor.

Process the response,when it is a bad Request,the corresponding exception is reported.

参数:
  • request (urllib2.Request) -- Request object.
  • response (opener.open) -- Response object.
返回:

Abnormal response.

返回类型:

Exception

exception rayvision_utils.exception.exception.RayvisonTaskIdError(error)

基类:rayvision_utils.exception.exception.RayvisionError

Raise RayVisonTaskIdError.

exception rayvision_utils.exception.exception.VersionNotMatchError

基类:rayvision_utils.exception.exception.AnalyzeError

Version not match error.

Handle tips messages and write them to tips.json.

class rayvision_utils.exception.tips.TipsInfo(save_path=None)

基类:object

Handling errors encountered in the analysis.

add(key, *values)

Add tips message.

参数:
  • key (str) -- TipsInfo code.
  • values (tuple) --

    TipsInfo message. e.g.:

    ('Scene file no exists', 'Missing renderer')
save_and_exit(path, exit_code=-1)

Save the prompt to the tips.json file and exit.

参数:
  • path (str) -- The configuration information path path.
  • exit_code (int) -- Exit code, default is -1.
save_tips(path=None)

Save the prompt to the tips.json file.

参数:path (str, optional) -- The configuration information path path.
set_tips(key, value)

Set tips message.

参数:
  • key (str) -- TipsInfo code.
  • value (str) -- TipsInfo message.

详细参数配置

Clarisse 配置文件文档

分析:我们将场景中需要的信息分析出来并保存到task.json, asset.json, upload.json, tips.json中,以便进一步解析和处理

1.task.json解析

说明: 存放场景分析结果、渲染设置等信息

task.json示例

{
    "scene_info_render": {
        "image_node": [
            {
                "frames": "0-50[1]",
                "renderable": "0",
                "output": "D:\\temp\\cam02",
                "format": "exr16",
                "LUT": "linear",
                "save_to_disk": "1",
                "name": "project://scene/cam02",
                "layers": [
                    {
                        "frames": "0-50[1]",
                        "renderable": "1",
                        "output": "D:\\temp\\cam02_layer02",
                        "format": "exr16",
                        "enable_deep_output": "1",
                        "save_to_disk": "1",
                        "enable_deep_output_path": "D:\\temp\\cam02_layer02_deep",
                        "name": "project://scene/cam02.cam02_layer02"
                    }
                ]
            }
        ]
    },
    "software_config":{
        "plugins":{},
        "cg_version":"clarisse_ifx_4.0_sp3",
        "cg_name":"Clarisse"
    },
    "task_info":{
        "task_stop_time":"259200",
        "frames_per_task":"1",
        "channel":"4",
        "task_id":"11022523",
        "project_name":"Project1",
        "platform":"2",
        "tiles":"1",
        "is_picture":"0",
        "project_id":"200953",
        "job_stop_time":"86400",
        "distribute_render_node":"3",
        "stop_after_test":"2",
        "clone_original_id":"",
        "ram":"64",
        "render_layer_type":"0",
        "test_frames":"000",
        "graphics_cards_num":"2",
        "edit_name":"",
        "pre_frames":"000",
        "input_project_path":"",
        "is_layer_rendering":"1",
        "is_distribute_render":"0",
        "time_out":"43200",
        "tiles_type":"block",
        "user_id":"100150764",
        "cg_id":"2013",
        "input_cg_file":"E:/copy/DHGB_sc05_zhuta_610-1570_v0102.project",
        "os_name":"1"
    },
    "scene_info":{
        "image_node": [
            {
                "frames": "0-50[1]",
                "renderable": "0",
                "output": "D:\\temp\\cam02",
                "format": "exr16",
                "LUT": "linear",
                "save_to_disk": "1",
                "name": "project://scene/cam02",
                "layers": [
                    {
                        "frames": "0-50[1]",
                        "renderable": "1",
                        "output": "D:\\temp\\cam02_layer02",
                        "format": "exr16",
                        "enable_deep_output": "1",
                        "save_to_disk": "1",
                        "enable_deep_output_path": "D:\\temp\\cam02_layer02_deep",
                        "name": "project://scene/cam02.cam02_layer02"
                    }
                ]
            }
        ]
    }
}

task.json参数解析

参数 类型 说明 示例
software_config object 渲染环境(软件类型、版本和用到的插件等) 见software_config对象解析
task_info object 渲染设置(优先帧、渲染帧数、超时时间等) 见task_info对象解析
scene_info_render object 场景的分析结果(场景中的渲染节点、输出路径等) 见scene_info_render对象解析

software_config对象解析

参数 类型 说明 示例
cg_name string 软件名称 "Clarisse"
cg_version string 软件版本 "clarisse_ifx_4.0_sp3"
plugins object 插件对象:
key为插件名称,value为插件版本
{}

task_info对象部分解析

参数 类型 说明 示例
is_layer_rendering string maya是否开启分层。
"0":关闭
"1":开启
"1"
cg_id string 渲染软件id."2013": Clarisse "2013"
ram string 内存要求: 64 / 128 "64"
os_name string 渲染操作系统:
"0":Linux; "1": Windows
"1"
render_layer_type string 渲染层方式选择:
"0":renderlayer方式
"1":rendersetup方式
"0"
is_distribute_render string 是否开启分布式渲染:
"0":关闭
"1":开启
"0"
input_cg_file string 渲染场景本地路径 "E:/copy/DHGB_sc05_zhuta_610-1570_v0102.project"
job_stop_time string 设置帧的超时时间,只会影响当前帧, 单位秒 "28800"
user_id string 用户ID
pre_frames string 优先渲染(优先帧不建议自定义多个单独帧) "000:1,3-4[1]" 表示:
优先渲染首帧:否
优先渲染中间帧:否
优先渲染末帧:否
优先渲染自定义帧:1,3-4[1]
platform string 提交平台:
"2": "www2",
"3": "www3",
"6": "www4",
"21": "gpu",
"2"
is_picture string 是否效果图 "0"
project_id string 项目id "200953"
channel string 1:web本地分析(动画扣费);
2:web云端分析;
3:效果图插件提交;
4:API/SDK提交;
8:动画插件提交
"4"
tiles_type string "block(分块),strip(分条)" "block"
tiles string 分块数量,大于1就分块或者分条,等于1 就是单机 "1"
project_name string 项目名称 "Project1"
distribute_render_node string 分布式渲染机器数 "3"
frames_per_task string 一机渲多帧的帧数量 "1"
stop_after_test string 优先渲染完成后是否暂停任务
"1":优先渲染完成后暂停任务
"2".优先渲染完成后不暂停任务
input_project_path string 项目路径,如用户未设置传空字符串
task_id string 任务号
task_stop_time string 大任务超时停止 单位秒 "86400"
time_out string 超时时间 单位秒 "43200"

scene_info_render对象解析

参数 类型 说明 示例
image_node object 场景普通信息 见scene_info_render.image_node对象解析

scene_info_render.image_node对象解析

参数 类型 说明 示例
renderable string "0", 不开启渲染,“1”:开启渲染(这个不是场景中的值,平台默认是不开的,平台不建议直接渲染image) "0"
output string 当前image的输出路径 "D:\temp\cam02"
format string 当前image的输出格式 "exr16"
LUT string 当前image的输出颜色管理 "linear"
save_to_disk string 当前image的是否要开启保存输出 "1"
name string 当前image的名字,也是在场景中的路径 "project://scene/cam02"
layers string 当前image的中的3dlayer,值是list,list的值是dict,当前image中有多少layer,就有几个layer的dict scene_info_render.image_node.layers对象解析
frames string 帧范围 "0-50[1]"

scene_info_render.image_node.layers对象解析

参数 类型 说明 示例
frames string 起始帧结束帧 "0-50[1]"
renderable string "0", 不开启渲染 “1”:开启渲染 "1"
output string 当前layer的输出路径 "D:\temp\cam02_layer02"
format string 当前layer的输出格式 "exr16"
enable_deep_output string 当前layer的是否要开启deep保存输出 "1"
save_to_disk string "3"
enable_deep_output_path string 当前layer的deep输出路径 "D:\temp\cam02_layer02_deep"
name string 当前layer的名字,也是在场景中的路径 "project://scene/cam02.cam02_layer02"

2.upload.json解析

说明: 存放需要上传的资产路径信息

upload.json示例

{
    "scene": [
        {
            "local": "E:\\work\\Trex\\ep\\ani_fly\\clarisse\\trex_fly_env_songshu.project",
            "server": "/E/work/Trex/ep/ani_fly/clarisse/trex_fly_env_songshu.project"
        }
    ],
    "asset": [
        {
            "local": "E:\\work\\Trex\\ep\\ani_fly\\clarisse\\assets\\speedtree\\guanmu01\\LeafHD2.png",
            "server": "/E/work/Trex/ep/ani_fly/clarisse/assets/speedtree/guanmu01/LeafHD2.png"
        },
        {
            "local": "E:\\work\\Trex\\ep\\ani_fly\\clarisse\\assets\\speedtree\\tree_far\\tree_far08\\HuangshanPineBark_Normal.png",
            "server": "/E/work/Trex/ep/ani_fly/clarisse/assets/speedtree/tree_far/tree_far08/HuangshanPineBark_Normal.png"
        }
    ]
}

upload.json参数解析

参数 类型 说明 示例
asset object 需要上传的资产路径信息 见asset对象解析
scene object 场景文件信息 见scene对象解析

asset对象解析

参数 类型 说明 示例
local string 场景本地路径 "E:\work\Trex\ep\ani_fly\clarisse\assets\speedtree\guanmu01\LeafHD2.png"
server string 服务器端相对路径,一般与local保持一致 "/E/work/Trex/ep/ani_fly/clarisse/assets/speedtree/guanmu01/LeafHD2.png"

scene对象解析

参数 类型 说明 示例
local string 资产本地路径 "E:\work\Trex\ep\ani_fly\clarisse\trex_fly_env_songshu.project"
server string 资产服务端路径,一把与local保持一致 "/E/work/Trex/ep/ani_fly/clarisse/trex_fly_env_songshu.project"

3.tips.json解析

说明: 存放分析出的错误、警告信息
{
    "50001":[
        "Nodes: /obj/flattank_fluid/compressed_cache/file_mode  File name: $HIP/geo/$HIPNAME.$OS.$F.bgeo.sc  miss file: /geo/flip_test_slice4.compressed_cache.1.bgeo.sc ",
    ]
}

Houdini 配置文件文档

分析:我们将场景中需要的信息分析出来并保存到task.json, asset.json, upload.json, tips.json中,以便进一步解析和处理

1.task.json解析

说明: 存放场景分析结果、渲染设置等信息

task.json示例

{
    "scene_info_render": {
        "rop_node": [
            {
                "node": "/out/mantra1", 
                "frames": "1-10[1]", 
                "option": "-1", 
                "render": "1",
                "height": "720",
				"width": "1280",
            }
        ], 
        "geo_node": [],
        "distributedsim_node": [
			{
				"node": "/out/distributedsim",
				"output_driver": "/obj/distribute_flattank/save_slices",
				"render": "0",
				"simControlName": "/obj/flattank_sim/DISTRIBUTE_flattank_CONTROLS",
				"output_file": "/geo/flip_test_slice4.flattank.0.1.bgeo.sc",
				"num_slices": "4",
				"option": "1",
				"frames": "1-240[1]",
				"sliceType": "particle"
			},
    }, 
    "task_info": {
        "is_layer_rendering": "1", 
        "cg_id": "2004", 
        "ram": "64", 
        "os_name": "1", 
        "render_layer_type": "0", 
        "is_distribute_render": "1", 
        "input_cg_file": "D:/gitlab/renderSDK/scenes/houdini_test/sphere.hip", 
        "job_stop_time": "28800", 
        "user_id": "10000031", 
        "pre_frames": "000", 
        "platform": "2", 
        "is_picture": "0", 
        "project_id": "3316", 
        "channel": "4", 
        "tiles_type": "block", 
        "tiles": "1", 
        "project_name": "dasdd", 
        "distribute_render_node": "3", 
        "frames_per_task": "1", 
        "stop_after_test": "2", 
        "input_project_path": "", 
        "task_id": "440149", 
        "task_stop_time": "86400", 
        "time_out": "12"
    },  
    "software_config": {
        "cg_version": "16.5.268", 
        "cg_name": "Houdini", 
        "plugins": {}
    }
}

task.json参数解析

参数 类型 说明 示例
software_config object Y 渲染环境(软件类型、版本和用到的插件等) 见software_config对象解析
task_info object Y 渲染设置(优先帧、渲染帧数、超时时间等) 见task_info对象解析
scene_info_render object Y 场景的分析结果(场景中的渲染节点、输出路径等) 见scene_info_render对象解析

software_config对象解析

参数 类型 说明 示例
cg_name string 软件名称 "Houdini"
cg_version string 软件版本 "16.5.268"
plugins object 插件对象,key为插件名称,value为插件版本 {}

task_info对象解析

参数 类型 说明 示例
is_layer_rendering string maya是否开启分层。
"0":关闭
"1":开启
"1"
cg_id string 渲染软件id : "2004": Houdini "2004"
ram string 内存要求 : 64 / 128 "64"
os_name string 渲染操作系统,
"0":Linux;
"1": Windows
"0"
render_layer_type string 渲染层方式选择。
"0":renderlayer方式
"1":rendersetup方式
"0"
is_distribute_render string 是否开启分布式渲染。
"0":关闭
"1":开启
"0"
input_cg_file string 渲染场景本地路径
job_stop_time string 设置帧的超时时间,只会影响当前帧, 单位秒 "28800"
user_id string 用户ID
pre_frames string 优先渲染(优先帧不建议自定义多个单独帧) "000:1,3-4[1]" 表示:
优先渲染首帧:否
优先渲染中间帧:否
优先渲染末帧:否
优先渲染自定义帧:1,3-4[1]
platform string 提交平台:
"2": "www2",
"3": "www3",
"6": "www4",
"21": "gpu",
"2"
is_picture string 是否效果图 "0"
project_id string 项目id
channel string 1:web本地分析(动画扣费);
2:web云端分析;
3:效果图插件提交;
4:API/SDK提交;
8:动画插件提交
"4"
tiles_type string block(分块),strip(分条) "block"
tiles string 分块数量,大于1就分块或者分条,等于1 就是单机 "1"
project_name string 项目名称 "test"
distribute_render_node string 分布式渲染机器数 "3"
frames_per_task string 一机渲多帧的帧数量 "1"
stop_after_test string 优先渲染完成后是否暂停任务
"1":优先渲染完成后暂停任务
"2".优先渲染完成后不暂停任务
input_project_path string 项目路径,如用户未设置传空字符串
task_id string 任务号
task_stop_time string 设置任务超时时间,任务超时停止所有帧,单位秒 "86400"
time_out string 超时提醒时间 单位秒 "43200"

scene_info_render对象解析

参数 类型 说明 示例
rop_node object 渲染节点
geo_node object 解算节点
distributedsim_node object 分布式节点

scene_info_render.rop_node和geo_node对象解析

参数 类型 是否必须 说明 示例
node string Y 节点全路径名 "/out/mantra1"
frames string Y 帧数范围 "1-10[1]"
option string Y 任务类型:
-1: 渲染;
0: 普通解算;
1: 分布式解算;
"-1"
render string Y 是否激活渲染:
1: 渲染(解算)该节点;
0: 该节点不参与渲染(解算)
"1"
height string N 相机的高 “720”
width string N 相机的宽 “1280”

scene_info_render.distributedsim_node对象解析

参数 类型 是否必须 说明 示例
node string Y 节点全路径名 "/out/distributedsim"
output_driver string N 输出驱动器 "/obj/distribute_flattank/save_slices"
render string Y 是否激活渲染:
1: 渲染(解算)该节点;
0: 该节点不参与渲染(解算)
"0"
simControlName string N 解算节点名 "/obj/flattank_sim/DISTRIBUTE_flattank_CONTROLS"
output_file string N 输出文件 "/geo/flip_test_slice4.flattank.0.1.bgeo.sc"
num_slices string N 分块解算总块数 (总数不可超过16) "4"
option string Y 任务类型:
-1: 渲染;
0: 普通解算;
1: 分布式解算;
"1"
frames string Y 解算帧范围 "1-240[1]"
sliceType string N 切片类型 "particle"

2.upload.json解析

说明: 存放需要上传的资产路径信息

upload.json示例

{
  "asset": [
    {
      "local": "D:/gitlab/renderSDK/scenes/houdini_test/sphere.hip", 
      "server": "/D/gitlab/renderSDK/scenes/houdini_test/sphere.hip"
    }
  ]
}

upload.json参数解析

参数 类型 说明 示例
asset object 需要上传的资产路径信息 见asset对象解析

asset对象解析

参数 类型 说明 示例
local string 资产本地路径 "D:/gitlab/renderSDK/scenes/houdini_test/sphere.hip"
server string 服务器端相对路径,一般与local保持一致 "/D/gitlab/renderSDK/scenes/houdini_test/sphere.hip"

3.tips.json解析

说明: 存放分析出的错误、警告信息
{
    "50001":[
        "Nodes: /obj/flattank_fluid/compressed_cache/file_mode  File name: $HIP/geo/$HIPNAME.$OS.$F.bgeo.sc  miss file: /geo/flip_test_slice4.compressed_cache.1.bgeo.sc ",
    ]
}

Maya 配置文件文档

分析:我们将场景中需要的信息分析出来并保存到task.json, asset.json, upload.json, tips.json中,以便进一步解析和处理

1.task.json解析

说明: 存放场景分析结果、渲染设置等信息

task.json示例

{
    "scene_info_render": {
        "defaultRenderLayer": {
            "renderable": "1", 
            "env": {}, 
            "is_default_camera": "1", 
            "option": "", 
            "common": {
                "image_format": "exr", 
                "end": "10", 
                "width": "960", 
                "image_file_prefix": "", 
                "all_camera": [
                    "stereoCameraRightShape", 
                    "stereoCameraLeftShape", 
                    "stereoCameraCenterCamShape", 
                    "perspShape", 
                    "cameraShape2", 
                    "cameraShape1"
                ], 
                "render_camera": [
                    "cameraShape1"
                ], 
                "start": "1", 
                "animation": "False", 
                "renderer": "mentalRay", 
                "frames": "1-10[1]", 
                "height": "540", 
                "renumber_frames": "False", 
                "by_frame": "1"
            }
        }, 
        "mut": {
            "renderable": "1", 
            "is_default_camera": "1", 
            "option": "", 
            "common": {
                "image_format": "exr", 
                "end": "10", 
                "width": "960", 
                "image_file_prefix": "", 
                "all_camera": [
                    "stereoCameraRightShape", 
                    "stereoCameraLeftShape", 
                    "stereoCameraCenterCamShape", 
                    "perspShape", 
                    "cameraShape2", 
                    "cameraShape1"
                ], 
                "render_camera": [
                    "cameraShape1", 
                    "stereoCameraLeftShape"
                ], 
                "start": "1", 
                "animation": "False", 
                "renderer": "mentalRay", 
                "frames": "1-10[1]", 
                "height": "540", 
                "renumber_frames": "False", 
                "by_frame": "1"
            }
        }
    }, 
    "task_info": {
        "is_layer_rendering": "1", 
        "cg_id": "2000", 
        "ram": "64", 
        "os_name": "1", 
        "render_layer_type": "0", 
        "is_distribute_render": "0", 
        "input_cg_file": "D:/chensr/scene/maya2016_multi_layers_cameras.ma", 
        "job_stop_time": "28800", 
        "user_id": "10000031", 
        "pre_frames": "000", 
        "platform": "2", 
        "is_picture": "0", 
        "project_id": "3316", 
        "channel": "4", 
        "tiles_type": "block", 
        "tiles": "1", 
        "project_name": "dasdd", 
        "distribute_render_node": "3", 
        "frames_per_task": "1", 
        "stop_after_test": "2", 
        "input_project_path": "", 
        "task_id": "439800", 
        "task_stop_time": "86400", 
        "time_out": "12"
    }, 
    "software_config": {
        "cg_version": "2016", 
        "cg_name": "Maya", 
        "plugins": {}
    }
}

task.json参数解析

参数 类型 说明 示例
software_config object 渲染环境(软件类型、版本和用到的插件等) 见software_config对象解析
task_info object 渲染设置(优先帧、渲染帧数、超时时间等) 见task_info对象解析
scene_info_render object 场景的分析结果(场景中的渲染节点、输出路径等) 见scene_info_render对象解析

software_config对象解析

参数 类型 是否必须 说明 示例
cg_name string Y 软件名称 "Maya"
cg_version string Y 软件版本 "2016"
plugins object Y 插件对象。
key为插件名称,value为插件版本
{}

task_info对象解析

参数 类型 说明 示例
is_layer_rendering string maya是否开启分层。
"0":关闭
"1":开启
"1"
cg_id string 渲染软件dcc id, 如 "maya": 2000 "2000"
ram string 内存要求: 64 / 128 "64"
os_name string 渲染操作系统,:
"0":Linux; "1": Windows
"0"
render_layer_type string 渲染层方式选择。
"0":renderlayer方式
"1":rendersetup方式
"0"
is_distribute_render string 是否开启分布式渲染。
"0":关闭
"1":开启
"0"
input_cg_file string 渲染场景本地路径
job_stop_time string 设置帧的超时时间,只会影响当前帧, 单位秒 "28800"
user_id string 用户ID
pre_frames string 优先渲染 "000:1,3-4[1]" 表示:
优先渲染首帧:否
优先渲染中间帧:否
优先渲染末帧:否
优先渲染自定义帧:1,3-4[1]
platform string 提交平台:
"2": "www2",
"3": "www3",
"6": "www4",
"21": "gpu",
"2"
is_picture string 是否效果图 "0"
project_id string 项目id
channel string 1:web本地分析(动画扣费);
2:web云端分析;
3:效果图插件提交;
4:API/SDK提交;
8:动画插件提交
"4"
tiles_type string block(分块),strip(分条) "block"
tiles string 分块数量,大于1就分块或者分条,等于1 就是单机 "1"
project_name string 项目名称 "test"
distribute_render_node string 分布式渲染机器数 "3"
frames_per_task string 一机渲多帧的帧数量 "1"
stop_after_test string 优先渲染完成后是否暂停任务
"1":优先渲染完成后暂停任务
"2".优先渲染完成后不暂停任务
"2"
input_project_path string 项目路径,如用户未设置传空字符串
task_id string 任务号
task_stop_time string 设置任务超时时间,任务超时停止所有帧,单位秒 "86400"
time_out string 超时提醒时间 单位秒 "43200"

scene_info_render对象解析

参数 类型 是否必须 说明 示例
layer object Y 层信息 见scene_info_render.layer对象解析

scene_info_render.layer对象解析

参数 类型 说明 示例
renderable string Y 渲染层开关 "1"
env object N 环境信息 {}
is_default_camera string N 是否使用默认相机,默认值为‘1’(使用默认相机) "1"
option string N 渲染器对应信息 ""
common object Y 场景普通信息 见scene_info_render.layer.common对象解析

scene_info_render.layer.common对象解析

参数 类型 是否必须 说明 示例
image_format string Y 渲染元素输出文件类型 "jpg"
end string Y 结束帧 "100"
width string Y 分辨率,宽 "1920"
image_file_prefix string Y 输出文件名设置,"/" ""
all_camera array Y 所有相机列表 ["stereoCameraRightShape", "cameraShape1"]
render_camera array Y 待渲染相机列表 ["stereoCameraRightShape"]
start string Y 起始帧 "1"
animation string N 动画开关 "1"
renderer string Y 渲染器名称 “arnold“
frames string Y 渲染帧 "1-10[1]"
height string Y 分辨率,高 "1080"
renumber_frames string N 帧覆盖 "1"
by_frame string Y 帧间隔 "1"

2.upload.json解析

说明: 存放需要上传的资产路径信息

upload.json示例

{
  "asset": [
    {
      "local": "D:/chensr/scene/maya2016_multi_layers_cameras.ma", 
      "server": "/D/chensr/scene/maya2016_multi_layers_cameras.ma"
    }
  ]
}

upload.json参数解析

参数 类型 说明 示例
asset object 需要上传的资产路径信息 见asset对象解析

asset对象解析

参数 类型 说明 示例
local string 资产本地路径 "D:/chensr/scene/maya2016_multi_layers_cameras.ma"
server string 服务器端相对路径,一般与local保持一致 "/D/chensr/scene/maya2016_multi_layers_cameras.ma"

3.tips.json解析

说明: 存放分析出的错误、警告信息
{}

架构概览

本文档介绍了RenderBus架构及其组件之间的依赖关系。

组件

rayvision_lograyvision_api 为底层模块被其它模块锁依赖;

rayvision_utils 虽然作为通用模块但是集成了CG配置信息的预处理功能; 还是会调用 rayvision_api 的服务器接口; rayvision_sync 只提供传输相关的功能,仅依赖api和日志模块; rayvision_mayarayvision_houdinirayvision_clarisse 模块 会依赖通用模块( rayvision_utils )。

  • API(rayvison_api)

底层核心模块,提供了大量的调用服务器的接口

  • 通用分析(rayvison_utils)

提供一些其它模块需要的通用功能,集成了CG渲染数据必要的数据预处理和自定义异常管理功能。

  • 传输(rayvison_sync)

提供CG配置文件,资源文件的上传功能和渲染结果的下载功能,本身是集成了下载所需的工具。

  • Maya(rayvison_maya)

集成了对maya资源文件的分析功能

  • Houdini(rayvison_houdini)

集成了读houdini资源文件的分析功能

  • Clarisse(rayvison_clarisse)

集成了对clarisse资源文件的分析功能

流程图

_images/SDK基本使用流程.png

常用参数设置

包名(PACKAGE_NAME)

设定了日志保存的名称和gitlab 进行自动化部署(CD)打包的包名。 例如:

PACKAGE_NAME = "rayvision_clarisse"

DCC软件的ID映射

DCC_ID_MAPPINGS = {
    'maya': 2000,
    '3ds Max': 2001,
    'lightwave': 2002,
    'arnold': 2003,
    'houdini': 2004,
    'cinema4d': 2005,
    'softimage': 2006,
    'blender': 2007,
    'vr_standalone': 2008,
    'mr_standalone': 2009,
    'sketchup': 2010,
    'vue': 2011,
    'keyshot': 2012,
    'clarisse': 2013,
    'octane_render': 2014,
    'katana': 2016,
}

请求头(HEADERS)

HEADERS = {
    'accessId': '',
    'channel': '4',
    'platform': '',
    'UTCTimestamp': '',
    'nonce': '',
    'signature': '',
    'version': '1.0.0',
    'Content-Type': 'application/json'
}

CG Settings

CG_SETTING 软件名首字母大写。

CG_SETTING = {
    'Maya': '2000',
    'Houdini': '2004',
    'Katana': '2016',
    'Clarisse': '2013',
    'Blender': '2007',
    '3ds Max': '2001',
    '2000': 'Maya',
    '2004': 'Houdini',
    '2016': 'Katana',
    '2013': 'Clarisse',
    '2007': 'Blender',
    '2001': '3ds Max'
}

task_info 默认参数

TASK_INFO = {
    'task_info': {
        'input_cg_file': '',
        'is_picture': '0',
        'task_id': '',
        'frames_per_task': '1',
        'pre_frames': '000',
        'job_stop_time': '86400',
        'task_stop_time': '259200',
        'time_out': '43200',
        'stop_after_test': '2',
        'project_name': '',
        'project_id': '',
        'channel': '4',
        'cg_id': '',
        'platform': '',
        'tiles_type': 'block',
        'tiles': '1',
        'is_layer_rendering': '1',
        'is_distribute_render': '0',
        'distribute_render_node': '3',
        'input_project_path': '',
        'render_layer_type': '0',
        'user_id': '',
        'os_name': '1',
        'ram': '64'
    },
    'software_config': {},
    'scene_info': {},
    'scene_info_render': {}
}

可修改参数(MODIFIABLE_PARAM)

可修改参数指的是task_info中可以被修改的参数。

MODIFIABLE_PARAM = [
    'pre_frames',
    'input_cg_file',
    'frames_per_task',
    'test_frames',
    'job_stop_time',
    'task_stop_time',
    'time_out',
    'stop_after_test',
    'tiles_type',
    'tiles',
    'is_layer_rendering',
    'is_distribute_render',
    'distribute_render_node',
    'input_project_path',
    'render_layer_type',
    'os_name',
    'ram'
]

任务执行状态(TASK_STATUS_DESCRIPTION)

设定了任务的执行状态码和对应的中英文描述

TASK_STATUS_DESCRIPTION = {
    "0": {
        "0": "等待中",
        "1": "Waiting"
    },
    "5": {
        "0": "渲染中",
        "1": "Rendering"
    },
    "8": {
        "0": "预处理中",
        "1": "Preprocessing"
    },
    "10": {
        "0": "停止",
        "1": "Stop"
    },
    "20": {
        "0": "欠费停止",
        "1": "Arrearage-stop"
    },
    "23": {
        "0": "超时停止",
        "1": "Timeout stop"
    },
    "25": {
        "0": "已完成",
        "1": "Done"
    },
    "30": {
        "0": "已完成(有失败帧)",
        "1": "Done(with failed frame)"
    },
    "35": {
        "0": "放弃",
        "1": "Abort"
    },
    "40": {
        "0": "等待全速渲染",
        "1": "Test done"
    },
    "45": {
        "0": "失败",
        "1": "Failed"
    }
}

任务结束状态码(TASK_END_STATUS_CODE_LIST)

设定了任务结束时的状态码。

TASK_END_STATUS_CODE_LIST = ['10', '20', '23', '25', '30', '35', '45']

Demo使用解析

houdini, clarisse, maya 的使用样例

Maya demo

from rayvision_api.core import RayvisionAPI
from rayvision_maya.analyze_maya import AnalyzeMaya
from rayvision_sync.upload import RayvisionUpload
from rayvision_sync.download import RayvisionDownload
from rayvision_api.task.check import RayvisionCheck
from rayvision_api.utils import update_task_info, append_to_task, append_to_upload

# API Parameter
render_para = {
    "domain": "task.renderbus.com",
    "platform": "2",
    "access_id": "xxxx",
    "access_key": "xxxx",
}

api = RayvisionAPI(access_id=render_para['access_id'],
                   access_key=render_para['access_key'],
                   domain=render_para['domain'],
                   platform=render_para['platform'])

# Step1:Analyze CG File
analyze_info = {
    "cg_file": r"D:\files\CG FILE\muti_layer_test.ma",
    "workspace": "c:/workspace",
    "software_version": "2019",
    "project_name": "Project1",
    "plugin_config": {
        "mtoa": "3.2.1.1"
    }
}
analyze_obj = AnalyzeMaya(**analyze_info)
analyze_obj.analyse()

# step2: Add some custom parameters, or update the original parameter value
update_task = {
    "pre_frames": "100",
    "stop_after_test": "1"
}
update_task_info(update_task, analyze_obj.task_json)

custom_info_to_task = {}
append_to_task(custom_info_to_task, analyze_obj.task_json)

custom_info_to_upload = []
append_to_upload(custom_info_to_upload, analyze_obj.upload_json)

# step3:Check json files
check_obj = RayvisionCheck(api, analyze_obj)
task_id = check_obj.execute(analyze_obj.task_json, analyze_obj.upload_json)

# Step4: Transmission
"""
There are two ways to upload the transmission:
Upload_method: 1: upload four json files and upload the resource file according to upload.json;
               2: json files and resources are uploaded separately;
"""
CONFIG_PATH = {
    "tips_json_path": analyze_obj.tips_json,
    "task_json_path": analyze_obj.task_json,
    "asset_json_path": analyze_obj.asset_json,
    "upload_json_path": analyze_obj.upload_json,
}
upload_obj = RayvisionUpload(api)
"""
The default of the test demo is to upload json and resource files at the same time,
and users can choose their own upload method according to the actual situation.
"""
upload_method = 1
if upload_method == 1:
    # step4.1:Json files are uploaded in conjunction with CG resources
    upload_obj.upload(str(task_id), **CONFIG_PATH)
elif upload_method == 2:
    # step4.2:CG resource files and json are uploaded separately
    upload_obj.upload_asset(upload_json_path=CONFIG_PATH["upload_json_path"])
    upload_obj.upload_config(str(task_id), list(CONFIG_PATH.values()))

# Step5:Submit Task
api.submit(int(task_id))

# Step6:Download
download = RayvisionDownload(api)
# All complete before the automatic start of uniform download.
# download.auto_download_after_task_completed([task_id])
# Poll download (automatic download for each completed frame)
download.auto_download([int(task_id)])

Houdini demo

from rayvision_api.core import RayvisionAPI
from rayvision_houdini.analyze_houdini import AnalyzeHoudini
from rayvision_sync.upload import RayvisionUpload
from rayvision_sync.download import RayvisionDownload
from rayvision_api.task.check import RayvisionCheck
from rayvision_api.utils import update_task_info, append_to_task, append_to_upload

# API Parameter
render_para = {
    "domain": "task.renderbus.com",
    "platform": "2",
    "access_id": "xxxx",
    "access_key": "xxxx",
}

api = RayvisionAPI(access_id=render_para['access_id'],
                   access_key=render_para['access_key'],
                   domain=render_para['domain'],
                   platform=render_para['platform'])

# Step1:Analyze CG File
analyze_info = {
    "cg_file": r"D:\houdini\CG file\flip_test_slice4.hip",
    "workspace": "c:/workspace",
    "software_version": "17.5.293",
    "project_name": "Project1",
    "plugin_config": {
        'renderman': '22.6'
    }
}
analyze_obj = AnalyzeHoudini(**analyze_info)
analyze_obj.analyse()

# step2: Add some custom parameters, or update the original parameter value
update_task = {
    "pre_frames": "100",
    "stop_after_test": "1"
}
update_task_info(update_task, analyze_obj.task_json)

custom_info_to_task = {}
append_to_task(custom_info_to_task, analyze_obj.task_json)

custom_info_to_upload = []
append_to_upload(custom_info_to_upload, analyze_obj.upload_json)

# step3:Check json files
check_obj = RayvisionCheck(api, analyze_obj)
task_id = check_obj.execute(analyze_obj.task_json, analyze_obj.upload_json)

# Step4: Transmission
"""
There are two ways to upload the transmission:
Upload_method: 1: upload four json files and upload the resource file according to upload.json;
               2: json files and resources are uploaded separately;
"""
CONFIG_PATH = {
    "tips_json_path": analyze_obj.tips_json,
    "task_json_path": analyze_obj.task_json,
    "asset_json_path": analyze_obj.asset_json,
    "upload_json_path": analyze_obj.upload_json,
}
upload_obj = RayvisionUpload(api)
"""
The default of the test demo is to upload json and resource files at the same time,
and users can choose their own upload method according to the actual situation.
"""
upload_method = 1
if upload_method == 1:
    # step3.1:Json files are uploaded in conjunction with CG resources
    upload_obj.upload(str(task_id), **CONFIG_PATH)
elif upload_method == 2:
    # step3.2:CG resource files and json are uploaded separately
    upload_obj.upload_asset(upload_json_path=CONFIG_PATH["upload_json_path"])
    upload_obj.upload_config(str(task_id), list(CONFIG_PATH.values()))

# Step5:Submit Task
api.submit(int(task_id))

# Step6:Download
download = RayvisionDownload(api)
# All complete before the automatic start of uniform download.
# download.auto_download_after_task_completed([task_id])
# Poll download (automatic download for each completed frame)
download.auto_download([int(task_id)])

Clarisse demo

from rayvision_api.core import RayvisionAPI
from rayvision_clarisse.analyse_clarisse import AnalyzeClarisse
from rayvision_sync.upload import RayvisionUpload
from rayvision_sync.download import RayvisionDownload
from rayvision_api.task.check import RayvisionCheck
from rayvision_api.utils import update_task_info, append_to_task, append_to_upload

# API Parameter
render_para = {
    "domain": "task.renderbus.com",
    "platform": "2",
    "access_id": "xxxx",
    "access_key": "xxxx",
}

api = RayvisionAPI(access_id=render_para['access_id'],
                   access_key=render_para['access_key'],
                   domain=render_para['domain'],
                   platform=render_para['platform'])

# Step1:Analyze CG File
analyze_info = {
    "cg_file": r"D:\files\CG FILE\clarisse_test1.project",
    "workspace": "c:/workspace",
    "software_version": "clarisse_ifx_4.0_sp3",
    "project_name": "Project1",
    "plugin_config": {}
}
analyze_obj = AnalyzeClarisse(**analyze_info)
analyze_obj.analyse()

# step2:Add some custom parameters, or update the original parameter value
update_task = {
    "pre_frames": "100",
    "stop_after_test": "1"
}
update_task_info(update_task, analyze_obj.task_json)

custom_info_to_task = {}
append_to_task(custom_info_to_task, analyze_obj.task_json)

custom_info_to_upload = []
append_to_upload(custom_info_to_upload, analyze_obj.upload_json)

# step3:Check json files
check_obj = RayvisionCheck(api, analyze_obj)
task_id = check_obj.execute(analyze_obj.task_json, analyze_obj.upload_json)

# Step4:Transmission
"""
There are two ways to upload the transmission:
Upload_method: 1:upload four json files and upload the resource file according to upload.json;
               2:json files and resources are uploaded separately;
"""
CONFIG_PATH = {
    "tips_json_path": analyze_obj.tips_json,
    "task_json_path": analyze_obj.task_json,
    "asset_json_path": analyze_obj.asset_json,
    "upload_json_path": analyze_obj.upload_json,
}
upload_obj = RayvisionUpload(api)
"""
The default of the test demo is to upload json and resource files at the same time,
and users can choose their own upload method according to the actual situation.
"""
upload_method = 1
if upload_method == 1:
    # step4.1:Json files are uploaded in conjunction with CG resources
    upload_obj.upload(str(task_id), **CONFIG_PATH)
elif upload_method == 2:
    # step4.2:CG resource files and json are uploaded separately
    upload_obj.upload_asset(upload_json_path=CONFIG_PATH["upload_json_path"])
    upload_obj.upload_config(str(task_id), list(CONFIG_PATH.values()))

# Step5:Submit Task
api.submit(int(task_id))

# Step6:Download
download = RayvisionDownload(api)
# All complete before the automatic start of uniform download.
# download.auto_download_after_task_completed([task_id])
# Poll download (automatic download for each completed frame)
download.auto_download([int(task_id)])

常见问题

1. RenderBus SDK支持那些Python版本呢?

RenderBus SDK 目前支持Python2.7.10+ 和Python 3.6, 3.7

2. 使用pycharm应该怎么下载SDK包呢?

详细配置请参考 安装指南

3. 怎么设置只渲染首帧?

  • 设置只渲染首帧
from rayvision_api.utils import update_task_info
update_task = {
     "pre_frames": "100",
 }
 update_task_info(update_task, task_path=r"C:\workspace\1586932339\task.json")

4. 怎么设置渲染完优先帧,让任务自动全速渲染?

from rayvision_api.utils import update_task_info
update_task = {
     "stop_after_test": "1"
 }
update_task_info(update_task, task_path=r"C:\workspace\1586932339\task.json")

详细配置请参考 详细参数配置

5. 怎么设置当前渲染帧结束立即下载渲染结果呢?

我们提供了2中下载方式:

  • 所有帧渲染结束才开始下载
  • 当前帧渲染技术就开始下载

具体使用方法请参考 SDK使用

6. 最简单的使用方式是怎么样的呢?

如果不想直接使用而不进行太多的定制,可以直接下载相应的渲染包,

然后选择对应的 常见全流程样例 即可体验全流程渲染,详细过程请参考 SDK入门教程

异常码参照

异常码 异常码描述 说明
100 FAIL 失败
200 SUCCESS 接口正常返回
301 NEED_REDIRECT 需要跳转地址
400 APIError 错误请求
403 FORBIDDEN 没有权限
404 RESOURCE_NOT_FOUND 资源不存在
500 INTERNAL_ERROR 服务器处理失败
503 LABEL_ALREADY_EXISTS 新增label已存在
600 PARAMETER_INVALID 非法参数
601 PARAMETER_CANT_BE_EMPTY 缺少必要参数
602 NEED_USER_LOGIN 需要用户登录
603 ILLEGAL_PROTOCOL 非法请求
604 VALIDATE_CODE_ERROR 手机验证码错误
605 VINSUFFICIENT_PERMISSIONS 权限不足
606 VALIDATE_COMMOM_CODE_ERROR 验证码错误
607 VALIDATE_SEND_CODE_ERROR 验证码发送失败
608 USER_AREA_ERROR 客户国内外区域不匹配
610 SIGNATURE_EXPIRED 签名过期
611 SIGNATURE_INVALID 非法签名
700 DO_NOT_HAVE_ANY_MORE_RECORD 没有更多记录
800 ACCOUNT_BINDING_USER_NULL 账号不存在
801 ACCOUNT_NOT_BINDING 未绑定设备
802 ACCOUNT_BINDING_FAIL 设备绑定失败
804 ACCOUNT_LOCKED 账号已被禁用
805 ACCOUNT_USERNAME_PASSWORD_FAIL 用户名或密码错误
806 ACCOUNT_UNIONID_FAIL 账号未绑定第三方用户
807 ACCOUNT_PHONE_FAIL 手机未绑定第三方用户
808 ACCOUNT_UNIONID_PHONE 手机已绑定其他第三方用戶
809 ACCOUNT_WEIXIN_FAIL 微信登录失败
810 ACCOUNT_WEIBO_FAIL 微博登录失败
811 ACCOUNT_LOGOUT_FAIL 登出失败
812 ACCOUNT_LOGIN_IPLIMITFAIL IP被限制
813 ACCOUNT_QQ_FAIL QQ登录失败
814 NOREPEAT_SELECT_SOFTWARE 无法重复选择常用软件
815 ACCOUNT_UNIONID_EXISTS UNIONID已存在
900 VALIDATE_PHONE_FAIL 手机号已存在
901 VALIDATE_EMAIL_FAIL 邮箱已存在
902 VALIDATE_USERNAME_FAIL 用户名已存在
903 ACCOUNT_EMAIL_FAIL 邮箱未绑定账户
904 CURRENCY_NOT_SUPPORT 币种不支持
905 AGENT_NOT_SUPPORT 代理商不支持
906 AMOUNT_NOT_SUPPORT 请输入合理的充值范围
908 COUPONNO_NOT_SUPPORT 优惠码不支持
909 PAYMETHOD_NOT_SUPPORT 支付方式不支持
910 NO_INVOICE_ORDER 无可用的发票订单
911 NO_INVOICE_ADDRESS 无可用的发票收件地址
912 SUBUSER_EXISTS_TASKS 无法删除一个存在执行任务的子账号
913 SUBUSER_ARREARAGE 当前子账号欠费
914 DELSUBUSER_EXISTS_BALANCE 删除子账号存在余额
915 NO_INVOICE_TEMPLATE 无可用的发票信息
916 RECEIPT_TYPE_ERROR 发票类型不匹配
920 NO_LATEST_VERSION 暂无客户端最新版本
1000 REDIS_CACHE_FAIL redis缓存异常
20004 JSON_FILE_UPLOAD_FAILED 上传json文件多次都失败,请检查网络环境
200024 ARGUMENT_FORMAT_INVALID 传输参数名设置错误,请检查传输cmd命令
200025 NON_UPLOADABLE FILES 不可上传的文件,检查文件是否存在或者文件是否损坏
1000000 RayvisionError python抛出异常

发行说明(Release notes)

0.1.0 (2019-11-10):

  • 初版

1.1.0 (2020-04-06):

重大更新:
  • rayvision_api 更新了部分传递的参数, 检查功能重构
  • rayvision_clarisse 增加独立的本地分析功能,Clarissa分析支持python2
  • rayvision_maya 增加独立的本地分析功能
  • rayvision_houdini 增加独立的本地分析功能
  • rayvision_sync 支持分别上传json配置和资源文件,下载支持自定义服务器文件路径,支持是否使用本地对比功能

为RenderBusSDK做贡献

重要

请仔细检查,您正在https://renderbus.readthedocs.io/zh/latest/index.html 上阅读本文档的最新版本。

有许多方法可以为RenderBusSDK做出贡献。这里是其中的一些:

  • 在问题跟踪器中报告错误和请求功能,尝试遵循下面的报告错误中详细介绍的准则。

报告错误

  • 请先查看常见问题解答,看看您的问题是否在一个著名的问题中得到解决
  • 检查未解决的问题,看看是否已经报告过。如果有,不排除该报告,但检查单历史记录和评论,你可能会发现更多有用的信息作出贡献。
  • 编写完整的,可复制的,特定的错误报告。测试用例越小越好。请记住,其他开发人员将没有您的项目来重现该错误,因此请包括所有需要重现该错误的相关文件。
  • 包括错误的输出,以便开发人员可以完全知道该错误发生在哪个版本和平台上,这通常对于重新生成它或知道是否已修复非常有帮助

Indices and tables