UncountablePythonSDK 0.0.119__py3-none-any.whl → 0.0.121__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,3 +1,5 @@
1
+ import time
2
+
1
3
  from uncountable.integration.job import CronJob, JobArguments, register_job
2
4
  from uncountable.types import entity_t
3
5
  from uncountable.types.job_definition_t import JobResult
@@ -15,4 +17,5 @@ class MyCronJob(CronJob):
15
17
  if field_val.field_ref_name == "name":
16
18
  name = field_val.value
17
19
  args.logger.log_info(f"material family found with name: {name}")
20
+ time.sleep(1.5)
18
21
  return JobResult(success=True)
@@ -96,6 +96,35 @@ class DatastoreSqlite(Datastore):
96
96
 
97
97
  return queued_job_metadata
98
98
 
99
+ def get_next_queued_job_for_ref_name(
100
+ self, job_ref_name: str
101
+ ) -> queued_job_t.QueuedJob | None:
102
+ with self.session_maker() as session:
103
+ select_stmt = (
104
+ select(
105
+ QueuedJob.id,
106
+ QueuedJob.payload,
107
+ QueuedJob.num_attempts,
108
+ QueuedJob.job_ref_name,
109
+ QueuedJob.submitted_at,
110
+ )
111
+ .filter(QueuedJob.job_ref_name == job_ref_name)
112
+ .limit(1)
113
+ .order_by(QueuedJob.submitted_at)
114
+ )
115
+
116
+ for row in session.execute(select_stmt):
117
+ parsed_payload = queued_job_payload_parser.parse_storage(row.payload)
118
+ return queued_job_t.QueuedJob(
119
+ queued_job_uuid=row.id,
120
+ job_ref_name=row.job_ref_name,
121
+ num_attempts=row.num_attempts,
122
+ submitted_at=row.submitted_at,
123
+ payload=parsed_payload,
124
+ )
125
+
126
+ return None
127
+
99
128
  def load_job_queue(self) -> list[queued_job_t.QueuedJob]:
100
129
  with self.session_maker() as session:
