forked from feldera/feldera
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpipeline.py
More file actions
52 lines (45 loc) · 1.86 KB
/
Copy pathpipeline.py
File metadata and controls
52 lines (45 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
from typing import Mapping, Any, Optional
from feldera.rest.attached_connector import AttachedConnector
class Pipeline:
"""
Represents a Feldera pipeline
"""
def __init__(
self,
name: str,
program_name: str,
description: Optional[str] = None,
attached_connectors: Optional[list[AttachedConnector]] = None,
config: Optional[Mapping[str, Any]] = None,
state: Optional[Mapping[str, Any]] = None,
version: int = 0,
id: Optional[str] = None
):
"""
Initializes a new pipeline
:param name: The name of the pipeline
:param program_name: The name of the program that the pipeline is based on
:param description: Optional. The description of the pipeline
:param attached_connectors: Optional. The connectors attached to the pipeline
:param config: Optional. The configuration of the pipeline
:param state: Optional. The state of the pipeline. Not to be set by the user
:param version: The version of the pipeline. Not to be set by the user
:param id: Optional. The id of the pipeline. Not to be set by the user
"""
self.name: str = name
self.program_name: str = program_name
self.description: Optional[str] = description
self.attached_connectors: list[AttachedConnector] = attached_connectors or []
self.config: Mapping[str, Any] = config or Pipeline.default_config()
self.state: Optional[Mapping[str, Any]] = state
self.version: int = version
self.id: Optional[str] = id
@staticmethod
def default_config() -> Mapping[str, Any]:
"""
Returns the default configuration for the pipeline
"""
# default, taken from the UI
return {
"workers": 8
}