Creates an :code:`graphscope.framework.operation.Operation`. Args: op_type: :code:`types_pb2.OperationType` Value for the "op" attribute of the OpDef proto. inputs: A list of `Operations` that will be the parents to self ou
(
self,
session_id,
op_type,
inputs=None,
output_types=None,
config=None,
large_attr=None,
query_args=None,
)
| 40 | """ |
| 41 | |
| 42 | def __init__( |
| 43 | self, |
| 44 | session_id, |
| 45 | op_type, |
| 46 | inputs=None, |
| 47 | output_types=None, |
| 48 | config=None, |
| 49 | large_attr=None, |
| 50 | query_args=None, |
| 51 | ): |
| 52 | """Creates an :code:`graphscope.framework.operation.Operation`. |
| 53 | |
| 54 | Args: |
| 55 | op_type: :code:`types_pb2.OperationType` |
| 56 | Value for the "op" attribute of the OpDef proto. |
| 57 | inputs: |
| 58 | A list of `Operations` that will be the parents to self |
| 59 | output_types: |
| 60 | The operation's output type |
| 61 | config: |
| 62 | Dictionary where the key is the attribute name (a string) |
| 63 | and the value is the respective "attr" attribute of the OpDef proto (an |
| 64 | AttrValue). |
| 65 | large_attr: |
| 66 | List of `LargeAttrValue` for large chunk. |
| 67 | query_args: |
| 68 | Values that used as query parameters when evaluating app. |
| 69 | |
| 70 | Raises: |
| 71 | TypeError: value in inputs is not a :class:`Operation` |
| 72 | """ |
| 73 | self._session_id = session_id |
| 74 | self._op_def = op_def_pb2.OpDef( |
| 75 | op=op_type, key=uuid.uuid4().hex, output_type=output_types |
| 76 | ) |
| 77 | self._parents = list() |
| 78 | if large_attr: |
| 79 | self._op_def.large_attr.CopyFrom(large_attr) |
| 80 | if config: |
| 81 | for k, v in config.items(): |
| 82 | self._op_def.attr[k].CopyFrom(v) |
| 83 | if query_args is not None: |
| 84 | self._op_def.query_args.CopyFrom(query_args) |
| 85 | if inputs: |
| 86 | for op in inputs: |
| 87 | if not isinstance(op, Operation): |
| 88 | raise TypeError("Input op must be an Operation: {0}".format(op)) |
| 89 | self.add_parent(op) |
| 90 | self._output_types = output_types |
| 91 | self._evaluated = False |
| 92 | self._leaf = False |
| 93 | |
| 94 | @property |
| 95 | def key(self): |
nothing calls this directly
no test coverage detected