UncountablePythonSDK 0.0.50__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.
- {UncountablePythonSDK-0.0.50.dist-info → UncountablePythonSDK-0.0.52.dist-info}/METADATA +1 -1
- {UncountablePythonSDK-0.0.50.dist-info → UncountablePythonSDK-0.0.52.dist-info}/RECORD +14 -14
- docs/requirements.txt +3 -3
- uncountable/integration/construct_client.py +17 -19
- uncountable/integration/secret_retrieval/retrieve_secret.py +32 -1
- uncountable/integration/server.py +11 -1
- uncountable/integration/telemetry.py +30 -25
- uncountable/types/api/entity/create_entities.py +1 -1
- uncountable/types/api/entity/create_entity.py +1 -1
- uncountable/types/client_base.py +2 -2
- uncountable/types/job_definition.py +2 -1
- uncountable/types/job_definition_t.py +22 -7
- {UncountablePythonSDK-0.0.50.dist-info → UncountablePythonSDK-0.0.52.dist-info}/WHEEL +0 -0
- {UncountablePythonSDK-0.0.50.dist-info → UncountablePythonSDK-0.0.52.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: UncountablePythonSDK
|
|
3
|
-
Version: 0.0.
|
|
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=
|
|
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
|
|
@@ -79,12 +79,12 @@ uncountable/core/file_upload.py,sha256=TkQ0fKbbYrPgns1Jh51JU35DUqZHB3ljOaVgjSlBx
|
|
|
79
79
|
uncountable/core/types.py,sha256=s2CjqYJpsmbC7xMwxxT7kJ_V9bwokrjjWVVjpMcQpKI,333
|
|
80
80
|
uncountable/core/version.py,sha256=SqQIHLhiVZXQBeOwygS2FRZ4WEO27JmWhse0lKm7fgU,274
|
|
81
81
|
uncountable/integration/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
82
|
-
uncountable/integration/construct_client.py,sha256=
|
|
82
|
+
uncountable/integration/construct_client.py,sha256=e1uAMVp4FTbValCJ3gfaZFuObKxHbTXq496-T-KMOG4,1899
|
|
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=
|
|
87
|
-
uncountable/integration/telemetry.py,sha256=
|
|
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
|
|
@@ -92,7 +92,7 @@ uncountable/integration/executors/executors.py,sha256=v5ClGVUlvrZcMdmGQa8Ll668G_
|
|
|
92
92
|
uncountable/integration/executors/generic_upload_executor.py,sha256=wafNY_gpbUiQhvkFPDw-GGiJLmDVtTRgH_5jwMLy2Z4,10283
|
|
93
93
|
uncountable/integration/executors/script_executor.py,sha256=OmSBOtU48G3mqza9c2lCm84pGGyaDk-ZBJCx3RsdJXc,846
|
|
94
94
|
uncountable/integration/secret_retrieval/__init__.py,sha256=3QXVj35w8rRMxVvmmsViFYDi3lcb3g70incfalOEm6o,87
|
|
95
|
-
uncountable/integration/secret_retrieval/retrieve_secret.py,sha256=
|
|
95
|
+
uncountable/integration/secret_retrieval/retrieve_secret.py,sha256=iDqLbYKKLv8Wl5hNSKl7b4hKJnDshFe6tgdAJmQgQyA,2205
|
|
96
96
|
uncountable/types/__init__.py,sha256=95iOd3WXWoI_4a461IS2ieWRic3zRyNaCYzfTpX764o,8162
|
|
97
97
|
uncountable/types/async_batch.py,sha256=ihCv5XWSTTPmuO-GMPn1EACGI2CBUIJTATZ3aPgsNBA,523
|
|
98
98
|
uncountable/types/async_batch_processor.py,sha256=R--exgi4Gw0HWCnh8M-3_2PqG2ByTBtdyuSQ2eYtYn8,8671
|
|
@@ -103,7 +103,7 @@ uncountable/types/calculations.py,sha256=FFO_D3BbKoGDZnqWvTKpW4KF359i2vrKjpdFCLY
|
|
|
103
103
|
uncountable/types/calculations_t.py,sha256=7GTSi2L8NYjzjUJJx3cmtVkK9uD-uhfYvIFK-ffQj-8,556
|
|
104
104
|
uncountable/types/chemical_structure.py,sha256=E-LnikTFDoVQ1b2zKaVUIO_PAKm-7aZZYJi8I8SDSic,302
|
|
105
105
|
uncountable/types/chemical_structure_t.py,sha256=aFsTkkbzy6Gvyde3qrrEYD95gcYhxkgKMiDRaRE0o-Y,760
|
|
106
|
-
uncountable/types/client_base.py,sha256=
|
|
106
|
+
uncountable/types/client_base.py,sha256=db6V-Jea8iWT4kz2hXc5c_doLJKLZTd5T-F4ehobWMs,65431
|
|
107
107
|
uncountable/types/client_config.py,sha256=4h5Liko9uKCo9_0gdbPhoK6Jr2Kv7tioLiQ8iKeq-_4,301
|
|
108
108
|
uncountable/types/client_config_t.py,sha256=_HdS37gMSTIiD4qLnW9dIgt8_Rt5A6xhwMGGga7vnLg,625
|
|
109
109
|
uncountable/types/curves.py,sha256=W6uMpG5SyW1MS82szNpxkFEn1MnxNpBFyFbQb2Ysfng,366
|
|
@@ -126,8 +126,8 @@ uncountable/types/input_attributes.py,sha256=IrIKQnHqHdS1Utdfzr9GnOe17a8riaqYcO1
|
|
|
126
126
|
uncountable/types/input_attributes_t.py,sha256=wE1ekiQfb72Z9VpF5SHipKJkgaJFUHJrNkkJdmuhF9w,820
|
|
127
127
|
uncountable/types/inputs.py,sha256=6RIEFfCxLqpeHEGOpu63O4i8zPogjGeB7wiV_rPBw_g,404
|
|
128
128
|
uncountable/types/inputs_t.py,sha256=RW7gF9zTOwByu-nMTMVuBabLOuWKx4O1nvfgvx_R55o,1611
|
|
129
|
-
uncountable/types/job_definition.py,sha256=
|
|
130
|
-
uncountable/types/job_definition_t.py,sha256=
|
|
129
|
+
uncountable/types/job_definition.py,sha256=Cgwop6iNcWEsEpfjMl1EtkRES_3-SVzpMe-w73V4G_U,1862
|
|
130
|
+
uncountable/types/job_definition_t.py,sha256=pL-0YVyR0oz6-5wWXJsX1UyYo4R_FPwhOYFj9iMKgvo,7170
|
|
131
131
|
uncountable/types/outputs.py,sha256=sUZx_X-TKCZtLm1YCEH8OISX9DdPlv9ZuUfM3-askCc,281
|
|
132
132
|
uncountable/types/outputs_t.py,sha256=2aORUOr0ls1ZYo-ddkWax3D1ZndmQsWtHfJxpYozlhg,656
|
|
133
133
|
uncountable/types/permissions.py,sha256=1mRnSsmRgjuLgp6pylTwwACD_YRIcmlqxHkufwZtMns,297
|
|
@@ -169,8 +169,8 @@ uncountable/types/api/batch/execute_batch_load_async.py,sha256=3ptjtokj7eZ_A7OUX
|
|
|
169
169
|
uncountable/types/api/chemical/__init__.py,sha256=gCgbynxG3jA8FQHzercKtrHKHkiIKr8APdZYUniAor8,55
|
|
170
170
|
uncountable/types/api/chemical/convert_chemical_formats.py,sha256=-FKBOcg1jteFu920NM-0lBk90pfucpcg2WAsaddfDc8,1323
|
|
171
171
|
uncountable/types/api/entity/__init__.py,sha256=gCgbynxG3jA8FQHzercKtrHKHkiIKr8APdZYUniAor8,55
|
|
172
|
-
uncountable/types/api/entity/create_entities.py,sha256=
|
|
173
|
-
uncountable/types/api/entity/create_entity.py,sha256=
|
|
172
|
+
uncountable/types/api/entity/create_entities.py,sha256=qvra6BustbxWmt7_c83mCMkfxaBJ4B8xayJUvk6Ab9E,1780
|
|
173
|
+
uncountable/types/api/entity/create_entity.py,sha256=vfbJiHOMEEzJFZNNiHbIBqisytYdKa7rTOraWdZrXpw,1950
|
|
174
174
|
uncountable/types/api/entity/get_entities_data.py,sha256=_dyDJ8Aukeijj2U3ZEQYNECoI3TC4phn8RhgJQP1e1s,1162
|
|
175
175
|
uncountable/types/api/entity/list_entities.py,sha256=93J8jbHOdBL7Ee2_z_M57JpIVsmI2RddDMpprTakYks,1717
|
|
176
176
|
uncountable/types/api/entity/lock_entity.py,sha256=twQ-f61AKS_NrKP-TzqHkMmzTJGMc4yxZFl-2JctOg4,1004
|
|
@@ -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.
|
|
244
|
-
UncountablePythonSDK-0.0.
|
|
245
|
-
UncountablePythonSDK-0.0.
|
|
246
|
-
UncountablePythonSDK-0.0.
|
|
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,34 +1,32 @@
|
|
|
1
|
-
import os
|
|
2
|
-
|
|
3
1
|
from uncountable.core import AuthDetailsApiKey, Client
|
|
4
2
|
from uncountable.core.client import ClientConfig
|
|
5
|
-
from uncountable.core.types import AuthDetailsAll
|
|
3
|
+
from uncountable.core.types import AuthDetailsAll, AuthDetailsOAuth
|
|
4
|
+
from uncountable.integration.secret_retrieval.retrieve_secret import retrieve_secret
|
|
6
5
|
from uncountable.integration.telemetry import JobLogger
|
|
7
6
|
from uncountable.types.job_definition_t import (
|
|
8
|
-
|
|
7
|
+
AuthRetrievalBasic,
|
|
8
|
+
AuthRetrievalOAuth,
|
|
9
9
|
ProfileMetadata,
|
|
10
10
|
)
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
def _get_env_var(name: str) -> str:
|
|
14
|
-
value = os.getenv(name)
|
|
15
|
-
if value is None:
|
|
16
|
-
raise Exception(f"environment variable {name} is missing")
|
|
17
|
-
return value
|
|
18
|
-
|
|
19
|
-
|
|
20
13
|
def _construct_auth_details(profile_meta: ProfileMetadata) -> AuthDetailsAll:
|
|
21
14
|
match profile_meta.auth_retrieval:
|
|
22
|
-
case
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
case AuthRetrievalOAuth():
|
|
16
|
+
refresh_token = retrieve_secret(
|
|
17
|
+
profile_meta.auth_retrieval.refresh_token_secret,
|
|
18
|
+
profile_metadata=profile_meta,
|
|
19
|
+
)
|
|
20
|
+
return AuthDetailsOAuth(refresh_token=refresh_token)
|
|
21
|
+
case AuthRetrievalBasic():
|
|
22
|
+
api_id = retrieve_secret(
|
|
23
|
+
profile_meta.auth_retrieval.api_id_secret, profile_metadata=profile_meta
|
|
24
|
+
)
|
|
25
|
+
api_key = retrieve_secret(
|
|
26
|
+
profile_meta.auth_retrieval.api_key_secret, profile_metadata=profile_meta
|
|
26
27
|
)
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
assert api_secret_key is not None
|
|
30
|
-
|
|
31
|
-
return AuthDetailsApiKey(api_id=api_id, api_secret_key=api_secret_key)
|
|
29
|
+
return AuthDetailsApiKey(api_id=api_id, api_secret_key=api_key)
|
|
32
30
|
|
|
33
31
|
|
|
34
32
|
def _construct_client_config(
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
import base64
|
|
2
|
+
import functools
|
|
3
|
+
import json
|
|
1
4
|
import os
|
|
2
5
|
|
|
6
|
+
import boto3
|
|
7
|
+
|
|
3
8
|
from uncountable.types.job_definition_t import ProfileMetadata
|
|
4
9
|
from uncountable.types.secret_retrieval_t import (
|
|
5
10
|
SecretRetrieval,
|
|
@@ -22,6 +27,25 @@ class SecretRetrievalError(BaseException):
|
|
|
22
27
|
return f"{self.secret_retrieval.type} secret retrieval failed{append_message}"
|
|
23
28
|
|
|
24
29
|
|
|
30
|
+
@functools.cache
|
|
31
|
+
def _get_aws_secret(*, secret_name: str, region_name: str, sub_key: str | None) -> str:
|
|
32
|
+
client = boto3.client("secretsmanager", region_name=region_name)
|
|
33
|
+
response = client.get_secret_value(SecretId=secret_name)
|
|
34
|
+
|
|
35
|
+
if "SecretString" in response:
|
|
36
|
+
secret = response["SecretString"]
|
|
37
|
+
else:
|
|
38
|
+
secret = base64.b64decode(response["SecretBinary"])
|
|
39
|
+
|
|
40
|
+
value = json.loads(secret)
|
|
41
|
+
|
|
42
|
+
if sub_key is not None:
|
|
43
|
+
assert isinstance(value, dict)
|
|
44
|
+
return str(value[sub_key])
|
|
45
|
+
else:
|
|
46
|
+
return str(value)
|
|
47
|
+
|
|
48
|
+
|
|
25
49
|
def retrieve_secret(
|
|
26
50
|
secret_retrieval: SecretRetrieval, profile_metadata: ProfileMetadata
|
|
27
51
|
) -> str:
|
|
@@ -37,4 +61,11 @@ def retrieve_secret(
|
|
|
37
61
|
)
|
|
38
62
|
return secret
|
|
39
63
|
case SecretRetrievalAWS():
|
|
40
|
-
|
|
64
|
+
try:
|
|
65
|
+
return _get_aws_secret(
|
|
66
|
+
secret_name=secret_retrieval.secret_name,
|
|
67
|
+
region_name=secret_retrieval.region,
|
|
68
|
+
sub_key=secret_retrieval.sub_key,
|
|
69
|
+
)
|
|
70
|
+
except Exception as e:
|
|
71
|
+
raise SecretRetrievalError(secret_retrieval) from e
|
|
@@ -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
|
-
|
|
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
|
|
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)
|
|
@@ -34,7 +34,7 @@ class EntityToCreate:
|
|
|
34
34
|
@dataclasses.dataclass(kw_only=True)
|
|
35
35
|
class Arguments:
|
|
36
36
|
definition_id: base_t.ObjectId
|
|
37
|
-
entity_type: typing.Union[typing.Literal[entity_t.EntityType.LAB_REQUEST], typing.Literal[entity_t.EntityType.APPROVAL], typing.Literal[entity_t.EntityType.CUSTOM_ENTITY], typing.Literal[entity_t.EntityType.INVENTORY_AMOUNT], typing.Literal[entity_t.EntityType.TASK], typing.Literal[entity_t.EntityType.PROJECT], typing.Literal[entity_t.EntityType.EQUIPMENT], typing.Literal[entity_t.EntityType.INV_LOCAL_LOCATIONS], typing.Literal[entity_t.EntityType.FIELD_OPTION_SET], typing.Literal[entity_t.EntityType.WEBHOOK], typing.Literal[entity_t.EntityType.SPECS]]
|
|
37
|
+
entity_type: typing.Union[typing.Literal[entity_t.EntityType.LAB_REQUEST], typing.Literal[entity_t.EntityType.APPROVAL], typing.Literal[entity_t.EntityType.CUSTOM_ENTITY], typing.Literal[entity_t.EntityType.INVENTORY_AMOUNT], typing.Literal[entity_t.EntityType.TASK], typing.Literal[entity_t.EntityType.PROJECT], typing.Literal[entity_t.EntityType.EQUIPMENT], typing.Literal[entity_t.EntityType.INV_LOCAL_LOCATIONS], typing.Literal[entity_t.EntityType.FIELD_OPTION_SET], typing.Literal[entity_t.EntityType.WEBHOOK], typing.Literal[entity_t.EntityType.SPECS], typing.Literal[entity_t.EntityType.GOAL]]
|
|
38
38
|
entities_to_create: list[EntityToCreate]
|
|
39
39
|
|
|
40
40
|
|
|
@@ -40,7 +40,7 @@ class EntityFieldInitialValue:
|
|
|
40
40
|
@dataclasses.dataclass(kw_only=True)
|
|
41
41
|
class Arguments:
|
|
42
42
|
definition_id: base_t.ObjectId
|
|
43
|
-
entity_type: typing.Union[typing.Literal[entity_t.EntityType.LAB_REQUEST], typing.Literal[entity_t.EntityType.APPROVAL], typing.Literal[entity_t.EntityType.CUSTOM_ENTITY], typing.Literal[entity_t.EntityType.INVENTORY_AMOUNT], typing.Literal[entity_t.EntityType.TASK], typing.Literal[entity_t.EntityType.PROJECT], typing.Literal[entity_t.EntityType.EQUIPMENT], typing.Literal[entity_t.EntityType.INV_LOCAL_LOCATIONS], typing.Literal[entity_t.EntityType.FIELD_OPTION_SET], typing.Literal[entity_t.EntityType.WEBHOOK], typing.Literal[entity_t.EntityType.SPECS]]
|
|
43
|
+
entity_type: typing.Union[typing.Literal[entity_t.EntityType.LAB_REQUEST], typing.Literal[entity_t.EntityType.APPROVAL], typing.Literal[entity_t.EntityType.CUSTOM_ENTITY], typing.Literal[entity_t.EntityType.INVENTORY_AMOUNT], typing.Literal[entity_t.EntityType.TASK], typing.Literal[entity_t.EntityType.PROJECT], typing.Literal[entity_t.EntityType.EQUIPMENT], typing.Literal[entity_t.EntityType.INV_LOCAL_LOCATIONS], typing.Literal[entity_t.EntityType.FIELD_OPTION_SET], typing.Literal[entity_t.EntityType.WEBHOOK], typing.Literal[entity_t.EntityType.SPECS], typing.Literal[entity_t.EntityType.GOAL]]
|
|
44
44
|
field_values: typing.Optional[typing.Optional[list[field_values_t.FieldRefNameValue]]] = None
|
|
45
45
|
|
|
46
46
|
|
uncountable/types/client_base.py
CHANGED
|
@@ -235,7 +235,7 @@ class ClientMethods(ABC):
|
|
|
235
235
|
self,
|
|
236
236
|
*,
|
|
237
237
|
definition_id: base_t.ObjectId,
|
|
238
|
-
entity_type: typing.Union[typing.Literal[entity_t.EntityType.LAB_REQUEST], typing.Literal[entity_t.EntityType.APPROVAL], typing.Literal[entity_t.EntityType.CUSTOM_ENTITY], typing.Literal[entity_t.EntityType.INVENTORY_AMOUNT], typing.Literal[entity_t.EntityType.TASK], typing.Literal[entity_t.EntityType.PROJECT], typing.Literal[entity_t.EntityType.EQUIPMENT], typing.Literal[entity_t.EntityType.INV_LOCAL_LOCATIONS], typing.Literal[entity_t.EntityType.FIELD_OPTION_SET], typing.Literal[entity_t.EntityType.WEBHOOK], typing.Literal[entity_t.EntityType.SPECS]],
|
|
238
|
+
entity_type: typing.Union[typing.Literal[entity_t.EntityType.LAB_REQUEST], typing.Literal[entity_t.EntityType.APPROVAL], typing.Literal[entity_t.EntityType.CUSTOM_ENTITY], typing.Literal[entity_t.EntityType.INVENTORY_AMOUNT], typing.Literal[entity_t.EntityType.TASK], typing.Literal[entity_t.EntityType.PROJECT], typing.Literal[entity_t.EntityType.EQUIPMENT], typing.Literal[entity_t.EntityType.INV_LOCAL_LOCATIONS], typing.Literal[entity_t.EntityType.FIELD_OPTION_SET], typing.Literal[entity_t.EntityType.WEBHOOK], typing.Literal[entity_t.EntityType.SPECS], typing.Literal[entity_t.EntityType.GOAL]],
|
|
239
239
|
entities_to_create: list[create_entities_t.EntityToCreate],
|
|
240
240
|
) -> create_entities_t.Data:
|
|
241
241
|
"""Creates new Uncountable entities
|
|
@@ -260,7 +260,7 @@ class ClientMethods(ABC):
|
|
|
260
260
|
self,
|
|
261
261
|
*,
|
|
262
262
|
definition_id: base_t.ObjectId,
|
|
263
|
-
entity_type: typing.Union[typing.Literal[entity_t.EntityType.LAB_REQUEST], typing.Literal[entity_t.EntityType.APPROVAL], typing.Literal[entity_t.EntityType.CUSTOM_ENTITY], typing.Literal[entity_t.EntityType.INVENTORY_AMOUNT], typing.Literal[entity_t.EntityType.TASK], typing.Literal[entity_t.EntityType.PROJECT], typing.Literal[entity_t.EntityType.EQUIPMENT], typing.Literal[entity_t.EntityType.INV_LOCAL_LOCATIONS], typing.Literal[entity_t.EntityType.FIELD_OPTION_SET], typing.Literal[entity_t.EntityType.WEBHOOK], typing.Literal[entity_t.EntityType.SPECS]],
|
|
263
|
+
entity_type: typing.Union[typing.Literal[entity_t.EntityType.LAB_REQUEST], typing.Literal[entity_t.EntityType.APPROVAL], typing.Literal[entity_t.EntityType.CUSTOM_ENTITY], typing.Literal[entity_t.EntityType.INVENTORY_AMOUNT], typing.Literal[entity_t.EntityType.TASK], typing.Literal[entity_t.EntityType.PROJECT], typing.Literal[entity_t.EntityType.EQUIPMENT], typing.Literal[entity_t.EntityType.INV_LOCAL_LOCATIONS], typing.Literal[entity_t.EntityType.FIELD_OPTION_SET], typing.Literal[entity_t.EntityType.WEBHOOK], typing.Literal[entity_t.EntityType.SPECS], typing.Literal[entity_t.EntityType.GOAL]],
|
|
264
264
|
field_values: typing.Optional[typing.Optional[list[field_values_t.FieldRefNameValue]]] = None,
|
|
265
265
|
) -> create_entity_t.Data:
|
|
266
266
|
"""Creates a new Uncountable entity
|
|
@@ -21,7 +21,8 @@ from .job_definition_t import JobDefinitionBase as JobDefinitionBase
|
|
|
21
21
|
from .job_definition_t import CronJobDefinition as CronJobDefinition
|
|
22
22
|
from .job_definition_t import JobDefinition as JobDefinition
|
|
23
23
|
from .job_definition_t import AuthRetrievalBase as AuthRetrievalBase
|
|
24
|
-
from .job_definition_t import
|
|
24
|
+
from .job_definition_t import AuthRetrievalOAuth as AuthRetrievalOAuth
|
|
25
|
+
from .job_definition_t import AuthRetrievalBasic as AuthRetrievalBasic
|
|
25
26
|
from .job_definition_t import AuthRetrieval as AuthRetrieval
|
|
26
27
|
from .job_definition_t import ProfileDefinition as ProfileDefinition
|
|
27
28
|
from .job_definition_t import ProfileMetadata as ProfileMetadata
|
|
@@ -18,7 +18,8 @@ from . import secret_retrieval_t
|
|
|
18
18
|
__all__: list[str] = [
|
|
19
19
|
"AuthRetrieval",
|
|
20
20
|
"AuthRetrievalBase",
|
|
21
|
-
"
|
|
21
|
+
"AuthRetrievalBasic",
|
|
22
|
+
"AuthRetrievalOAuth",
|
|
22
23
|
"AuthRetrievalType",
|
|
23
24
|
"CronJobDefinition",
|
|
24
25
|
"GenericUploadDataSource",
|
|
@@ -54,7 +55,8 @@ class JobExecutorType(StrEnum):
|
|
|
54
55
|
|
|
55
56
|
# DO NOT MODIFY -- This file is generated by type_spec
|
|
56
57
|
class AuthRetrievalType(StrEnum):
|
|
57
|
-
|
|
58
|
+
OAUTH = "oauth"
|
|
59
|
+
BASIC = "basic"
|
|
58
60
|
|
|
59
61
|
|
|
60
62
|
# DO NOT MODIFY -- This file is generated by type_spec
|
|
@@ -162,7 +164,7 @@ class JobDefinitionBase:
|
|
|
162
164
|
id: str
|
|
163
165
|
name: str
|
|
164
166
|
executor: JobExecutor
|
|
165
|
-
enabled: bool =
|
|
167
|
+
enabled: bool = True
|
|
166
168
|
|
|
167
169
|
|
|
168
170
|
# DO NOT MODIFY -- This file is generated by type_spec
|
|
@@ -198,17 +200,30 @@ class AuthRetrievalBase:
|
|
|
198
200
|
parse_require={"type"},
|
|
199
201
|
)
|
|
200
202
|
@dataclasses.dataclass(kw_only=True)
|
|
201
|
-
class
|
|
202
|
-
type: typing.Literal[AuthRetrievalType.
|
|
203
|
+
class AuthRetrievalOAuth(AuthRetrievalBase):
|
|
204
|
+
type: typing.Literal[AuthRetrievalType.OAUTH] = AuthRetrievalType.OAUTH
|
|
205
|
+
refresh_token_secret: secret_retrieval_t.SecretRetrieval
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
# DO NOT MODIFY -- This file is generated by type_spec
|
|
209
|
+
@serial_class(
|
|
210
|
+
parse_require={"type"},
|
|
211
|
+
)
|
|
212
|
+
@dataclasses.dataclass(kw_only=True)
|
|
213
|
+
class AuthRetrievalBasic(AuthRetrievalBase):
|
|
214
|
+
type: typing.Literal[AuthRetrievalType.BASIC] = AuthRetrievalType.BASIC
|
|
215
|
+
api_id_secret: secret_retrieval_t.SecretRetrieval
|
|
216
|
+
api_key_secret: secret_retrieval_t.SecretRetrieval
|
|
203
217
|
|
|
204
218
|
|
|
205
219
|
# DO NOT MODIFY -- This file is generated by type_spec
|
|
206
220
|
AuthRetrieval = typing.Annotated[
|
|
207
|
-
typing.Union[
|
|
221
|
+
typing.Union[AuthRetrievalOAuth, AuthRetrievalBasic],
|
|
208
222
|
serial_union_annotation(
|
|
209
223
|
discriminator="type",
|
|
210
224
|
discriminator_map={
|
|
211
|
-
"
|
|
225
|
+
"oauth": AuthRetrievalOAuth,
|
|
226
|
+
"basic": AuthRetrievalBasic,
|
|
212
227
|
},
|
|
213
228
|
),
|
|
214
229
|
]
|
|
File without changes
|
{UncountablePythonSDK-0.0.50.dist-info → UncountablePythonSDK-0.0.52.dist-info}/top_level.txt
RENAMED
|
File without changes
|