-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathmaterialization_job.py
More file actions
61 lines (46 loc) · 1.42 KB
/
materialization_job.py
File metadata and controls
61 lines (46 loc) · 1.42 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
53
54
55
56
57
58
59
60
61
import enum
from abc import ABC, abstractmethod
from dataclasses import dataclass
from datetime import datetime
from typing import Callable, Optional, Union
from tqdm import tqdm
from feast import BatchFeatureView, FeatureView, StreamFeatureView
@dataclass
class MaterializationTask:
"""
A MaterializationTask represents a unit of data that needs to be materialized from an
offline store to an online store.
"""
project: str
feature_view: Union[BatchFeatureView, StreamFeatureView, FeatureView]
start_time: datetime
end_time: datetime
only_latest: bool = True
tqdm_builder: Union[None, Callable[[int], tqdm]] = None
disable_event_timestamp: bool = False
class MaterializationJobStatus(enum.Enum):
WAITING = 1
RUNNING = 2
AVAILABLE = 3
ERROR = 4
CANCELLING = 5
CANCELLED = 6
SUCCEEDED = 7
PAUSED = 8
RETRYING = 9
class MaterializationJob(ABC):
"""
A MaterializationJob represents an ongoing or executed process that materializes data as per the
definition of a materialization task.
"""
task: MaterializationTask
@abstractmethod
def status(self) -> MaterializationJobStatus: ...
@abstractmethod
def error(self) -> Optional[BaseException]: ...
@abstractmethod
def should_be_retried(self) -> bool: ...
@abstractmethod
def job_id(self) -> str: ...
@abstractmethod
def url(self) -> Optional[str]: ...