• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

georgia-tech-db / eva / e4f99d26-a857-4f78-b9e8-041e4254b9e1

18 Aug 2023 05:49AM UTC coverage: 94.434% (-0.8%) from 95.277%
e4f99d26-a857-4f78-b9e8-041e4254b9e1

Pull #935

circle-ci

xzdandy
remove print
Pull Request #935: Ludwig-based model train and tune support.

92 of 92 new or added lines in 10 files covered. (100.0%)

10264 of 10869 relevant lines covered (94.43%)

1.89 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

77.08
/evadb/executor/abstract_executor.py
1
# coding=utf-8
2
# Copyright 2018-2023 EvaDB
3
#
4
# Licensed under the Apache License, Version 2.0 (the "License");
5
# you may not use this file except in compliance with the License.
6
# You may obtain a copy of the License at
7
#
8
#     http://www.apache.org/licenses/LICENSE-2.0
9
#
10
# Unless required by applicable law or agreed to in writing, software
11
# distributed under the License is distributed on an "AS IS" BASIS,
12
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
# See the License for the specific language governing permissions and
14
# limitations under the License.
15
from abc import ABC, abstractmethod
2✔
16
from collections import deque
2✔
17
from typing import TYPE_CHECKING, Any, Generator, Iterable, List, TypeVar
2✔
18

19
if TYPE_CHECKING:
20
    from evadb.catalog.catalog_manager import CatalogManager
21
from evadb.configuration.configuration_manager import ConfigurationManager
2✔
22
from evadb.database import EvaDBDatabase
2✔
23
from evadb.models.storage.batch import Batch
2✔
24
from evadb.plan_nodes.abstract_plan import AbstractPlan
2✔
25

26
AbstractExecutor = TypeVar("AbstractExecutor")
2✔
27

28

29
class AbstractExecutor(ABC):
2✔
30
    """
31
    An abstract class for the executor engine
32
    Arguments:
33
        node (AbstractPlan): Plan node corresponding to this executor
34
    """
35

36
    def __init__(self, db: EvaDBDatabase, node: AbstractPlan):
2✔
37
        self._db = db
2✔
38
        self._node = node
2✔
39
        self._config: ConfigurationManager = db.config if db else None
2✔
40
        self._children = []
2✔
41

42
    def catalog(self) -> "CatalogManager":
2✔
43
        """The object is intentionally generated on demand to prevent serialization issues. Having a SQLAlchemy object as a member variable can cause problems with multiprocessing. See get_catalog_instance()"""
44
        return self._db.catalog() if self._db else None
2✔
45

46
    def append_child(self, child: AbstractExecutor):
2✔
47
        """
48
        appends a child executor node
49

50
        Arguments:
51
            child {AbstractExecutor} -- child node
52
        """
53
        self._children.append(child)
2✔
54

55
    @property
2✔
56
    def children(self) -> List[AbstractExecutor]:
2✔
57
        """
58
        Returns the list of child executor
59
        Returns:
60
            [] -- list of children
61
        """
62
        return self._children
2✔
63

64
    @children.setter
2✔
65
    def children(self, children):
2✔
66
        self._children = children
×
67

68
    @property
2✔
69
    def node(self) -> AbstractPlan:
2✔
70
        return self._node
2✔
71

72
    @property
2✔
73
    def db(self) -> EvaDBDatabase:
2✔
74
        return self._db
2✔
75

76
    @property
2✔
77
    def config(self) -> ConfigurationManager:
2✔
78
        return self._config
2✔
79

80
    @abstractmethod
2✔
81
    def exec(self, *args, **kwargs) -> Iterable[Batch]:
2✔
82
        """
83
        This method is implemented by every executor.
84
        Contains logic for that executor;
85
        For retrieval based executor : It fetches frame batches from
86
        child nodes and emits it to parent node.
87
        """
88

89
    def __call__(self, *args, **kwargs) -> Generator[Batch, None, None]:
2✔
90
        yield from self.exec(*args, **kwargs)
×
91

92
    def bfs(self):
2✔
93
        """Returns a generator which visits all nodes in execution tree in
94
        breadth-first search (BFS) traversal order.
95

96
        Returns:
97
            the generator object.
98
        """
99
        queue = deque([self])
×
100
        while queue:
×
101
            node = queue.popleft()
×
102
            yield node
×
103
            for child in node.children:
×
104
                queue.append(child)
×
105

106
    def find_all(self, execution_type: Any):
2✔
107
        """Returns a generator which visits all the nodes in execution tree and yields one that matches the passed `execution_type`.
108

109
        Args:
110
            execution_type (Any): execution type to match with
111

112
        Returns:
113
            the generator object.
114
        """
115

116
        for node in self.bfs():
×
117
            if isinstance(node, execution_type):
×
118
                yield node
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc