Run `bound app` on the `graph`. Args: app (:class:`AppDAGNode`): A :class:`AppDAGNode` instance which represent a bound app. key (str): Key of query results, can be used to retrieve results. *args: Additional query params that will be used in evaluation. **kwargs
(app, *args, **kwargs)
| 81 | |
| 82 | |
| 83 | def run_app(app, *args, **kwargs): |
| 84 | """Run `bound app` on the `graph`. |
| 85 | |
| 86 | Args: |
| 87 | app (:class:`AppDAGNode`): A :class:`AppDAGNode` instance which represent a bound app. |
| 88 | key (str): Key of query results, can be used to retrieve results. |
| 89 | *args: Additional query params that will be used in evaluation. |
| 90 | **kwargs: Key-value formated query params that mostly used in Cython apps. |
| 91 | |
| 92 | Returns: |
| 93 | An op to run app on the specified graph, with optional query parameters. |
| 94 | """ |
| 95 | inputs = [app.op] |
| 96 | config = {} |
| 97 | output_prefix = kwargs.pop("output_prefix", ".") |
| 98 | config[types_pb2.OUTPUT_PREFIX] = utils.s_to_attr(output_prefix) |
| 99 | # optional query arguments. |
| 100 | params = utils.pack_query_params(*args, **kwargs) |
| 101 | query_args = types_pb2.QueryArgs() |
| 102 | query_args.args.extend(params) |
| 103 | op = Operation( |
| 104 | app.session_id, |
| 105 | types_pb2.RUN_APP, |
| 106 | inputs=inputs, |
| 107 | config=config, |
| 108 | output_types=types_pb2.RESULTS, |
| 109 | query_args=query_args, |
| 110 | ) |
| 111 | return op |
| 112 | |
| 113 | |
| 114 | def create_graph(session_id, graph_type, inputs=None, **kwargs): |