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

georgia-tech-db / eva / a75d4cdb-5478-400d-88b6-c219d38db53a

27 Oct 2023 06:59AM UTC coverage: 72.758% (+72.8%) from 0.0%
a75d4cdb-5478-400d-88b6-c219d38db53a

Pull #1308

circle-ci

dungnmaster
linting changes
Pull Request #1308: Job scheduler changes

289 of 289 new or added lines in 17 files covered. (100.0%)

9332 of 12826 relevant lines covered (72.76%)

0.73 hits per line

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

70.37
/evadb/catalog/models/job_catalog.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

16
import datetime
1✔
17
import json
1✔
18

19
from sqlalchemy import Boolean, Column, DateTime, Index, Integer, String
1✔
20

21
from evadb.catalog.models.base_model import BaseModel
1✔
22
from evadb.catalog.models.utils import JobCatalogEntry
1✔
23

24

25
class JobCatalog(BaseModel):
1✔
26
    """The `JobCatalog` catalog stores information about all the created Jobs.
27
    `_row_id:` an autogenerated unique identifier.
28
    `_name:` the job name.
29
    `_queries:` the queries to run as part of this job
30
    `_start_time:` the job's start time
31
    `_end_time:` the job's end time
32
    `_repeat_interval:` the job's repeat interval
33
    `_repeat_period:` the job's repeat period
34
    `_active:` is the job active/deleted
35
    `_next_scheduled_run:` the next trigger time for the job as per the schedule
36
    `_created_at:` entry creation time
37
    `_updated_at:` entry last update time
38
    """
39

40
    __tablename__ = "job_catalog"
1✔
41

42
    _name = Column("name", String(100), unique=True)
1✔
43
    _queries = Column("queries", String, nullable=False)
1✔
44
    _start_time = Column("start_time", DateTime, default=datetime.datetime.now)
1✔
45
    _end_time = Column("end_ts", DateTime)
1✔
46
    _repeat_interval = Column("repeat_interval", Integer)
1✔
47
    _active = Column("active", Boolean, default=True)
1✔
48
    _next_scheduled_run = Column("next_scheduled_run", DateTime)
1✔
49

50
    _created_at = Column("created_at", DateTime, default=datetime.datetime.now)
1✔
51
    _updated_at = Column(
1✔
52
        "updated_at",
53
        DateTime,
54
        default=datetime.datetime.now,
55
        onupdate=datetime.datetime.now,
56
    )
57

58
    _next_run_index = Index("_next_run_index", _next_scheduled_run)
1✔
59

60
    def __init__(
1✔
61
        self,
62
        name: str,
63
        queries: str,
64
        start_time: datetime,
65
        end_time: datetime,
66
        repeat_interval: Integer,
67
        active: bool,
68
        next_schedule_run: datetime,
69
    ):
70
        self._name = name
×
71
        self._queries = queries
×
72
        self._start_time = start_time
×
73
        self._end_time = end_time
×
74
        self._repeat_interval = repeat_interval
×
75
        self._active = active
×
76
        self._next_scheduled_run = next_schedule_run
×
77

78
    def as_dataclass(self) -> "JobCatalogEntry":
1✔
79
        return JobCatalogEntry(
×
80
            row_id=self._row_id,
81
            name=self._name,
82
            queries=json.loads(self._queries),
83
            start_time=self._start_time,
84
            end_time=self._end_time,
85
            repeat_interval=self._repeat_interval,
86
            active=self._active,
87
            next_scheduled_run=self._next_scheduled_run,
88
            created_at=self._created_at,
89
            updated_at=self._updated_at,
90
        )
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