| 13 | |
| 14 | |
| 15 | def tutorial_simple(): |
| 16 | pipeline = GPipeline() |
| 17 | a, b, c, d = MyNode1(), MyNode2(), MyNode1(), MyNode2() |
| 18 | |
| 19 | pipeline.registerGElement(a, set(), "nodeA") |
| 20 | pipeline.registerGElement(b, {a}, "nodeB") |
| 21 | pipeline.registerGElement(c, {a}, "nodeC") |
| 22 | pipeline.registerGElement(d, {b, c}, "nodeD") |
| 23 | |
| 24 | status: CStatus = pipeline.init() |
| 25 | if status.isErr(): |
| 26 | # please check api return status |
| 27 | # ret_code == 0 is ok, default |
| 28 | # ret_code < 0 means error, ex: return CStatus(-1, "my error info") |
| 29 | print('pipeline init failed, error code is {0}, error info is {1}'.format( |
| 30 | status.getCode(), status.getInfo())) |
| 31 | return |
| 32 | |
| 33 | for i in range(0, 3): |
| 34 | status = pipeline.run() |
| 35 | print("==== tutorial_simple, loop: {0}, and run status = {1}".format(i + 1, status.getCode())) |
| 36 | |
| 37 | pipeline.destroy() |
| 38 | |
| 39 | |
| 40 | if __name__ == '__main__': |