Spaces:
Running
Running
Update docs, op_registration.
Browse files
docs/guides/plugins.md
CHANGED
|
@@ -57,7 +57,12 @@ Let's review the changes we made.
|
|
| 57 |
|
| 58 |
The [`@op`](../reference/lynxkite-core/ops.md#lynxkite.core.ops.op) decorator registers a
|
| 59 |
function as a LynxKite operation. The first argument is the name of the environment,
|
| 60 |
-
the
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
When defining multiple operations, you can use
|
| 63 |
[`ops.op_registration`](../reference/lynxkite-core/ops.md#lynxkite.core.ops.op_registration)
|
|
|
|
| 57 |
|
| 58 |
The [`@op`](../reference/lynxkite-core/ops.md#lynxkite.core.ops.op) decorator registers a
|
| 59 |
function as a LynxKite operation. The first argument is the name of the environment,
|
| 60 |
+
the last argument is the name of the operation. Between the two, you can list the hierarchy of
|
| 61 |
+
categories the operation belongs to. For example:
|
| 62 |
+
|
| 63 |
+
```python
|
| 64 |
+
@op("LynxKite Graph Analytics", "Machine learning", "Preprocessing", "Split train/test set")
|
| 65 |
+
```
|
| 66 |
|
| 67 |
When defining multiple operations, you can use
|
| 68 |
[`ops.op_registration`](../reference/lynxkite-core/ops.md#lynxkite.core.ops.op_registration)
|
lynxkite-core/src/lynxkite/core/ops.py
CHANGED
|
@@ -417,14 +417,14 @@ def register_executor(env: str):
|
|
| 417 |
return decorator
|
| 418 |
|
| 419 |
|
| 420 |
-
def op_registration(env: str):
|
| 421 |
"""Returns a decorator that can be used for registering functions as operations."""
|
| 422 |
-
return functools.partial(op, env)
|
| 423 |
|
| 424 |
|
| 425 |
-
def passive_op_registration(env: str):
|
| 426 |
"""Returns a function that can be used to register operations without associated code."""
|
| 427 |
-
return functools.partial(register_passive_op, env)
|
| 428 |
|
| 429 |
|
| 430 |
def make_async(func):
|
|
|
|
| 417 |
return decorator
|
| 418 |
|
| 419 |
|
| 420 |
+
def op_registration(env: str, *categories: str):
|
| 421 |
"""Returns a decorator that can be used for registering functions as operations."""
|
| 422 |
+
return functools.partial(op, env, *categories)
|
| 423 |
|
| 424 |
|
| 425 |
+
def passive_op_registration(env: str, *categories: str):
|
| 426 |
"""Returns a function that can be used to register operations without associated code."""
|
| 427 |
+
return functools.partial(register_passive_op, env, *categories)
|
| 428 |
|
| 429 |
|
| 430 |
def make_async(func):
|