我试图将字典作为参数传递给输入,但我不太确定如何定义@ batch_sub_task。
发布于 2019-11-21 16:00:49
您尝试过将Types.Generic作为类型吗?它映射到Python中的json对象。
Use this to specify a simple JSON type.
When used with an SDK-decorated method, expect this behavior from the default type engine:
As input:
1) If set, a Python dict with JSON-ifiable primitives and nested lists or maps.
2) Otherwise, a None value will be received.
As output:
1) User code may pass a Python dict with arbitrarily nested lists and dictionaries. JSON-ifiable
primitives may also be specified.
2) Output can also be nulled with a None value.
From command-line:
Specify a JSON string.
.. code-block:: python
@inputs(a=Types.Generic)
@outputs(b=Types.Generic)
@python_task
def operate(wf_params, a, b):
if a['operation'] == 'add':
a['value'] += a['operand'] # a['value'] is a number
elif a['operation'] == 'merge':
a['value'].update(a['some']['nested'][0]['field'])
b.set(a)https://stackoverflow.com/questions/58885690
复制相似问题