UncountablePythonSDK 0.0.65__py3-none-any.whl → 0.0.67__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: UncountablePythonSDK
3
- Version: 0.0.65
3
+ Version: 0.0.67
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
@@ -80,12 +80,13 @@ uncountable/core/environment.py,sha256=4rLWeUIDYB6w1iqrAiSEaD_OqMoo_ed3xcjz5jM4H
80
80
  uncountable/core/file_upload.py,sha256=qR7BBBWVxFNrb1_WICreo3dkZygE9lcE1fmZCQrDZU0,3469
81
81
  uncountable/core/types.py,sha256=s2CjqYJpsmbC7xMwxxT7kJ_V9bwokrjjWVVjpMcQpKI,333
82
82
  uncountable/integration/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
83
+ uncountable/integration/cli.py,sha256=R_z84CejxV8QW8pXQWX1RxVgMiA3Sgt_X-zMFVNtXLw,2856
83
84
  uncountable/integration/construct_client.py,sha256=I2XTamht13vs-JYkV4PpNS_Pc4FJm-KVYqNNvxI4qNk,1916
84
85
  uncountable/integration/cron.py,sha256=Gwu1Mq4lZZvtvx5tlnWJHnXJp948Xk9CXdS1ULVCVws,1629
85
86
  uncountable/integration/entrypoint.py,sha256=wgOXhTzErttRjOzV4rS4psZW5qUKIa5ez89QndQl61k,785
86
87
  uncountable/integration/job.py,sha256=UrsZHWXKE2wD5M3lFKJCXvDdWj7QMDtAREKv6RBnT3Q,1548
87
- uncountable/integration/scan_profiles.py,sha256=3o_h5Ta8ZQEX1epWyXhtyEof0M1b7MobVG7bRKcsFuM,1166
88
- uncountable/integration/server.py,sha256=PfIIh0_uzJia1gsHyVDZGQhS3XcjxetXEnl35zX3VaE,4595
88
+ uncountable/integration/scan_profiles.py,sha256=fHRS9Su6JlYWKBGZkA3KgUSqbT_PrB91Xe2rkdvv1Ew,1396
89
+ uncountable/integration/server.py,sha256=xVVdLZVDOKB9KIJ7Hi3fk4JoGH59py2AjUCd2Ikwoj4,4705
89
90
  uncountable/integration/telemetry.py,sha256=MwQLmgCoxpmA_UTp3e2ZB37wcDzKM0qzm5MrmaiJWhU,7142
90
91
  uncountable/integration/db/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
91
92
  uncountable/integration/db/connect.py,sha256=YtQHJ1DBGPhxKFRCfiXqohOYUceKSxMVOJ88aPI48Ug,181
@@ -106,7 +107,7 @@ uncountable/types/calculations.py,sha256=FFO_D3BbKoGDZnqWvTKpW4KF359i2vrKjpdFCLY
106
107
  uncountable/types/calculations_t.py,sha256=7GTSi2L8NYjzjUJJx3cmtVkK9uD-uhfYvIFK-ffQj-8,556
107
108
  uncountable/types/chemical_structure.py,sha256=E-LnikTFDoVQ1b2zKaVUIO_PAKm-7aZZYJi8I8SDSic,302
108
109
  uncountable/types/chemical_structure_t.py,sha256=aFsTkkbzy6Gvyde3qrrEYD95gcYhxkgKMiDRaRE0o-Y,760
109
- uncountable/types/client_base.py,sha256=my-n1qrfXM6TwIYw0hzp-2W-rH8FVFg1657DeYLreGU,66315
110
+ uncountable/types/client_base.py,sha256=hjKTulIhW_zgRHxQz84JfUyEqIpV8sH3AB1TfWhlizU,66363
110
111
  uncountable/types/client_config.py,sha256=4h5Liko9uKCo9_0gdbPhoK6Jr2Kv7tioLiQ8iKeq-_4,301
111
112
  uncountable/types/client_config_t.py,sha256=_HdS37gMSTIiD4qLnW9dIgt8_Rt5A6xhwMGGga7vnLg,625
112
113
  uncountable/types/curves.py,sha256=W6uMpG5SyW1MS82szNpxkFEn1MnxNpBFyFbQb2Ysfng,366
@@ -200,7 +201,7 @@ uncountable/types/api/inputs/get_input_data.py,sha256=HpSNow6fzyzru83rf45OacNimH
200
201
  uncountable/types/api/inputs/get_input_names.py,sha256=m7drfXhYwNnLKIOMTOGHehDQIZGGFmiwXcobyvIAOv8,1171
