Searches for a specific operation in the execution plan and returns it if found, or None otherwise
(op: Operation, name: str)
| 3 | |
| 4 | |
| 5 | def locate_operation(op: Operation, name: str): |
| 6 | """Searches for a specific operation in the execution plan and returns it if |
| 7 | found, or None otherwise""" |
| 8 | if op.name == name: |
| 9 | return op |
| 10 | if op.children: |
| 11 | for child in op.children: |
| 12 | res = locate_operation(child, name) |
| 13 | if res: |
| 14 | return res |
| 15 | return None |
| 16 | |
| 17 | # Iterate recursively the operation's children and return the number of operations with a specific name |
| 18 | def count_operation(op: Operation, name: str): |
no outgoing calls