logdetective 1.1.0__py3-none-any.whl → 1.2.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.
@@ -2,7 +2,7 @@ import logging
2
2
  from urllib.parse import urlparse
3
3
 
4
4
  import aiohttp
5
- from fastapi import HTTPException
5
+ from aiohttp.web import HTTPBadRequest
6
6
 
7
7
  LOG = logging.getLogger("logdetective")
8
8
 
@@ -64,6 +64,6 @@ class RemoteLog:
64
64
  try:
65
65
  return await self.get_url_content()
66
66
  except RuntimeError as ex:
67
- raise HTTPException(
68
- status_code=400, detail=f"We couldn't obtain the logs: {ex}"
67
+ raise HTTPBadRequest(
68
+ reason=f"We couldn't obtain the logs: {ex}"
69
69
  ) from ex
@@ -193,9 +193,12 @@ async def retrieve_and_preprocess_koji_logs(
193
193
  # may be presented only at the top level.
194
194
  # The paths look like `kojilogs/noarch-XXXXXX/task_failed.log`
195
195
  # or `kojilogs/noarch-XXXXXX/x86_64-XXXXXX/task_failed.log`
196
+ # We prefix "toplevel" with '~' so that later when we sort the
197
+ # keys to see if there are any unrecognized arches, it will always
198
+ # sort last.
196
199
  path = PurePath(zipinfo.filename)
197
200
  if len(path.parts) <= 3:
198
- failed_arches["toplevel"] = path
201
+ failed_arches["~toplevel"] = path
199
202
  continue
200
203
 
201
204
  # Extract the architecture from the immediate parent path
@@ -246,12 +249,11 @@ async def retrieve_and_preprocess_koji_logs(
246
249
  elif "noarch" in failed_arches:
247
250
  # May have failed during BuildSRPMFromSCM phase
248
251
  failed_arch = "noarch"
249
- elif "toplevel" in failed_arches:
250
- # Probably a Koji-specific error, not a build error
251
- failed_arch = "toplevel"
252
252
  else:
253
253
  # We have one or more architectures that we don't know about? Just
254
- # pick the first alphabetically.
254
+ # pick the first alphabetically. If the issue was a Koji error
255
+ # rather than a build failure, this will fall back to ~toplevel as
256
+ # the lowest-sorting possibility.
255
257
  failed_arch = sorted(list(failed_arches.keys()))[0]
256
258
 
257
259
  LOG.debug("Failed architecture: %s", failed_arch)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: logdetective
3
- Version: 1.1.0
3
+ Version: 1.2.0
4
4
  Summary: Log using LLM AI to search for build/test failures and provide ideas for fixing these.
5
5
  License: Apache-2.0
6
6
  Author: Jiri Podivin
@@ -35,7 +35,7 @@ Requires-Dist: psycopg2-binary (>=2.9.9,<3.0.0) ; extra == "server-testing"
35
35
  Requires-Dist: pydantic (>=2.8.2,<3.0.0)
36
36
  Requires-Dist: python-gitlab (>=4.4.0)
37
37
  Requires-Dist: pyyaml (>=6.0.1,<7.0.0)
38
- Requires-Dist: sentry-sdk[fastapi] (>=2.17.0,<3.0.0)
38
+ Requires-Dist: sentry-sdk[fastapi] (>=2.17.0,<3.0.0) ; extra == "server" or extra == "server-testing"
39
39
  Requires-Dist: sqlalchemy (>=2.0.36,<3.0.0) ; extra == "server" or extra == "server-testing"
40
40
  Project-URL: homepage, https://github.com/fedora-copr/logdetective
41
41
  Project-URL: issues, https://github.com/fedora-copr/logdetective/issues
@@ -204,6 +204,9 @@ Make changes to the code as needed and run pre-commit.
204
204
  Tests
205
205
  -----
206
206
 
207
+ Tests for code used by server must placed in the `./tests/server/` path, while tests for general
208
+ code must be in the `./tests/base/` path.
209
+
207
210
  The [tox](https://github.com/tox-dev/tox) is used to manage tests. Please install `tox` package into your distribution and run:
208
211
 
209
212
  tox
@@ -218,7 +221,17 @@ or
218
221
 
219
222
  tox run -e lint # to run pylint
220
223
 
221
- To run full test suite you will need postgresql client utilities.
224
+ Tox environments for base and server tests are separate, each installs different dependencies.
225
+
226
+ Running base tests:
227
+
228
+ tox run -e pytest_base
229
+
230
+ Running server tests:
231
+
232
+ tox run -e pytest_server
233
+
234
+ To run server test suite you will need postgresql client utilities.
222
235
 
223
236
  dnf install postgresql
224
237
 
@@ -7,7 +7,7 @@ logdetective/models.py,sha256=nrGBmMRu8i6UhFflQKAp81Y3Sd_Aaoor0i_yqSJoLT0,1115
7
7
  logdetective/prompts-summary-first.yml,sha256=3Zfp4NNOfaFYq5xBlBjeQa5PdjYfS4v17OtJqQ-DRpU,821
8
8
  logdetective/prompts-summary-only.yml,sha256=8U9AMJV8ePW-0CoXOXlQoO92DAJDeutIT8ntSkkm6W0,470
9
9
  logdetective/prompts.yml,sha256=urPKG068TYxi58EicFVUH6FavZq_q36oM1LvfI4ddjg,1729
10
- logdetective/remote_log.py,sha256=Zbv8g29jko8uQnzFUznnr8Nd9RSJCRs1PmPV7viqX9M,2267
10
+ logdetective/remote_log.py,sha256=1oeMIdDE_ob_2QrlXYTAA_m-36pNEicXbZwrCyzNgwo,2256
11
11
  logdetective/server/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  logdetective/server/compressors.py,sha256=qzrT-BPSksXY6F2L6ger04GGrgdBsGOfK2YuCFRs0Q4,5427
13
13
  logdetective/server/config.py,sha256=S2kuvzEo801Kq0vJpRr2fVxSqPghg9kW1L0Ml2yH8Zk,1764
@@ -17,7 +17,7 @@ logdetective/server/database/models/__init__.py,sha256=xy2hkygyw6_87zPKkG20i7g7_
17
17
  logdetective/server/database/models/merge_request_jobs.py,sha256=hw88wV1-3x7i53sX7ZotKClc6OsH1njPpbRSZofnqr4,18670
18
18
  logdetective/server/database/models/metrics.py,sha256=yl9fS4IPVFWDeFvPAxO6zOVu6oLF319ApvVLAgnD5yU,13928
19
19
  logdetective/server/emoji.py,sha256=Jh8RM36K8XDLefS8STm-nvhSLuoaFwlKeZJ5HLmRmdY,4298
20
- logdetective/server/gitlab.py,sha256=HxepI9I7j6VaIn2gu0FLz34e_1qodHQNR8xdrRpEMLI,16277
20
+ logdetective/server/gitlab.py,sha256=wQSlvdWn6XEi1oP6HhI75bIhm6bgdpWr3zu2WXF0_oE,16473
21
21
  logdetective/server/llm.py,sha256=8OnyCErDxKZA7FJSUzNjgPHu0eAjagCz7Yx7LzW98EE,7207
22
22
  logdetective/server/metric.py,sha256=B3ew_qSmtEMj6xl-FoOtS4F_bkplp-shhtfHF1cG_Io,4010
23
23
  logdetective/server/models.py,sha256=V8haEsnIYap1lRj2NlOCBtM7bJxWDdZehw4Whf_hnIE,15336
@@ -26,8 +26,8 @@ logdetective/server/server.py,sha256=-JJnHj8fPzx8aCJD3q2wRwidxoHPCmwOP8FTWwc1C14
26
26
  logdetective/server/templates/gitlab_full_comment.md.j2,sha256=DQZ2WVFedpuXI6znbHIW4wpF9BmFS8FaUkowh8AnGhE,1627
27
27
  logdetective/server/templates/gitlab_short_comment.md.j2,sha256=fzScpayv2vpRLczP_0O0YxtA8rsKvR6gSv4ntNdWb98,1443
28
28
  logdetective/utils.py,sha256=hdExAC8FtDIxvdgIq-Ro6LVM-JZ-k_UofaMzaDAHvzM,6088
29
- logdetective-1.1.0.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
30
- logdetective-1.1.0.dist-info/METADATA,sha256=5oZU-qB24EoQ05ezESAuiDo0MH3o-y3_ZdLYbFiRldo,17231
31
- logdetective-1.1.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
32
- logdetective-1.1.0.dist-info/entry_points.txt,sha256=3K_vXja6PmcA8sNdUi63WdImeiNhVZcEGPTaoJmltfA,63
33
- logdetective-1.1.0.dist-info/RECORD,,
29
+ logdetective-1.2.0.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
30
+ logdetective-1.2.0.dist-info/METADATA,sha256=p4yfUM0sjq_D2a2A4E2OjaGelAKrVnG-jqFUypoLyXw,17620
31
+ logdetective-1.2.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
32
+ logdetective-1.2.0.dist-info/entry_points.txt,sha256=3K_vXja6PmcA8sNdUi63WdImeiNhVZcEGPTaoJmltfA,63
33
+ logdetective-1.2.0.dist-info/RECORD,,