201
202
  uncountable/types/api/inputs/get_inputs_data.py,sha256=hXu7AVHaMpdoOhAfKcoUZqhix1nAOzmKG6qdWAUAprE,1875
202
203
  uncountable/types/api/inputs/set_input_attribute_values.py,sha256=J-vi3lc_aPyNSRJLg1iXjwpv_aY1J10NcpCWjzzTpQA,1347
203
- uncountable/types/api/inputs/set_input_category.py,sha256=V6QVFBJaeOyULj4a2rA6Hs7BEPvPnFk6CIzJmiywFh0,955
204
+ uncountable/types/api/inputs/set_input_category.py,sha256=PLV6yLgdRxiO4oSMHGUTbS7amjPztNkEt5VA7uHrMNo,972
204
205
  uncountable/types/api/inputs/set_input_subcategories.py,sha256=wZ6ogTtBRQlJV5619jxW5fGiF4WbHC7x3CwzdcxvQYQ,979
205
206
  uncountable/types/api/inputs/set_intermediate_type.py,sha256=KZXfkcb7zEZ1wuoNb0RbD2AzirPujnGQbwcABX66juY,1109
206
207
  uncountable/types/api/material_families/__init__.py,sha256=gCgbynxG3jA8FQHzercKtrHKHkiIKr8APdZYUniAor8,55
@@ -248,7 +249,7 @@ uncountable/types/api/triggers/__init__.py,sha256=gCgbynxG3jA8FQHzercKtrHKHkiIKr
248
249
  uncountable/types/api/triggers/run_trigger.py,sha256=_Rpha9nxXI3Xr17CrGDtofg4HZ81x2lt0rMZ6As0qfE,893
249
250
  uncountable/types/api/uploader/__init__.py,sha256=gCgbynxG3jA8FQHzercKtrHKHkiIKr8APdZYUniAor8,55
250
251
  uncountable/types/api/uploader/invoke_uploader.py,sha256=Rc77y5q-3R9-SNQgm8P35zKaW2D1Hbtm7PDixnOn1G0,1025
251
- UncountablePythonSDK-0.0.65.dist-info/METADATA,sha256=5EGLuEpkaopCygq6bepsi86W93jQ6Q2YW_70rip6z-g,1993
252
- UncountablePythonSDK-0.0.65.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
253
- UncountablePythonSDK-0.0.65.dist-info/top_level.txt,sha256=1UVGjAU-6hJY9qw2iJ7nCBeEwZ793AEN5ZfKX9A1uj4,31
254
- UncountablePythonSDK-0.0.65.dist-info/RECORD,,
252
+ UncountablePythonSDK-0.0.67.dist-info/METADATA,sha256=PDTBKKMu5NfqMmNYW8Nj9cudRZeSgcLEIqHzzzYJegs,1993
253
+ UncountablePythonSDK-0.0.67.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
254
+ UncountablePythonSDK-0.0.67.dist-info/top_level.txt,sha256=1UVGjAU-6hJY9qw2iJ7nCBeEwZ793AEN5ZfKX9A1uj4,31
255
+ UncountablePythonSDK-0.0.67.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (74.1.2)
2
+ Generator: setuptools (75.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -0,0 +1,74 @@
1
+ import argparse
2
+
3
+ from opentelemetry.trace import get_current_span
4
+
5
+ from uncountable.core.async_batch import AsyncBatchProcessor
6
+ from uncountable.integration.construct_client import construct_uncountable_client
7
+ from uncountable.integration.executors.executors import execute_job
8
+ from uncountable.integration.job import CronJobArguments
9
+ from uncountable.integration.scan_profiles import load_profiles
10
+ from uncountable.integration.telemetry import JobLogger, Logger
11
+ from uncountable.types import job_definition_t
12
+
13
+
14
+ def main() -> None:
15
+ logger = Logger(get_current_span())
16
+
17
+ profiles = load_profiles()
18
+
19
+ parser = argparse.ArgumentParser(
20
+ description="Process a job with a given command and job ID."
21
+ )
22
+
23
+ parser.add_argument(
24
+ "command",
25
+ type=str,
26
+ choices=["run"],
27
+ help="The command to execute (e.g., 'run')",
28
+ )
29
+
30
+ parser.add_argument("job_id", type=str, help="The ID of the job to process")
31
+
32
+ args = parser.parse_args()
33
+
34
+ with logger.push_scope(args.command):
35
+ if args.command == "run":
36
+ job_result: job_definition_t.JobResult | None = None
37
+ for profile in profiles:
38
+ for job in profile.definition.jobs:
39
+ if job.id == args.job_id:
40
+ profile_meta = job_definition_t.ProfileMetadata(
41
+ name=profile.name,
42
+ base_url=profile.definition.base_url,
43
+ auth_retrieval=profile.definition.auth_retrieval,
44
+ client_options=profile.definition.client_options,
45
+ )
46
+ job_logger = JobLogger(
47
+ base_span=logger.current_span,
48
+ profile_metadata=profile_meta,
49
+ job_definition=job,
50
+ )
51
+ client = construct_uncountable_client(
52
+ profile_meta=profile_meta, job_logger=job_logger
53
+ )
54
+ batch_processor = AsyncBatchProcessor(client=client)
55
+ job_args = CronJobArguments(
56
+ job_definition=job,
57
+ profile_metadata=profile_meta,
58
+ client=client,
59
+ batch_processor=batch_processor,
60
+ logger=job_logger,
61
+ )
62
+ job_result = execute_job(
63
+ job_definition=job,
64
+ profile_metadata=profile_meta,
65
+ args=job_args,
66
+ )
67
+ break
68
+ if job_result is None:
69
+ raise Exception(f"no such job id {args.job_id}")
70
+ else:
71
+ parser.print_usage()
72
+
73
+
74
+ main()
@@ -20,6 +20,7 @@ def load_profiles() -> list[ProfileDetails]:
20
20
  entry for entry in resources.files(profiles_module).iterdir() if entry.is_dir()
21
21
  ]
