argus-alm 0.12.10__py3-none-any.whl → 0.13.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- argus/client/base.py +1 -1
- argus/client/driver_matrix_tests/cli.py +2 -2
- argus/client/driver_matrix_tests/client.py +1 -1
- argus/client/generic/cli.py +2 -2
- argus/client/sct/client.py +3 -3
- argus/client/sirenada/client.py +1 -1
- {argus_alm-0.12.10.dist-info → argus_alm-0.13.0.dist-info}/METADATA +2 -4
- argus_alm-0.13.0.dist-info/RECORD +20 -0
- argus/backend/.gitkeep +0 -0
- argus/backend/cli.py +0 -41
- argus/backend/controller/__init__.py +0 -0
- argus/backend/controller/admin.py +0 -20
- argus/backend/controller/admin_api.py +0 -354
- argus/backend/controller/api.py +0 -529
- argus/backend/controller/auth.py +0 -67
- argus/backend/controller/client_api.py +0 -108
- argus/backend/controller/main.py +0 -274
- argus/backend/controller/notification_api.py +0 -72
- argus/backend/controller/notifications.py +0 -13
- argus/backend/controller/team.py +0 -126
- argus/backend/controller/team_ui.py +0 -18
- argus/backend/controller/testrun_api.py +0 -482
- argus/backend/controller/view_api.py +0 -162
- argus/backend/db.py +0 -100
- argus/backend/error_handlers.py +0 -21
- argus/backend/events/event_processors.py +0 -34
- argus/backend/models/__init__.py +0 -0
- argus/backend/models/result.py +0 -138
- argus/backend/models/web.py +0 -389
- argus/backend/plugins/__init__.py +0 -0
- argus/backend/plugins/core.py +0 -225
- argus/backend/plugins/driver_matrix_tests/controller.py +0 -63
- argus/backend/plugins/driver_matrix_tests/model.py +0 -421
- argus/backend/plugins/driver_matrix_tests/plugin.py +0 -22
- argus/backend/plugins/driver_matrix_tests/raw_types.py +0 -62
- argus/backend/plugins/driver_matrix_tests/service.py +0 -60
- argus/backend/plugins/driver_matrix_tests/udt.py +0 -42
- argus/backend/plugins/generic/model.py +0 -79
- argus/backend/plugins/generic/plugin.py +0 -16
- argus/backend/plugins/generic/types.py +0 -13
- argus/backend/plugins/loader.py +0 -40
- argus/backend/plugins/sct/controller.py +0 -185
- argus/backend/plugins/sct/plugin.py +0 -38
- argus/backend/plugins/sct/resource_setup.py +0 -178
- argus/backend/plugins/sct/service.py +0 -491
- argus/backend/plugins/sct/testrun.py +0 -272
- argus/backend/plugins/sct/udt.py +0 -101
- argus/backend/plugins/sirenada/model.py +0 -113
- argus/backend/plugins/sirenada/plugin.py +0 -17
- argus/backend/service/admin.py +0 -27
- argus/backend/service/argus_service.py +0 -688
- argus/backend/service/build_system_monitor.py +0 -188
- argus/backend/service/client_service.py +0 -122
- argus/backend/service/event_service.py +0 -18
- argus/backend/service/jenkins_service.py +0 -240
- argus/backend/service/notification_manager.py +0 -150
- argus/backend/service/release_manager.py +0 -230
- argus/backend/service/results_service.py +0 -317
- argus/backend/service/stats.py +0 -540
- argus/backend/service/team_manager_service.py +0 -83
- argus/backend/service/testrun.py +0 -559
- argus/backend/service/user.py +0 -307
- argus/backend/service/views.py +0 -258
- argus/backend/template_filters.py +0 -27
- argus/backend/tests/__init__.py +0 -0
- argus/backend/tests/argus_web.test.yaml +0 -39
- argus/backend/tests/conftest.py +0 -44
- argus/backend/tests/results_service/__init__.py +0 -0
- argus/backend/tests/results_service/test_best_results.py +0 -70
- argus/backend/util/common.py +0 -65
- argus/backend/util/config.py +0 -38
- argus/backend/util/encoders.py +0 -41
- argus/backend/util/logsetup.py +0 -81
- argus/backend/util/module_loaders.py +0 -30
- argus/backend/util/send_email.py +0 -91
- argus/client/generic_result_old.py +0 -143
- argus/db/.gitkeep +0 -0
- argus/db/argus_json.py +0 -14
- argus/db/cloud_types.py +0 -125
- argus/db/config.py +0 -135
- argus/db/db_types.py +0 -139
- argus/db/interface.py +0 -370
- argus/db/testrun.py +0 -740
- argus/db/utils.py +0 -15
- argus_alm-0.12.10.dist-info/RECORD +0 -96
- /argus/{backend → common}/__init__.py +0 -0
- /argus/{backend/util → common}/enums.py +0 -0
- /argus/{backend/plugins/sct/types.py → common/sct_types.py} +0 -0
- /argus/{backend/plugins/sirenada/types.py → common/sirenada_types.py} +0 -0
- {argus_alm-0.12.10.dist-info → argus_alm-0.13.0.dist-info}/LICENSE +0 -0
- {argus_alm-0.12.10.dist-info → argus_alm-0.13.0.dist-info}/WHEEL +0 -0
- {argus_alm-0.12.10.dist-info → argus_alm-0.13.0.dist-info}/entry_points.txt +0 -0
argus/backend/plugins/core.py
DELETED
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
import logging
|
|
2
|
-
from datetime import datetime
|
|
3
|
-
from math import ceil
|
|
4
|
-
from uuid import UUID
|
|
5
|
-
from time import time
|
|
6
|
-
|
|
7
|
-
from cassandra.cqlengine import columns
|
|
8
|
-
from cassandra.cqlengine.models import Model
|
|
9
|
-
from cassandra.cqlengine.usertype import UserType
|
|
10
|
-
from flask import Blueprint
|
|
11
|
-
from argus.backend.db import ScyllaCluster
|
|
12
|
-
from argus.backend.models.web import (
|
|
13
|
-
ArgusTest,
|
|
14
|
-
ArgusGroup,
|
|
15
|
-
ArgusRelease,
|
|
16
|
-
ArgusScheduleGroup,
|
|
17
|
-
ArgusSchedule,
|
|
18
|
-
ArgusScheduleTest,
|
|
19
|
-
ArgusScheduleAssignee,
|
|
20
|
-
ArgusUserView,
|
|
21
|
-
User
|
|
22
|
-
)
|
|
23
|
-
from argus.backend.util.common import chunk
|
|
24
|
-
from argus.backend.util.enums import TestInvestigationStatus, TestStatus
|
|
25
|
-
|
|
26
|
-
LOGGER = logging.getLogger(__name__)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
class PluginModelBase(Model):
|
|
30
|
-
_plugin_name = "unknown"
|
|
31
|
-
# Metadata
|
|
32
|
-
build_id = columns.Text(required=True, partition_key=True)
|
|
33
|
-
start_time = columns.DateTime(required=True, primary_key=True, clustering_order="DESC", default=datetime.utcnow, custom_index=True)
|
|
34
|
-
id = columns.UUID(index=True, required=True)
|
|
35
|
-
release_id = columns.UUID(index=True)
|
|
36
|
-
group_id = columns.UUID(index=True)
|
|
37
|
-
test_id = columns.UUID(index=True)
|
|
38
|
-
assignee = columns.UUID(index=True)
|
|
39
|
-
status = columns.Text(default=lambda: TestStatus.CREATED.value)
|
|
40
|
-
investigation_status = columns.Text(default=lambda: TestInvestigationStatus.NOT_INVESTIGATED.value)
|
|
41
|
-
heartbeat = columns.Integer(default=lambda: int(time()))
|
|
42
|
-
end_time = columns.DateTime(default=lambda: datetime.utcfromtimestamp(0))
|
|
43
|
-
build_job_url = columns.Text()
|
|
44
|
-
product_version = columns.Text(index=True)
|
|
45
|
-
|
|
46
|
-
# Test Logs Collection
|
|
47
|
-
logs = columns.List(value_type=columns.Tuple(columns.Text(), columns.Text()))
|
|
48
|
-
|
|
49
|
-
@classmethod
|
|
50
|
-
def table_name(cls) -> str:
|
|
51
|
-
return cls.__table_name__
|
|
52
|
-
|
|
53
|
-
@classmethod
|
|
54
|
-
def _stats_query(cls) -> str:
|
|
55
|
-
raise NotImplementedError()
|
|
56
|
-
|
|
57
|
-
def assign_categories(self):
|
|
58
|
-
key = self.build_id
|
|
59
|
-
try:
|
|
60
|
-
test: ArgusTest = ArgusTest.get(build_system_id=key)
|
|
61
|
-
self.release_id = test.release_id
|
|
62
|
-
self.group_id = test.group_id
|
|
63
|
-
self.test_id = test.id
|
|
64
|
-
if not test.plugin_name or test.plugin_name != self._plugin_name:
|
|
65
|
-
test.plugin_name = self._plugin_name
|
|
66
|
-
test.save()
|
|
67
|
-
except ArgusTest.DoesNotExist:
|
|
68
|
-
LOGGER.warning("Test entity missing for key \"%s\", run won't be visible until this is corrected", key)
|
|
69
|
-
|
|
70
|
-
def get_scheduled_assignee(self) -> UUID:
|
|
71
|
-
"""
|
|
72
|
-
Iterate over all schedules (groups and tests) and return first available assignee
|
|
73
|
-
"""
|
|
74
|
-
associated_test = ArgusTest.get(build_system_id=self.build_id)
|
|
75
|
-
associated_group = ArgusGroup.get(id=associated_test.group_id)
|
|
76
|
-
associated_release = ArgusRelease.get(id=associated_test.release_id)
|
|
77
|
-
|
|
78
|
-
scheduled_groups = ArgusScheduleGroup.filter(
|
|
79
|
-
release_id=associated_release.id,
|
|
80
|
-
group_id=associated_group.id,
|
|
81
|
-
).all()
|
|
82
|
-
|
|
83
|
-
scheduled_tests = ArgusScheduleTest.filter(
|
|
84
|
-
release_id=associated_release.id,
|
|
85
|
-
test_id=associated_test.id
|
|
86
|
-
).all()
|
|
87
|
-
|
|
88
|
-
unique_schedule_ids = {scheduled_obj.schedule_id for scheduled_obj in [
|
|
89
|
-
*scheduled_tests, *scheduled_groups]}
|
|
90
|
-
|
|
91
|
-
schedules = ArgusSchedule.filter(
|
|
92
|
-
release_id=associated_release.id,
|
|
93
|
-
id__in=tuple(unique_schedule_ids),
|
|
94
|
-
).all()
|
|
95
|
-
|
|
96
|
-
today = datetime.utcnow()
|
|
97
|
-
|
|
98
|
-
valid_schedules = []
|
|
99
|
-
for schedule in schedules:
|
|
100
|
-
if schedule.period_start <= today <= schedule.period_end:
|
|
101
|
-
valid_schedules.append(schedule)
|
|
102
|
-
|
|
103
|
-
assignees_uuids = []
|
|
104
|
-
for schedule in valid_schedules:
|
|
105
|
-
assignees = ArgusScheduleAssignee.filter(
|
|
106
|
-
schedule_id=schedule.id
|
|
107
|
-
).all()
|
|
108
|
-
assignees_uuids.extend([assignee.assignee for assignee in assignees])
|
|
109
|
-
|
|
110
|
-
return assignees_uuids[0] if len(assignees_uuids) > 0 else None
|
|
111
|
-
|
|
112
|
-
@classmethod
|
|
113
|
-
def get_jobs_assigned_to_user(cls, user_id: str | UUID):
|
|
114
|
-
cluster = ScyllaCluster.get()
|
|
115
|
-
query = cluster.prepare("SELECT build_id, start_time, release_id, group_id, assignee, "
|
|
116
|
-
f"test_id, id, status, investigation_status, build_job_url, scylla_version FROM {cls.table_name()} WHERE assignee = ?")
|
|
117
|
-
rows = cluster.session.execute(query=query, parameters=(user_id,))
|
|
118
|
-
|
|
119
|
-
return list(rows)
|
|
120
|
-
|
|
121
|
-
@classmethod
|
|
122
|
-
def get_jobs_meta_by_test_id(cls, test_id: UUID):
|
|
123
|
-
cluster = ScyllaCluster.get()
|
|
124
|
-
query = cluster.prepare(f"SELECT build_id, start_time, id, test_id, release_id, group_id, status, investigation_status FROM {cls.table_name()} WHERE test_id = ?")
|
|
125
|
-
rows = cluster.session.execute(query=query, parameters=(test_id,))
|
|
126
|
-
|
|
127
|
-
return list(rows)
|
|
128
|
-
|
|
129
|
-
@classmethod
|
|
130
|
-
def prepare_investigation_status_update_query(cls, build_id: str, start_time: datetime, new_status: TestInvestigationStatus):
|
|
131
|
-
cluster = ScyllaCluster.get()
|
|
132
|
-
query = cluster.prepare(f"UPDATE {cls.table_name()} SET investigation_status = ? WHERE build_id = ? AND start_time = ?")
|
|
133
|
-
bound_query = query.bind(values=(new_status.value, build_id, start_time))
|
|
134
|
-
|
|
135
|
-
return bound_query
|
|
136
|
-
|
|
137
|
-
@classmethod
|
|
138
|
-
def get_stats_for_release(cls, release: ArgusRelease, build_ids=list[str]):
|
|
139
|
-
cluster = ScyllaCluster.get()
|
|
140
|
-
query = cluster.prepare(cls._stats_query())
|
|
141
|
-
futures = []
|
|
142
|
-
step_size = 90
|
|
143
|
-
|
|
144
|
-
for step in range(0, ceil(len(build_ids) / step_size)):
|
|
145
|
-
start_pos = step*step_size
|
|
146
|
-
next_slice = build_ids[start_pos:start_pos+step_size]
|
|
147
|
-
futures.append(cluster.session.execute_async(query=query, parameters=(next_slice,)))
|
|
148
|
-
|
|
149
|
-
return futures
|
|
150
|
-
@classmethod
|
|
151
|
-
def get_run_meta_by_build_id(cls, build_id: str, limit: int = 10):
|
|
152
|
-
cluster = ScyllaCluster.get()
|
|
153
|
-
query = cluster.prepare("SELECT id, test_id, group_id, release_id, status, start_time, build_job_url, build_id, "
|
|
154
|
-
f"assignee, end_time, investigation_status, heartbeat FROM {cls.table_name()} WHERE build_id = ? LIMIT ?")
|
|
155
|
-
rows = cluster.session.execute(query=query, parameters=(build_id, limit))
|
|
156
|
-
|
|
157
|
-
return list(rows)
|
|
158
|
-
|
|
159
|
-
@classmethod
|
|
160
|
-
def get_run_meta_by_run_id(cls, run_id: UUID | str):
|
|
161
|
-
cluster = ScyllaCluster.get()
|
|
162
|
-
query = cluster.prepare("SELECT id, test_id, group_id, release_id, status, start_time, build_job_url, build_id, "
|
|
163
|
-
f"assignee, end_time, investigation_status, heartbeat FROM {cls.table_name()} WHERE id = ?")
|
|
164
|
-
rows = cluster.session.execute(query=query, parameters=(run_id,))
|
|
165
|
-
|
|
166
|
-
return list(rows)
|
|
167
|
-
|
|
168
|
-
@classmethod
|
|
169
|
-
def load_test_run(cls, run_id: UUID) -> 'PluginModelBase':
|
|
170
|
-
raise NotImplementedError()
|
|
171
|
-
|
|
172
|
-
@classmethod
|
|
173
|
-
def submit_run(cls, request_data: dict) -> 'PluginModelBase':
|
|
174
|
-
raise NotImplementedError()
|
|
175
|
-
|
|
176
|
-
@classmethod
|
|
177
|
-
def get_distinct_product_versions(cls, release: ArgusRelease) -> list[str]:
|
|
178
|
-
raise NotImplementedError()
|
|
179
|
-
|
|
180
|
-
@classmethod
|
|
181
|
-
def get_distinct_versions_for_view(cls, tests: list[ArgusTest]) -> list[str]:
|
|
182
|
-
cluster = ScyllaCluster.get()
|
|
183
|
-
statement = cluster.prepare(f"SELECT scylla_version FROM {cls.table_name()} WHERE build_id IN ?")
|
|
184
|
-
futures = []
|
|
185
|
-
for batch in chunk(tests):
|
|
186
|
-
futures.append(cluster.session.execute_async(query=statement, parameters=([t.build_system_id for t in batch],)))
|
|
187
|
-
|
|
188
|
-
rows = []
|
|
189
|
-
for future in futures:
|
|
190
|
-
rows.extend(future.result())
|
|
191
|
-
unique_versions = {r["scylla_version"] for r in rows if r["scylla_version"]}
|
|
192
|
-
|
|
193
|
-
return sorted(list(unique_versions), reverse=True)
|
|
194
|
-
|
|
195
|
-
def update_heartbeat(self):
|
|
196
|
-
self.heartbeat = int(time())
|
|
197
|
-
|
|
198
|
-
def change_status(self, new_status: TestStatus):
|
|
199
|
-
self.status = new_status.value
|
|
200
|
-
|
|
201
|
-
def change_investigation_status(self, new_investigation_status: TestInvestigationStatus):
|
|
202
|
-
self.investigation_status = new_investigation_status.value
|
|
203
|
-
|
|
204
|
-
def submit_product_version(self, version: str):
|
|
205
|
-
raise NotImplementedError()
|
|
206
|
-
|
|
207
|
-
def set_full_version(self, version: str):
|
|
208
|
-
self.product_version = version
|
|
209
|
-
|
|
210
|
-
def submit_logs(self, logs: list[dict]):
|
|
211
|
-
raise NotImplementedError()
|
|
212
|
-
|
|
213
|
-
def finish_run(self, payload: dict = None):
|
|
214
|
-
raise NotImplementedError()
|
|
215
|
-
|
|
216
|
-
def sut_timestamp(self) -> float:
|
|
217
|
-
raise NotImplementedError()
|
|
218
|
-
|
|
219
|
-
class PluginInfoBase:
|
|
220
|
-
# pylint: disable=too-few-public-methods
|
|
221
|
-
name: str
|
|
222
|
-
controller: Blueprint
|
|
223
|
-
model: PluginModelBase
|
|
224
|
-
all_models: list[Model]
|
|
225
|
-
all_types: list[UserType]
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
from flask import Blueprint, request
|
|
2
|
-
|
|
3
|
-
from argus.backend.error_handlers import handle_api_exception
|
|
4
|
-
from argus.backend.plugins.driver_matrix_tests.raw_types import DriverMatrixSubmitEnvRequest, DriverMatrixSubmitFailureRequest, DriverMatrixSubmitResultRequest
|
|
5
|
-
from argus.backend.service.user import api_login_required
|
|
6
|
-
from argus.backend.plugins.driver_matrix_tests.service import DriverMatrixService
|
|
7
|
-
from argus.backend.util.common import get_payload
|
|
8
|
-
|
|
9
|
-
bp = Blueprint("driver_matrix_api", __name__, url_prefix="/driver_matrix")
|
|
10
|
-
bp.register_error_handler(Exception, handle_api_exception)
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
@bp.route("/test_report", methods=["GET"])
|
|
14
|
-
@api_login_required
|
|
15
|
-
def driver_matrix_test_report():
|
|
16
|
-
|
|
17
|
-
build_id = request.args.get("buildId")
|
|
18
|
-
if not build_id:
|
|
19
|
-
raise Exception("No build id provided")
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
result = DriverMatrixService().tested_versions_report(build_id=build_id)
|
|
23
|
-
return {
|
|
24
|
-
"status": "ok",
|
|
25
|
-
"response": result
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
@bp.route("/result/submit", methods=["POST"])
|
|
29
|
-
@api_login_required
|
|
30
|
-
def submit_result():
|
|
31
|
-
payload = get_payload(request)
|
|
32
|
-
request_data = DriverMatrixSubmitResultRequest(**payload)
|
|
33
|
-
|
|
34
|
-
result = DriverMatrixService().submit_driver_result(driver_name=request_data.driver_name, driver_type=request_data.driver_type, run_id=request_data.run_id, raw_xml=request_data.raw_xml)
|
|
35
|
-
return {
|
|
36
|
-
"status": "ok",
|
|
37
|
-
"response": result
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
@bp.route("/result/fail", methods=["POST"])
|
|
42
|
-
@api_login_required
|
|
43
|
-
def submit_failure():
|
|
44
|
-
payload = get_payload(request)
|
|
45
|
-
request_data = DriverMatrixSubmitFailureRequest(**payload)
|
|
46
|
-
|
|
47
|
-
result = DriverMatrixService().submit_driver_failure(driver_name=request_data.driver_name, driver_type=request_data.driver_type, run_id=request_data.run_id, failure_reason=request_data.failure_reason)
|
|
48
|
-
return {
|
|
49
|
-
"status": "ok",
|
|
50
|
-
"response": result
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
@bp.route("/env/submit", methods=["POST"])
|
|
54
|
-
@api_login_required
|
|
55
|
-
def submit_env():
|
|
56
|
-
payload = get_payload(request)
|
|
57
|
-
request_data = DriverMatrixSubmitEnvRequest(**payload)
|
|
58
|
-
|
|
59
|
-
result = DriverMatrixService().submit_env_info(run_id=request_data.run_id, raw_env=request_data.raw_env)
|
|
60
|
-
return {
|
|
61
|
-
"status": "ok",
|
|
62
|
-
"response": result
|
|
63
|
-
}
|