Spaces:
Running
Running
Example of category, backward compatibility.
Browse files
examples/Multi-output demo.lynxkite.json
CHANGED
|
@@ -25,6 +25,9 @@
|
|
| 25 |
"error": null,
|
| 26 |
"input_metadata": [],
|
| 27 |
"meta": {
|
|
|
|
|
|
|
|
|
|
| 28 |
"color": "orange",
|
| 29 |
"doc": [
|
| 30 |
{
|
|
@@ -57,6 +60,7 @@
|
|
| 57 |
]
|
| 58 |
}
|
| 59 |
],
|
|
|
|
| 60 |
"inputs": [],
|
| 61 |
"name": "Multi-output example",
|
| 62 |
"outputs": [
|
|
@@ -93,6 +97,7 @@
|
|
| 93 |
],
|
| 94 |
"type": "basic"
|
| 95 |
},
|
|
|
|
| 96 |
"params": {
|
| 97 |
"a_limit": "2",
|
| 98 |
"b_limit": "10"
|
|
@@ -100,7 +105,7 @@
|
|
| 100 |
"status": "done",
|
| 101 |
"title": "Multi-output example"
|
| 102 |
},
|
| 103 |
-
"dragHandle": ".
|
| 104 |
"height": 275.0,
|
| 105 |
"id": "Multi-output example 1",
|
| 106 |
"position": {
|
|
@@ -146,8 +151,10 @@
|
|
| 146 |
}
|
| 147 |
],
|
| 148 |
"meta": {
|
|
|
|
| 149 |
"color": "orange",
|
| 150 |
"doc": null,
|
|
|
|
| 151 |
"inputs": [
|
| 152 |
{
|
| 153 |
"name": "bundle",
|
|
@@ -170,13 +177,14 @@
|
|
| 170 |
],
|
| 171 |
"type": "table_view"
|
| 172 |
},
|
|
|
|
| 173 |
"params": {
|
| 174 |
"limit": 100.0
|
| 175 |
},
|
| 176 |
"status": "done",
|
| 177 |
"title": "View tables"
|
| 178 |
},
|
| 179 |
-
"dragHandle": ".
|
| 180 |
"height": 200.0,
|
| 181 |
"id": "View tables 1",
|
| 182 |
"position": {
|
|
@@ -246,8 +254,10 @@
|
|
| 246 |
}
|
| 247 |
],
|
| 248 |
"meta": {
|
|
|
|
| 249 |
"color": "orange",
|
| 250 |
"doc": null,
|
|
|
|
| 251 |
"inputs": [
|
| 252 |
{
|
| 253 |
"name": "bundle",
|
|
@@ -270,13 +280,14 @@
|
|
| 270 |
],
|
| 271 |
"type": "table_view"
|
| 272 |
},
|
|
|
|
| 273 |
"params": {
|
| 274 |
"limit": 100.0
|
| 275 |
},
|
| 276 |
"status": "done",
|
| 277 |
"title": "View tables"
|
| 278 |
},
|
| 279 |
-
"dragHandle": ".
|
| 280 |
"height": 215.0,
|
| 281 |
"id": "View tables 2",
|
| 282 |
"position": {
|
|
|
|
| 25 |
"error": null,
|
| 26 |
"input_metadata": [],
|
| 27 |
"meta": {
|
| 28 |
+
"categories": [
|
| 29 |
+
"examples"
|
| 30 |
+
],
|
| 31 |
"color": "orange",
|
| 32 |
"doc": [
|
| 33 |
{
|
|
|
|
| 60 |
]
|
| 61 |
}
|
| 62 |
],
|
| 63 |
+
"id": "examples > Multi-output example",
|
| 64 |
"inputs": [],
|
| 65 |
"name": "Multi-output example",
|
| 66 |
"outputs": [
|
|
|
|
| 97 |
],
|
| 98 |
"type": "basic"
|
| 99 |
},
|
| 100 |
+
"op_id": "examples > Multi-output example",
|
| 101 |
"params": {
|
| 102 |
"a_limit": "2",
|
| 103 |
"b_limit": "10"
|
|
|
|
| 105 |
"status": "done",
|
| 106 |
"title": "Multi-output example"
|
| 107 |
},
|
| 108 |
+
"dragHandle": ".drag-handle",
|
| 109 |
"height": 275.0,
|
| 110 |
"id": "Multi-output example 1",
|
| 111 |
"position": {
|
|
|
|
| 151 |
}
|
| 152 |
],
|
| 153 |
"meta": {
|
| 154 |
+
"categories": [],
|
| 155 |
"color": "orange",
|
| 156 |
"doc": null,
|
| 157 |
+
"id": "View tables",
|
| 158 |
"inputs": [
|
| 159 |
{
|
| 160 |
"name": "bundle",
|
|
|
|
| 177 |
],
|
| 178 |
"type": "table_view"
|
| 179 |
},
|
| 180 |
+
"op_id": "View tables",
|
| 181 |
"params": {
|
| 182 |
"limit": 100.0
|
| 183 |
},
|
| 184 |
"status": "done",
|
| 185 |
"title": "View tables"
|
| 186 |
},
|
| 187 |
+
"dragHandle": ".drag-handle",
|
| 188 |
"height": 200.0,
|
| 189 |
"id": "View tables 1",
|
| 190 |
"position": {
|
|
|
|
| 254 |
}
|
| 255 |
],
|
| 256 |
"meta": {
|
| 257 |
+
"categories": [],
|
| 258 |
"color": "orange",
|
| 259 |
"doc": null,
|
| 260 |
+
"id": "View tables",
|
| 261 |
"inputs": [
|
| 262 |
{
|
| 263 |
"name": "bundle",
|
|
|
|
| 280 |
],
|
| 281 |
"type": "table_view"
|
| 282 |
},
|
| 283 |
+
"op_id": "View tables",
|
| 284 |
"params": {
|
| 285 |
"limit": 100.0
|
| 286 |
},
|
| 287 |
"status": "done",
|
| 288 |
"title": "View tables"
|
| 289 |
},
|
| 290 |
+
"dragHandle": ".drag-handle",
|
| 291 |
"height": 215.0,
|
| 292 |
"id": "View tables 2",
|
| 293 |
"position": {
|
examples/multi_output_demo.py
CHANGED
|
@@ -2,7 +2,7 @@ from lynxkite.core.ops import op
|
|
| 2 |
import pandas as pd
|
| 3 |
|
| 4 |
|
| 5 |
-
@op("LynxKite Graph Analytics", "Multi-output example", outputs=["one", "two"])
|
| 6 |
def multi_output(*, a_limit=4, b_limit=10):
|
| 7 |
"""
|
| 8 |
Returns two outputs. Also demonstrates Numpy-style docstrings.
|
|
|
|
| 2 |
import pandas as pd
|
| 3 |
|
| 4 |
|
| 5 |
+
@op("LynxKite Graph Analytics", "examples", "Multi-output example", outputs=["one", "two"])
|
| 6 |
def multi_output(*, a_limit=4, b_limit=10):
|
| 7 |
"""
|
| 8 |
Returns two outputs. Also demonstrates Numpy-style docstrings.
|
lynxkite-core/src/lynxkite/core/workspace.py
CHANGED
|
@@ -39,6 +39,14 @@ class WorkspaceNodeData(BaseConfig):
|
|
| 39 |
# Also contains a "meta" field when going out.
|
| 40 |
# This is ignored when coming back from the frontend.
|
| 41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
class WorkspaceNode(BaseConfig):
|
| 44 |
# Most of these fields are shared with ReactFlow.
|
|
|
|
| 39 |
# Also contains a "meta" field when going out.
|
| 40 |
# This is ignored when coming back from the frontend.
|
| 41 |
|
| 42 |
+
@pydantic.model_validator(mode="before")
|
| 43 |
+
@classmethod
|
| 44 |
+
def fill_op_id_if_missing(cls, data: dict) -> dict:
|
| 45 |
+
"""Compatibility with old workspaces that don't have op_id."""
|
| 46 |
+
if "op_id" not in data:
|
| 47 |
+
data["op_id"] = data["title"]
|
| 48 |
+
return data
|
| 49 |
+
|
| 50 |
|
| 51 |
class WorkspaceNode(BaseConfig):
|
| 52 |
# Most of these fields are shared with ReactFlow.
|