UncountablePythonSDK 0.0.51__py3-none-any.whl → 0.0.52__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.

Potentially problematic release.


This version of UncountablePythonSDK might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: UncountablePythonSDK
3
- Version: 0.0.51
3
+ Version: 0.0.52
4
4
  Summary: Uncountable SDK
5
5
  Project-URL: Homepage, https://github.com/uncountableinc/uncountable-python-sdk
6
6
  Project-URL: Repository, https://github.com/uncountableinc/uncountable-python-sdk.git
@@ -3,7 +3,7 @@ docs/conf.py,sha256=YF5J-9g_Wg8wXmyHsGaE8xYlDEzqocNl3UWUmP0CwBg,1702
3
3
  docs/index.md,sha256=eEdirX_Ds6ICTRtIS5iT4irCquHcQyKN7E4M5QP9T8A,257
4
4
  docs/justfile,sha256=cvNcpb-ByPOF2aCrFlg3DDZBoYMx5W8xGdr13m9HcnI,215
5
5
  docs/quickstart.md,sha256=3GuJ0MB1O5kjlsrgAmdSkDq0rYqATrYy-tzEHDy8H-c,422
6
- docs/requirements.txt,sha256=YDDAaHfuLxkdLhrjEUJeHDE-NSmD5chTgVTIO7BEeto,139
6
+ docs/requirements.txt,sha256=jD38J5O9MhuLHpA86cUgbFO8fVXouYupS3nGRAnh2x0,138
7
7
  docs/static/logo_blue.png,sha256=SyYpMTVhhBbhF5Wl8lWaVwz-_p1MIR6dW6bVhufQRME,46708
8
8
  docs/static/favicons/android-chrome-192x192.png,sha256=XoF-AhD55JlSBDGsEPJKfT_VeXT-awhwKyZnxLhrwvk,1369
9
9
  docs/static/favicons/android-chrome-512x512.png,sha256=1S4xwY9YtJQ5ifFsZ-DOzssoyBYs0t9uwdOUmYx0Xso,3888
@@ -83,8 +83,8 @@ uncountable/integration/construct_client.py,sha256=e1uAMVp4FTbValCJ3gfaZFuObKxHb
83
83
  uncountable/integration/cron.py,sha256=e5456IYJF2ipiSsd1R2T334lfe7mtp-gwP7JpS645L0,1858
84
84
  uncountable/integration/entrypoint.py,sha256=9rk06gBTsCqytIs8Shsnlf6ir_4Uq5d5rfP1veiSLzc,1437
85
85
  uncountable/integration/job.py,sha256=UTzcMes2KrBBRLOM3u94imMKLLnv50glqOkNf8-JOZw,1022
86
- uncountable/integration/server.py,sha256=JlnbidtiSLCEod0DzLKIzTCxP1qgaHBIBolUvnihJn8,3980
87
- uncountable/integration/telemetry.py,sha256=H5XQnRTszDL6Nl_oQYuWRr_oNYMocDaCCpKlwll-qZI,5127
86
+ uncountable/integration/server.py,sha256=bmX-ukLiNDq0ThVB2lUyXl-vtID5HI4gqJHxhsVNG3w,4440
87
+ uncountable/integration/telemetry.py,sha256=wgQnaWZFmUM_4lwyghOmL4Pd8DU0qUJvxXcrgBekAKQ,5261
88
88
  uncountable/integration/db/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
89
89
  uncountable/integration/db/connect.py,sha256=YtQHJ1DBGPhxKFRCfiXqohOYUceKSxMVOJ88aPI48Ug,181
90
90
  uncountable/integration/executors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -240,7 +240,7 @@ uncountable/types/api/triggers/__init__.py,sha256=gCgbynxG3jA8FQHzercKtrHKHkiIKr
240
240
  uncountable/types/api/triggers/run_trigger.py,sha256=_Rpha9nxXI3Xr17CrGDtofg4HZ81x2lt0rMZ6As0qfE,893
241
241
  uncountable/types/api/uploader/__init__.py,sha256=gCgbynxG3jA8FQHzercKtrHKHkiIKr8APdZYUniAor8,55
242
242
  uncountable/types/api/uploader/invoke_uploader.py,sha256=4zOcB_38uT73Jm3-XqkG40fBM1R5vpvPpGAg-U4lzxY,1059
243
- UncountablePythonSDK-0.0.51.dist-info/METADATA,sha256=AzvBprRKL--Fkabx8qrLx9P07XsCyTu1BqpTGl9AMFg,1934
244
- UncountablePythonSDK-0.0.51.dist-info/WHEEL,sha256=Mdi9PDNwEZptOjTlUcAth7XJDFtKrHYaQMPulZeBCiQ,91
245
- UncountablePythonSDK-0.0.51.dist-info/top_level.txt,sha256=1UVGjAU-6hJY9qw2iJ7nCBeEwZ793AEN5ZfKX9A1uj4,31
246
- UncountablePythonSDK-0.0.51.dist-info/RECORD,,
243
+ UncountablePythonSDK-0.0.52.dist-info/METADATA,sha256=OUWoU--wdBpw37DliJoAfdWz3iXECZumjR4eK3nxzec,1934
244
+ UncountablePythonSDK-0.0.52.dist-info/WHEEL,sha256=Mdi9PDNwEZptOjTlUcAth7XJDFtKrHYaQMPulZeBCiQ,91
245
+ UncountablePythonSDK-0.0.52.dist-info/top_level.txt,sha256=1UVGjAU-6hJY9qw2iJ7nCBeEwZ793AEN5ZfKX9A1uj4,31
246
+ UncountablePythonSDK-0.0.52.dist-info/RECORD,,
docs/requirements.txt CHANGED
@@ -1,7 +1,7 @@
1
- furo==2024.7.18
2
- myst-parser==3.0.1
1
+ furo==2024.8.6
2
+ myst-parser==4.0.0
3
3
  sphinx-autoapi==3.2.0
