Skip to content

Commit 40d4357

Browse files
author
gaoyuan7
committed
kvs增加流式任务接口
1 parent 1d1cc05 commit 40d4357

File tree

3 files changed

+70
-1
lines changed

3 files changed

+70
-1
lines changed

examples/kvs.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#ks_access_key_id='xxxxxxxxxxxxxxxxxxxx'
88
#ks_secret_access_key='xxxxxxxxxxxxxxxxxxxxxxx'
99
# 参数:服务service_name,大区region_name
10-
#client = getOfflineClient("offline", "cn-beijing-6",use_ssl=False,ks_access_key_id=ks_access_key_id,ks_secret_access_key=ks_secret_access_key)
10+
#client = getKvsClient("offline", "cn-beijing-6",use_ssl=False,ks_access_key_id=ks_access_key_id,ks_secret_access_key=ks_secret_access_key)
1111

1212
#配置kscore.cfg调用方式
1313

@@ -108,6 +108,10 @@
108108
res = client.CreateTask(task)
109109
print json.dumps(res)
110110

111+
#该接口需要输入json格式数据
112+
res = client.CreateFlowTask(task)
113+
print json.dumps(res)
114+
111115
#查看任务状态接口调用示例 : GetTaskByTaskID
112116
taskid = "40d309d3b2bf373cd3f08e5b5e1bddf720160816"
113117
# TaskID:任务ID
@@ -167,3 +171,16 @@
167171

168172
res = client.GetScreenshotNumber(StartUnixTime, EndUnixTime, Granularity, ResultType)
169173
print json.dumps(res)
174+
175+
#控制台专用
176+
#发起媒体转码
177+
res = client.FetchObjectMediaProcess(task)
178+
print json.dumps(res)
179+
180+
#查询任务列表
181+
res = client.ListFetchObjectMediaProcess(StartUnixTime=StartUnixTime,EndUnixTime=EndUnixTime)
182+
print json.dumps(res)
183+
184+
#查询单个任务详情
185+
res = client.GetFetchObjectMediaProcess(ProcessTaskId="12121212")
186+
print json.dumps(res)

kscore/data/kvs/2017-01-01/service-2.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,21 @@ operations:
4444
input:
4545
shape: PresetInstance
4646

47+
CreateFlowTask:
48+
name: CreateFlowTask
49+
http:
50+
method: POST
51+
4752
CreateTask:
4853
name: CreateTask
4954
http:
5055
method: POST
5156

57+
FetchObjectMediaProcess:
58+
name: FetchObjectMediaProcess
59+
http:
60+
method: POST
61+
5262
DelTaskByTaskID:
5363
name: DelTaskByTaskID
5464
http:
@@ -114,6 +124,22 @@ operations:
114124
http:
115125
method: GET
116126

127+
ListFetchObjectMediaProcess:
128+
name: ListFetchObjectMediaProcess
129+
http:
130+
method: GET
131+
requestUri: /
132+
input:
133+
shape: ListFetchObjectMediaProcessInstance
134+
135+
GetFetchObjectMediaProcess:
136+
name: GetFetchObjectMediaProcess
137+
http:
138+
method: GET
139+
requestUri: /
140+
input:
141+
shape: GetFetchObjectMediaProcessInstance
142+
117143
shapes:
118144
Preset:
119145
type: string
@@ -131,6 +157,8 @@ shapes:
131157
type: integer
132158
Marker:
133159
type: integer
160+
Marker1:
161+
type: string
134162
Limit:
135163
type: integer
136164
PipelineName:
@@ -143,6 +171,8 @@ shapes:
143171
type: integer
144172
ResultType:
145173
type: integer
174+
ProcessTaskId:
175+
type: string
146176
PresetInstance:
147177
type: structure
148178
members:
@@ -198,4 +228,20 @@ shapes:
198228
shape: Granularity
199229
ResultType:
200230
shape: ResultType
231+
ListFetchObjectMediaProcessInstance:
232+
type: structure
233+
members:
234+
StartUnixTime:
235+
shape: StartUnixTime
236+
EndUnixTime:
237+
shape: EndUnixTime
238+
Marker:
239+
shape: Marker1
240+
Limit:
241+
shape: Limit
201242

243+
GetFetchObjectMediaProcessInstance:
244+
type: structure
245+
members:
246+
ProcessTaskId:
247+
shape: ProcessTaskId

kscore/kvs.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ def GetPresetDetail(self,Preset=''):
2828
def CreateTask(self,task):
2929
return self.client.create_task(**task)
3030

31+
def CreateFlowTask(self,task):
32+
return self.client.create_flow_task(**task)
33+
34+
def FetchObjectMediaProcess(self,task):
35+
return self.client.fetch_object_media_process(**task)
36+
3137
def GetTaskByTaskID(self,TaskID=''):
3238
return self.client.get_task_by_task_id(TaskID=TaskID)
3339

0 commit comments

Comments
 (0)