101
130
  select_stmt = select(
@@ -18,6 +18,11 @@ class Datastore(ABC):
18
18
  @abstractmethod
19
19
  def load_job_queue(self) -> list[queued_job_t.QueuedJob]: ...
20
20
 
21
+ @abstractmethod
22
+ def get_next_queued_job_for_ref_name(
23
+ self, job_ref_name: str
24
+ ) -> queued_job_t.QueuedJob | None: ...
25
+
21
26
  @abstractmethod
22
27
  def list_queued_job_metadata(
23
28
  self, offset: int, limit: int | None
@@ -114,17 +114,11 @@ async def start_scheduler(
114
114
  queued_job_t.InvocationContextManual,
115
115
  ),
116
116
  ):
117
- existing_queued_jobs = datastore.load_job_queue()
118
- duplicate_job = next(
119
- (
120
- job
121
- for job in existing_queued_jobs
122
- if job.job_ref_name == job_ref_name
123
- ),
124
- None,
117
+ existing_queued_job = datastore.get_next_queued_job_for_ref_name(
118
+ job_ref_name=job_ref_name
125
119
  )
126
- if duplicate_job is not None:
127
- return duplicate_job.queued_job_uuid
120
+ if existing_queued_job is not None:
121
+ return existing_queued_job.queued_job_uuid
128
122
  queued_job = datastore.add_job_to_queue(
129
123
  job_payload=payload,
130
124
  job_ref_name=job_ref_name,
@@ -115,6 +115,8 @@ def main() -> None:
115
115
  logger = Logger(get_current_span())
116
116
  processes: list[ProcessInfo] = []
117
117
 
118
+ multiprocessing.set_start_method("forkserver")
119
+
118
120
  def add_process(process: ProcessInfo) -> None:
119
121
  processes.append(process)
120
122
  logger.log_info(f"started process {process.name}")
@@ -41,6 +41,7 @@ from . import field_values_t as field_values_t
41
41
  from . import fields_t as fields_t
42
42
  from . import generic_upload_t as generic_upload_t
43
43
  from .api.recipes import get_column_calculation_values as get_column_calculation_values_t
44
+ from .api.user import get_current_user_info as get_current_user_info_t
44
45
  from .api.recipes import get_curve as get_curve_t
45
46
  from .api.entity import get_entities_data as get_entities_data_t
46
47
  from .api.inputs import get_input_data as get_input_data_t
@@ -160,6 +161,7 @@ __all__: list[str] = [
160
161
  "fields_t",
161
162
  "generic_upload_t",
162
163
  "get_column_calculation_values_t",
164
+ "get_current_user_info_t",
163
165
  "get_curve_t",
164
166
  "get_entities_data_t",
165
167
  "get_input_data_t",
@@ -0,0 +1 @@
1
+ # DO NOT MODIFY -- This file is generated by type_spec
@@ -0,0 +1,40 @@
1
+ # DO NOT MODIFY -- This file is generated by type_spec
2
+ # ruff: noqa: E402 Q003
3
+ # fmt: off
4
+ # isort: skip_file
5
+ from __future__ import annotations
6
+ import typing # noqa: F401
7
+ import datetime # noqa: F401
8
+ from decimal import Decimal # noqa: F401
9
+ import dataclasses
10
+ from pkgs.serialization import serial_class
11
+ from ... import base_t
12
+
13
+ __all__: list[str] = [
14
+ "Arguments",
15
+ "Data",
16
+ "ENDPOINT_METHOD",
17
+ "ENDPOINT_PATH",
18
+ ]
19
+
20
+ ENDPOINT_METHOD = "GET"
21
+ ENDPOINT_PATH = "api/external/user/get_current_user_info"
22
+
23
+
24
+ # DO NOT MODIFY -- This file is generated by type_spec
25
+ @serial_class(
26
+ named_type_path="sdk.api.user.get_current_user_info.Arguments",
27
+ )
28
+ @dataclasses.dataclass(slots=base_t.ENABLE_SLOTS, kw_only=True) # type: ignore[literal-required]
29
+ class Arguments:
30
+ pass
31
+
32
+
33
+ # DO NOT MODIFY -- This file is generated by type_spec
34
+ @serial_class(
35
+ named_type_path="sdk.api.user.get_current_user_info.Data",
36
+ )
37
+ @dataclasses.dataclass(slots=base_t.ENABLE_SLOTS, kw_only=True) # type: ignore[literal-required]
38
+ class Data:
39
+ user_id: base_t.ObjectId
40
+ # DO NOT MODIFY -- This file is generated by type_spec
@@ -37,6 +37,7 @@ from uncountable.types import exports_t
37
37
  from uncountable.types import field_values_t
38
38
  from uncountable.types import generic_upload_t
39
39
  import uncountable.types.api.recipes.get_column_calculation_values as get_column_calculation_values_t
40
+ import uncountable.types.api.user.get_current_user_info as get_current_user_info_t
40
41
  import uncountable.types.api.recipes.get_curve as get_curve_t
41
42
  import uncountable.types.api.entity.get_entities_data as get_entities_data_t
42
43
  import uncountable.types.api.inputs.get_input_data as get_input_data_t
@@ -650,6 +651,17 @@ class ClientMethods(ABC):
650
651
  )
651
652
  return self.do_request(api_request=api_request, return_type=get_column_calculation_values_t.Data)
652
653
 
654
+ def get_current_user_info(
655
+ self,
656
+ ) -> get_current_user_info_t.Data:
657
+ args = get_current_user_info_t.Arguments()
658
+ api_request = APIRequest(
659
+ method=get_current_user_info_t.ENDPOINT_METHOD,
660
+ endpoint=get_current_user_info_t.ENDPOINT_PATH,
661
+ args=args,
662
+ )
663
+ return self.do_request(api_request=api_request, return_type=get_current_user_info_t.Data)
664
+
653
665
  def get_curve(
654
666
  self,
655
667
  *,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: UncountablePythonSDK
3
- Version: 0.0.119
3
+ Version: 0.0.121
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
@@ -25,7 +25,7 @@ examples/set_recipe_output_file_sdk.py,sha256=Lz1amqppnWTX83z-C090wCJ4hcKmCD3kb-
25
25
  examples/upload_files.py,sha256=qMaSvMSdTMPOOP55y1AwEurc0SOdZAMvEydlqJPsGpg,432
26
26
  examples/integration-server/pyproject.toml,sha256=-ZZ1R3B-Pf-F6gQX0-Me6u3G9cVW2B2_eechemCe7_4,9149
27
27
  examples/integration-server/jobs/materials_auto/concurrent_cron.py,sha256=xsK3H9ZEaniedC2nJUB0rqOcFI8y-ojfl_nLSJb9AMM,312
28
- examples/integration-server/jobs/materials_auto/example_cron.py,sha256=7VVQ-UJsq3DbGpN3XPnorRVZYo-vCwbfSU3VVDluIzA,699
28
+ examples/integration-server/jobs/materials_auto/example_cron.py,sha256=spUMiiTEFaepbVXecjD_4aEEfqEtZGGZuWTKs9J6Xcw,736
29
29
  examples/integration-server/jobs/materials_auto/example_http.py,sha256=eVq-Fss_AhmztxOMqqO-GYGF3KvPt1O5HbNwwC2arh8,1037
30
30
  examples/integration-server/jobs/materials_auto/example_instrument.py,sha256=czJF3qBFay1S8fuESOvmkvBv1wCtZGAlHjwvCyYr-Mw,2336
31
31
  examples/integration-server/jobs/materials_auto/example_runsheet_wh.py,sha256=_wILTnbzzLf9zrcQb_KQKytxxcya1ej6MqQnoUSS4fA,1180
@@ -107,7 +107,7 @@ uncountable/integration/cron.py,sha256=6eH-kIs3sdYPCyb62_L2M7U_uQTdMTdwY5hreEJb0
107
107
  uncountable/integration/entrypoint.py,sha256=BHOYPQgKvZE6HG8Rv15MkdYl8lRkvfDgv1OdLo0oQ9Q,433
108
108
  uncountable/integration/job.py,sha256=X8mNoy01Q6h26eNuPi50XwV6YLgaqYCGWt2PFDEddZU,7111
109
109
  uncountable/integration/scan_profiles.py,sha256=RHBmPc5E10YZzf4cmglwrn2yAy0jHBhQ-P_GlAk2TeU,2919
110
- uncountable/integration/scheduler.py,sha256=t75ANJN21DElUFvEdtgueTluF7y17jTtBDDF8f3NRDM,4812
110
+ uncountable/integration/scheduler.py,sha256=KK-1XCr8Rxi8puaynb3H0BySvsDBJJaPcGumy49ZMB8,4864
111
111
  uncountable/integration/server.py,sha256=lL9zmzqkQRf7V1fBT20SvIy-7ryz5hFf7DF4QX4pj1E,4699
112
112
  uncountable/integration/telemetry.py,sha256=VunRaMC9ykPaxUE_s6SarQieKrGNtTSyAr9omc315OI,7419
113
113
  uncountable/integration/db/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -120,7 +120,7 @@ uncountable/integration/executors/script_executor.py,sha256=BBQ9f0l7uH2hgKf60jtm
120
120
  uncountable/integration/http_server/__init__.py,sha256=WY2HMcL0UCAGYv8y6Pz-j0azbDGXwubFF21EH_zNPkc,189
121
121
  uncountable/integration/http_server/types.py,sha256=zVXXN8FPstrF9qFduwQBtxPG8I4AOK41nXAnxrtSgxw,1832
122
122
  uncountable/integration/queue_runner/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
123
- uncountable/integration/queue_runner/job_scheduler.py,sha256=3HE9inu3scwRtxh4wrProKR0P7ghjxlXlo57b706rC4,6259
123
+ uncountable/integration/queue_runner/job_scheduler.py,sha256=Roh7-mTj6rwMzFhBXv7hASNS2dMeTcAZEynJGVjkhEs,6080
124
124
  uncountable/integration/queue_runner/queue_runner.py,sha256=N4sUXmlGzVquybiJ7NQZavCJOBGrxBj6k7mb-TITaN0,1139
125
125
  uncountable/integration/queue_runner/types.py,sha256=8qTq29BTSa5rmW6CBlBntP0pNIiDcwu1wHa78pjroS0,219
126
126
  uncountable/integration/queue_runner/worker.py,sha256=WnFeDQN53QRhiF255ThIT2EeHdPw3QZ503_wPeWRqNE,4493
@@ -135,13 +135,13 @@ uncountable/integration/queue_runner/command_server/protocol/command_server_pb2.
135
135
  uncountable/integration/queue_runner/command_server/protocol/command_server_pb2.pyi,sha256=lWWZuDGoWwtP-gzhADnJi40_lFbO35fUPqNkoOXVnkA,2954
136
136
  uncountable/integration/queue_runner/command_server/protocol/command_server_pb2_grpc.py,sha256=I2kU_anlxOqfaiUR9IcMTuQYvCXa8xliY4sbvXgLYAE,7504
137
137
  uncountable/integration/queue_runner/datastore/__init__.py,sha256=6BefApqN8D2zlVOH14QAeVzwQ8j5NIb41-njT02Za0k,88
138
- uncountable/integration/queue_runner/datastore/datastore_sqlite.py,sha256=M5cg5pC0FokaRZPhmWDTS_JCzrmSE5yNChN15J47klw,4802
139
- uncountable/integration/queue_runner/datastore/interface.py,sha256=IrKdA7i_PWYKb4HXYYsggR589vn-6y408r6Bz8qFFOY,685
138
+ uncountable/integration/queue_runner/datastore/datastore_sqlite.py,sha256=YG3BuivjkAl__ZRwfMnyfx5W_zgQTwSaIPBsl-6s--0,5863
139
+ uncountable/integration/queue_runner/datastore/interface.py,sha256=tNlnY00D_OyuNOL3x_FtHXcJZAAON3SeX7fEU5C8z1U,824
140
140
  uncountable/integration/queue_runner/datastore/model.py,sha256=8-RI5A2yPZVGBLWINVmMd6VOl_oHtqGtnaNXcapAChw,577
141
141
  uncountable/integration/secret_retrieval/__init__.py,sha256=3QXVj35w8rRMxVvmmsViFYDi3lcb3g70incfalOEm6o,87
142
142
  uncountable/integration/secret_retrieval/retrieve_secret.py,sha256=LBEf18KHtXZxg-ZZ80stJ1vW39AWf0CQllP6pNu3Eq8,2994
143
143
  uncountable/integration/webhook_server/entrypoint.py,sha256=NQawXl_JCRojdVniS5RF7dobQQKW_Wy03bwy-uXknuA,3441
144
- uncountable/types/__init__.py,sha256=EZC_LgnO80PfE3SW4Sg95Ew3iUORmT_7oz-6u4zTulY,10169
144
+ uncountable/types/__init__.py,sha256=ubEQxcYFowfwzlbHf_zavI2EZOAm3sM5CZGfnAJRUMM,10271
145
145
  uncountable/types/async_batch.py,sha256=yCCWrrLQfxXVqZp-KskxLBNkNmuELdz4PJjx8ULppgs,662
146
146
  uncountable/types/async_batch_processor.py,sha256=h_8Snzt3lbEFlZAZFByt4Hg4dv2YlxMijHjTHjZ0aXY,22062
147
147
  uncountable/types/async_batch_t.py,sha256=JuswurXlYW38MfAXJ0UWb7hE2rmzFaHBAsNhRYAyMD4,3779
@@ -155,7 +155,7 @@ uncountable/types/calculations.py,sha256=fApOFpgBemt_t7IVneVR0VdI3X5EOxiG6Xhzr6R
155
155
  uncountable/types/calculations_t.py,sha256=pl-lhjyDQuj11Sf9g1-0BsSkN7Ez8UxDp8-KMQ_3enM,709
156
156
  uncountable/types/chemical_structure.py,sha256=ujyragaD26-QG5jgKnWhO7TN3N1V9b_04T2WhqNYxxo,281
157
157
  uncountable/types/chemical_structure_t.py,sha256=VFFyits_vx4t5L2euu_qFiSpsGJjURkDPr3ISnr3nPc,855
158
- uncountable/types/client_base.py,sha256=Qd8kxA0C76FKTAuoJOVjEw48mInfV_IXH2CBBTyYwAs,76382
158
+ uncountable/types/client_base.py,sha256=9osmz1wYM9PpqUSrWKHOYjwqNC6pOL6RVsIXIq_niW4,76886
159
159
  uncountable/types/client_config.py,sha256=qLpHt4O_B098CyN6qQajoxZ2zjZ1DILXLUEGyyGP0TQ,280
160
160
  uncountable/types/client_config_t.py,sha256=yTFIYAitMrcc4oV9J-HADODS_Hwi45z-piz7rr7QT04,781
161
161
  uncountable/types/curves.py,sha256=QyEyC20jsG-LGKVx6miiF-w70vKMwNkILFBDIJ5Ok9g,345
@@ -324,7 +324,9 @@ uncountable/types/api/triggers/__init__.py,sha256=gCgbynxG3jA8FQHzercKtrHKHkiIKr
324
324
  uncountable/types/api/triggers/run_trigger.py,sha256=dgDX_sRWSJ36UuzMZhG25oHV1HIOUKYY2G3fjKugZrw,1204
325
325
  uncountable/types/api/uploader/__init__.py,sha256=gCgbynxG3jA8FQHzercKtrHKHkiIKr8APdZYUniAor8,55
326
326
  uncountable/types/api/uploader/invoke_uploader.py,sha256=Bj7Dq4A90k00suacwk3bLA_dCb2aovS1kAbVam2AQnM,1395
327
- uncountablepythonsdk-0.0.119.dist-info/METADATA,sha256=N4fhXwC1KXS0W6OVTqwJE8XhTlZt6elWg26adle9KFk,2174
328
- uncountablepythonsdk-0.0.119.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
329
- uncountablepythonsdk-0.0.119.dist-info/top_level.txt,sha256=1UVGjAU-6hJY9qw2iJ7nCBeEwZ793AEN5ZfKX9A1uj4,31
330
- uncountablepythonsdk-0.0.119.dist-info/RECORD,,
327
+ uncountable/types/api/user/__init__.py,sha256=gCgbynxG3jA8FQHzercKtrHKHkiIKr8APdZYUniAor8,55
328
+ uncountable/types/api/user/get_current_user_info.py,sha256=Avqi_RXtRgbefrT_dwJ9MrO6eDNSSa_Nu650FSuESlg,1109
329
+ uncountablepythonsdk-0.0.121.dist-info/METADATA,sha256=t53LhUUiQvTlHYZC-eX4VQU2KiyBCglI5Ywlmsh_qAk,2174
330
+ uncountablepythonsdk-0.0.121.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
331
+ uncountablepythonsdk-0.0.121.dist-info/top_level.txt,sha256=1UVGjAU-6hJY9qw2iJ7nCBeEwZ793AEN5ZfKX9A1uj4,31
332
+ uncountablepythonsdk-0.0.121.dist-info/RECORD,,