4
4
  sphinx-copybutton==0.5.2
5
5
  Sphinx==8.0.0
6
- sphinx_design==0.6.0
6
+ sphinx_design==0.6.1
7
7
  sphinx-favicon==1.0.1
@@ -11,6 +11,7 @@ from apscheduler.triggers.cron import CronTrigger
11
11
  from sqlalchemy.engine.base import Engine
12
12
 
13
13
  from uncountable.integration.cron import CronJobArgs, cron_job_executor
14
+ from uncountable.integration.telemetry import Logger
14
15
  from uncountable.types import base_t
15
16
  from uncountable.types.client_config_t import ClientConfigOptions
16
17
  from uncountable.types.job_definition_t import (
@@ -26,6 +27,7 @@ _MAX_APSCHEDULER_CONCURRENT_JOBS = 1
26
27
  class IntegrationServer:
27
28
  _scheduler: BaseScheduler
28
29
  _engine: Engine
30
+ _server_logger: Logger
29
31
 
30
32
  def __init__(self, engine: Engine) -> None:
31
33
  self._engine = engine
@@ -34,6 +36,7 @@ class IntegrationServer:
34
36
  jobstores={"default": SQLAlchemyJobStore(engine=engine)},
35
37
  executors={"default": ThreadPoolExecutor(_MAX_APSCHEDULER_CONCURRENT_JOBS)},
36
38
  )
39
+ self._server_logger = Logger()
37
40
 
38
41
  def register_profile(
39
42
  self,
@@ -59,7 +62,14 @@ class IntegrationServer:
59
62
  definition=job_defn, profile_metadata=profile_metadata
60
63
  )
61
64
  )
62
- existing_job = self._scheduler.get_job(job_defn.id)
65
+ try:
66
+ existing_job = self._scheduler.get_job(job_defn.id)
67
+ except ValueError as e:
68
+ self._server_logger.log_warning(
69
+ f"could not reconstitute job {job_defn.id}: {e}"
70
+ )
71
+ self._scheduler.remove_job(job_defn.id)
72
+ existing_job = None
63
73
  if existing_job is not None:
64
74
  existing_job.modify(
65
75
  name=job_defn.name,
@@ -49,10 +49,39 @@ class LogSeverity(StrEnum):
49
49
  ERROR = "Error"
50
50
 
51
51
 
52
- class JobLogger:
52
+ class Logger:
53
53
  current_span_id: int | None = None
54
54
  current_trace_id: int | None = None
55
55
 
56
+ def _patch_attributes(self, attributes: Attributes | None) -> Attributes:
57
+ return attributes or {}
58
+
59
+ def _emit_log(
60
+ self, message: str, *, severity: LogSeverity, attributes: Attributes | None
61
+ ) -> None:
62
+ log_record = LogRecord(
63
+ body=message,
64
+ severity_text=severity,
65
+ timestamp=time.time_ns(),
66
+ attributes=self._patch_attributes(attributes),
67
+ span_id=self.current_span_id,
68
+ trace_id=self.current_trace_id,
69
+ )
70
+ log_file: TextIO = sys.stderr if severity == LogSeverity.ERROR else sys.stdout
71
+ log_file.write(log_record.to_json())
72
+ log_file.flush()
73
+
74
+ def log_info(self, message: str, *, attributes: Attributes | None = None) -> None:
75
+ self._emit_log(message=message, severity=LogSeverity.INFO, attributes=attributes)
76
+
77
+ def log_warning(self, message: str, *, attributes: Attributes | None = None) -> None:
78
+ self._emit_log(message=message, severity=LogSeverity.WARN, attributes=attributes)
79
+
80
+ def log_error(self, message: str, *, attributes: Attributes | None = None) -> None:
81
+ self._emit_log(message=message, severity=LogSeverity.ERROR, attributes=attributes)
82
+
83
+
84
+ class JobLogger(Logger):
56
85
  def __init__(
57
86
  self,
58
87
  *,
@@ -104,27 +133,3 @@ class JobLogger:
104
133
  self.current_span_id = span.get_span_context().span_id
105
134
  self.current_trace_id = span.get_span_context().trace_id
106
135
  yield self
107
-
108
- def _emit_log(
109
- self, message: str, *, severity: LogSeverity, attributes: Attributes | None
110
- ) -> None:
111
- log_record = LogRecord(
112
- body=message,
113
- severity_text=severity,
114
- timestamp=time.time_ns(),
115
- attributes=self._patch_attributes(attributes),
116
- span_id=self.current_span_id,
117
- trace_id=self.current_trace_id,
118
- )
119
- log_file: TextIO = sys.stderr if severity == LogSeverity.ERROR else sys.stdout
120
- log_file.write(log_record.to_json())
121
- log_file.flush()
122
-
123
- def log_info(self, message: str, *, attributes: Attributes | None = None) -> None:
124
- self._emit_log(message=message, severity=LogSeverity.INFO, attributes=attributes)
125
-
126
- def log_warning(self, message: str, *, attributes: Attributes | None = None) -> None:
127
- self._emit_log(message=message, severity=LogSeverity.WARN, attributes=attributes)
128
-
129
- def log_error(self, message: str, *, attributes: Attributes | None = None) -> None:
130
- self._emit_log(message=message, severity=LogSeverity.ERROR, attributes=attributes)