Unload operations (graph, app, context) in dag which are not existed in fetches.
(self)
| 193 | return rets[0] if rets and self._unpack else rets |
| 194 | |
| 195 | def get_dag_for_unload(self): |
| 196 | """Unload operations (graph, app, context) in dag which are not |
| 197 | existed in fetches. |
| 198 | """ |
| 199 | unload_dag = op_def_pb2.DagDef() |
| 200 | keys_of_fetches = set([op.key for op in self._ops]) |
| 201 | mapping = { |
| 202 | types_pb2.CREATE_GRAPH: types_pb2.UNLOAD_GRAPH, |
| 203 | types_pb2.CREATE_APP: types_pb2.UNLOAD_APP, |
| 204 | types_pb2.RUN_APP: types_pb2.UNLOAD_CONTEXT, |
| 205 | } |
| 206 | for op_def in self._sub_dag.op: |
| 207 | if op_def.op in mapping and op_def.key not in keys_of_fetches: |
| 208 | unload_op_def = op_def_pb2.OpDef( |
| 209 | op=mapping[op_def.op], key=uuid.uuid4().hex |
| 210 | ) |
| 211 | unload_op_def.parents.extend([op_def.key]) |
| 212 | unload_dag.op.extend([unload_op_def]) |
| 213 | return unload_dag |
| 214 | |
| 215 | |
| 216 | class Session(object): |