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

georgia-tech-db / eva / cf748690-046a-4f45-983b-b5ca63416eda

pending completion
cf748690-046a-4f45-983b-b5ca63416eda

Pull #582

circle-ci

jarulraj
checkpoint
Pull Request #582: server: asyncio refactoring

150 of 150 new or added lines in 7 files covered. (100.0%)

7887 of 8618 relevant lines covered (91.52%)

0.92 hits per line

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

69.44
/eva/eva_server.py
1
# coding=utf-8
2
# Copyright 2018-2022 EVA
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
import argparse
1✔
16
import asyncio
1✔
17
import sys
1✔
18
from os.path import abspath, dirname, join
1✔
19
from signal import SIGTERM
1✔
20

21
from psutil import process_iter
1✔
22

23
"""
24
To allow running eva_server from any location
25
"""
26
THIS_DIR = dirname(__file__)
1✔
27
EVA_CODE_DIR = abspath(join(THIS_DIR, ".."))
1✔
28
sys.path.append(EVA_CODE_DIR)
1✔
29

30
from eva.configuration.configuration_manager import ConfigurationManager  # noqa: E402
1✔
31
from eva.server.server import EvaServer  # noqa: E402
1✔
32
from eva.udfs.udf_bootstrap_queries import init_builtin_udfs  # noqa: E402
1✔
33

34

35
async def start_eva_server():
1✔
36
    """
37
    Start the eva server
38
    """
39
    # Get the hostname and port information from the configuration file
40
    config = ConfigurationManager()
×
41
    host = config.get_value("server", "host")
×
42
    port = config.get_value("server", "port")
×
43

44
    eva_server = EvaServer()
×
45

46
    await eva_server.start_eva_server(host, port)
×
47

48

49
def stop_server():
1✔
50
    """
51
    Stop the eva server
52
    """
53
    for proc in process_iter():
1✔
54
        if proc.name() == "eva_server":
1✔
55
            proc.send_signal(SIGTERM)
1✔
56

57
    return 0
×
58

59

60
def main():
1✔
61
    parser = argparse.ArgumentParser(description="EVA Server")
1✔
62

63
    parser.add_argument(
1✔
64
        "--start",
65
        help="start server",
66
        action="store_true",
67
        default=True,
68
    )
69

70
    parser.add_argument(
1✔
71
        "--stop",
72
        help="stop server",
73
        action="store_true",
74
        default=False,
75
    )
76

77
    ## PARSE ARGS
78
    args, unknown = parser.parse_known_args()
1✔
79

80
    # Stop server
81
    if args.stop:
1✔
82
        return stop_server()
1✔
83

84
    # Start server
85
    if args.start:
×
86
        mode = ConfigurationManager().get_value("core", "mode")
×
87
        init_builtin_udfs(mode=mode)
×
88

89
        asyncio.run(start_eva_server())
×
90

91

92
if __name__ == "__main__":
1✔
93
    # execute only if run as the entry point into the program
94
    main()
×
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

© 2025 Coveralls, Inc