openspg/python/knext/chain/builder_chain.py

35 lines
846 B
Python
Raw Normal View History

2023-12-11 23:13:19 +08:00
from typing import Union, List
2023-12-06 17:26:39 +08:00
from knext.chain.base import Chain
2023-12-11 23:13:19 +08:00
from knext.client.builder import BuilderClient
from knext.client.model.builder_job import BuilderJob
2023-12-06 17:26:39 +08:00
from knext.component.builder.extractor import SPGExtractor
from knext.component.builder.mapping import Mapping
from knext.component.builder.sink_writer import SinkWriter
from knext.component.builder.source_reader import SourceReader
2023-12-11 23:13:19 +08:00
class BuilderChain(Chain):
2023-12-06 17:26:39 +08:00
2023-12-11 23:13:19 +08:00
source_node: SourceReader
2023-12-06 17:26:39 +08:00
2023-12-11 23:13:19 +08:00
process_nodes: List[Union[SPGExtractor, Mapping]]
2023-12-06 17:26:39 +08:00
2023-12-11 23:13:19 +08:00
sink_node: SinkWriter
2023-12-06 17:26:39 +08:00
@property
def input_types(self):
return None
@property
def output_types(self):
return None
2023-12-08 11:25:26 +08:00
@classmethod
def from_config(cls):
return cls()
2023-12-11 23:13:19 +08:00
def invoke(self, **kwargs):
client = BuilderClient(**kwargs)
client.execute(self, **kwargs)