函数工作流 FUNCTIONGRAPH-python模板

时间:2024-11-13 14:14:22

python模板

主调函数:

# funcName: pythoncaller

from functionsdk import Function
def newStateRouter(event, context):
    func = Function(context, "pythonstateful", "test1")
    instanceID = func.get_instance_id()
    return instanceID

def bindStateRouter(event, context):
    func = Function(context)
    # bind
    func.get_instance("pythonstateful", "test1")
    instanceID = func.get_instance_id()
    return instanceID

def invoke(event, context):
    func = Function(context)
    # bind
    func.get_instance("pythonstateful", "test1")
    obj = func.invoke("{\"key\":\"value\"}")
    result = obj.get()
    return result

def terminate(event, context):
    func = Function(context)
    # bind
    func.get_instance("pythonstateful", "test1")
    obj = func.terminate()
    result = obj.get()
return result
support.huaweicloud.com/devg-functiongraph/functiongraph_02_0667.html