Skip to content

Commit a5fad50

Browse files
benizmergify[bot]
authored andcommitted
fix: missing support for parent_id in chains with Python client
1 parent dbafe3a commit a5fad50

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

clients/python/dd_client/__init__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ def make_call(
291291
parameters_mllib,
292292
parameters_output,
293293
use_base64=False,
294+
parent_id="",
294295
index_uris=[],
295296
):
296297
"""
@@ -299,6 +300,7 @@ def make_call(
299300
a post_chain API call. This basically eases the making
300301
of chain calls from Python.
301302
Parameters are the same as for a post_predict call
303+
parent_id -- parent action id, when branching execution
302304
"""
303305

304306
if use_base64:
@@ -314,19 +316,24 @@ def make_call(
314316
}
315317
if data:
316318
call["data"] = data
319+
if parent_id:
320+
call["parent_id"] = parent_id
317321
if index_uris:
318322
call["index_uris"] = index_uris
319323

320324
return call
321325

322-
def make_action(self, action_type, parameters=[]):
326+
def make_action(self, action_type, parameters=[], aid=""):
323327
"""
324328
Creates a dictionary that holds a JSON chain action.
325329
Parameters:
326330
action_type -- "crop" or "filter" for now
327331
parameters -- action parameters
332+
aid -- action id
328333
"""
329334
action = {"action": {"type": action_type}}
335+
if aid:
336+
action["id"] = aid
330337
if parameters:
331338
action["action"]["parameters"] = parameters
332339
return action

0 commit comments

Comments
 (0)