task_id = check_obj.execute(hardware_config, analyze_obj.task_json, analyze_obj.upload_json) # Step5: 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 = 2 if upload_method == 1: # Step5.1:Json files are uploaded in conjunction with CG resources upload_obj.upload(str(task_id), **CONFIG_PATH) elif upload_method == 2: # Step5.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())) # Step6:Submit Task
"domain": render_para['domain'], "platform": render_para['platform'], "local_os": render_para['local_os'], "user_id": api.user_info['user_id'], "local_path": r"C:\workspace", # 下载资源本地保存路径 } resource_config_file = { "task_json_path": task.task_json_path, "tips_json_path": task.tips_json_path, "asset_json_path": task.asset_json_path, "upload_json_path": task.upload_json_path, } # start transfer(传输) trans = RayvisionTransfer(**transfer_info) upload = RayvisionUpload(trans) upload.upload(task_id=task.task_id, **resource_config_file) task_id = int(task.task_id) result = api.submit(task_id) # download(下载) manage_task = RayvisionManageTask(api.query) trans.manage_task = manage_task download = RayvisionDownload(trans) # demo提供2种下载方式用户自行选择 # download.auto_download_after_task_completed([task_id]) # 所有都完成后才自动开始统一下载 download.auto_download([task_id]) # 轮询下载(每完成每一帧自动下载)
# -*- coding: utf-8 -*- """Upload demo.""" 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_asset(r"C:\workspace\work\upload.json") UPLOAD.upload_config("5165465", CONFIG_PATH)
def rayvision_upload(api): """Create an RayvisionDownload object.""" return RayvisionUpload(api)