logdetective 1.1.0__tar.gz → 1.2.0__tar.gz

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.
Files changed (33) hide show
  1. {logdetective-1.1.0 → logdetective-1.2.0}/PKG-INFO +16 -3
  2. {logdetective-1.1.0 → logdetective-1.2.0}/README.md +14 -1
  3. {logdetective-1.1.0 → logdetective-1.2.0}/logdetective/remote_log.py +3 -3
  4. {logdetective-1.1.0 → logdetective-1.2.0}/logdetective/server/gitlab.py +7 -5
  5. {logdetective-1.1.0 → logdetective-1.2.0}/pyproject.toml +4 -4
  6. {logdetective-1.1.0 → logdetective-1.2.0}/LICENSE +0 -0
  7. {logdetective-1.1.0 → logdetective-1.2.0}/logdetective/__init__.py +0 -0
  8. {logdetective-1.1.0 → logdetective-1.2.0}/logdetective/constants.py +0 -0
  9. {logdetective-1.1.0 → logdetective-1.2.0}/logdetective/drain3.ini +0 -0
  10. {logdetective-1.1.0 → logdetective-1.2.0}/logdetective/extractors.py +0 -0
  11. {logdetective-1.1.0 → logdetective-1.2.0}/logdetective/logdetective.py +0 -0
  12. {logdetective-1.1.0 → logdetective-1.2.0}/logdetective/models.py +0 -0
  13. {logdetective-1.1.0 → logdetective-1.2.0}/logdetective/prompts-summary-first.yml +0 -0
  14. {logdetective-1.1.0 → logdetective-1.2.0}/logdetective/prompts-summary-only.yml +0 -0
  15. {logdetective-1.1.0 → logdetective-1.2.0}/logdetective/prompts.yml +0 -0
  16. {logdetective-1.1.0 → logdetective-1.2.0}/logdetective/server/__init__.py +0 -0
  17. {logdetective-1.1.0 → logdetective-1.2.0}/logdetective/server/compressors.py +0 -0
  18. {logdetective-1.1.0 → logdetective-1.2.0}/logdetective/server/config.py +0 -0
  19. {logdetective-1.1.0 → logdetective-1.2.0}/logdetective/server/database/__init__.py +0 -0
  20. {logdetective-1.1.0 → logdetective-1.2.0}/logdetective/server/database/base.py +0 -0
  21. {logdetective-1.1.0 → logdetective-1.2.0}/logdetective/server/database/models/__init__.py +0 -0
  22. {logdetective-1.1.0 → logdetective-1.2.0}/logdetective/server/database/models/merge_request_jobs.py +0 -0
  23. {logdetective-1.1.0 → logdetective-1.2.0}/logdetective/server/database/models/metrics.py +0 -0
  24. {logdetective-1.1.0 → logdetective-1.2.0}/logdetective/server/emoji.py +0 -0
  25. {logdetective-1.1.0 → logdetective-1.2.0}/logdetective/server/llm.py +0 -0
  26. {logdetective-1.1.0 → logdetective-1.2.0}/logdetective/server/metric.py +0 -0
  27. {logdetective-1.1.0 → logdetective-1.2.0}/logdetective/server/models.py +0 -0
  28. {logdetective-1.1.0 → logdetective-1.2.0}/logdetective/server/plot.py +0 -0
  29. {logdetective-1.1.0 → logdetective-1.2.0}/logdetective/server/server.py +0 -0
  30. {logdetective-1.1.0 → logdetective-1.2.0}/logdetective/server/templates/gitlab_full_comment.md.j2 +0 -0
  31. {logdetective-1.1.0 → logdetective-1.2.0}/logdetective/server/templates/gitlab_short_comment.md.j2 +0 -0
  32. {logdetective-1.1.0 → logdetective-1.2.0}/logdetective/utils.py +0 -0
  33. {logdetective-1.1.0 → logdetective-1.2.0}/logdetective.1.asciidoc +0 -0
@@ -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
 
@@ -161,6 +161,9 @@ Make changes to the code as needed and run pre-commit.
161
161
  Tests
162
162
  -----
163
163
 
164
+ Tests for code used by server must placed in the `./tests/server/` path, while tests for general
165
+ code must be in the `./tests/base/` path.
166
+
164
167
  The [tox](https://github.com/tox-dev/tox) is used to manage tests. Please install `tox` package into your distribution and run:
165
168
 
166
169
  tox
@@ -175,7 +178,17 @@ or
175
178
 
176
179
  tox run -e lint # to run pylint
177
180
 
178
- To run full test suite you will need postgresql client utilities.
181
+ Tox environments for base and server tests are separate, each installs different dependencies.
182
+
183
+ Running base tests:
184
+
185
+ tox run -e pytest_base
186
+
187
+ Running server tests:
188
+
189
+ tox run -e pytest_server
190
+
191
+ To run server test suite you will need postgresql client utilities.
179
192
 
180
193
  dnf install postgresql
181
194
 
@@ -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
  [tool.poetry]
2
2
  name = "logdetective"
3
- version = "1.1.0"
3
+ version = "1.2.0"
4
4
  description = "Log using LLM AI to search for build/test failures and provide ideas for fixing these."
5
5
  authors = ["Jiri Podivin <jpodivin@gmail.com>"]
6
6
  license = "Apache-2.0"
@@ -51,11 +51,11 @@ psycopg2 = {version = "^2.9.9", optional = true }
51
51
  alembic = {version = "^1.13.3", optional = true }
52
52
  matplotlib = {version = "^3.8.4", optional = true }
53
53
  backoff = {version = "2.2.1", optional = true }
54
- sentry-sdk = {version = "^2.17.0", extras = ["fastapi"]}
54
+ sentry-sdk = {version = "^2.17.0", optional = true, extras = ["fastapi"]}
55
55
 
56
56
  [tool.poetry.extras]
57
- server = ["fastapi", "sqlalchemy", "psycopg2", "alembic", "matplotlib", "backoff", "aiolimiter"]
58
- server-testing = ["fastapi", "sqlalchemy", "psycopg2-binary", "alembic", "matplotlib", "backoff", "pytest-asyncio"]
57
+ server = ["fastapi", "sqlalchemy", "psycopg2", "alembic", "matplotlib", "backoff", "aiolimiter", "sentry-sdk"]
58
+ server-testing = ["fastapi", "sqlalchemy", "psycopg2-binary", "alembic", "matplotlib", "backoff", "pytest-asyncio", "sentry-sdk"]
59
59
 
60
60
  [build-system]
61
61
  requires = ["poetry-core"]
File without changes