22
22
  profile_details: list[ProfileDetails] = []
23
+ seen_job_ids: set[str] = set()
23
24
  for profile_file in profiles:
24
25
  profile_name = profile_file.name
25
26
  try:
@@ -27,6 +28,10 @@ def load_profiles() -> list[ProfileDetails]:
27
28
  package=".".join([profiles_module, profile_name]),
28
29
  resource="profile.yaml",
29
30
  )
31
+ for job in definition.jobs:
32
+ if job.id in seen_job_ids:
33
+ raise Exception(f"multiple jobs with id {job.id}")
34
+ seen_job_ids.add(job.id)
30
35
  profile_details.append(
31
36
  ProfileDetails(name=profile_name, definition=definition)
32
37
  )
@@ -76,6 +76,7 @@ class IntegrationServer:
76
76
  existing_job.modify(
77
77
  name=job_defn.name,
78
78
  kwargs=job_kwargs,
79
+ misfire_grace_period=None,
79
80
  )
80
81
  existing_job.reschedule(
81
82
  CronTrigger.from_crontab(job_defn.cron_spec)
@@ -97,6 +98,7 @@ class IntegrationServer:
97
98
  name=job_defn.name,
98
99
  id=job_defn.id,
99
100
  kwargs=job_kwargs,
101
+ misfire_grace_period=None,
100
102
  **job_opts,
101
103
  )
102
104
  case WebhookJobDefinition():
@@ -26,7 +26,7 @@ ENDPOINT_PATH = "api/external/inputs/external_set_input_category"
26
26
  @dataclasses.dataclass(kw_only=True)
27
27
  class Arguments:
28
28
  input_key: identifier_t.IdentifierKey
29
- category_id: int
29
+ category_id: typing.Optional[int]
30
30
  material_family_ids: typing.Optional[list[int]] = None
31
31
 
32
32
 
@@ -1193,13 +1193,13 @@ class ClientMethods(ABC):
1193
1193
  self,
1194
1194
  *,
1195
1195
  input_key: identifier_t.IdentifierKey,
1196
- category_id: int,
1196
+ category_id: typing.Optional[int],
1197
1197
  material_family_ids: typing.Optional[list[int]] = None,
1198
1198
  ) -> set_input_category_t.Data:
1199
1199
  """Sets subcategories for an input
1200
1200
 
1201
1201
  :param input_key: Identifier for the input
1202
- :param category_id: The subcategory identifiers to set
1202
+ :param category_id: The category identifier to set. Null unsets the current category.
1203
1203
  :param material_family_ids: The material families to perform the update in
1204
1204
  """
1205
1205
  args = set_input_category_t.Arguments(