UncountablePythonSDK 0.0.118__py3-none-any.whl → 0.0.120__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.
- examples/integration-server/jobs/materials_auto/example_cron.py +3 -0
- pkgs/type_spec/builder.py +3 -1
- uncountable/integration/cli.py +16 -8
- uncountable/integration/queue_runner/datastore/datastore_sqlite.py +29 -0
- uncountable/integration/queue_runner/datastore/interface.py +5 -0
- uncountable/integration/queue_runner/job_scheduler.py +4 -10
- uncountable/integration/queue_runner/worker.py +1 -4
- {uncountablepythonsdk-0.0.118.dist-info → uncountablepythonsdk-0.0.120.dist-info}/METADATA +2 -1
- {uncountablepythonsdk-0.0.118.dist-info → uncountablepythonsdk-0.0.120.dist-info}/RECORD +11 -11
- {uncountablepythonsdk-0.0.118.dist-info → uncountablepythonsdk-0.0.120.dist-info}/WHEEL +0 -0
- {uncountablepythonsdk-0.0.118.dist-info → uncountablepythonsdk-0.0.120.dist-info}/top_level.txt +0 -0
|
@@ -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)
|
pkgs/type_spec/builder.py
CHANGED
|
@@ -1521,8 +1521,10 @@ class SpecBuilder:
|
|
|
1521
1521
|
if len(path) == 2:
|
|
1522
1522
|
if isinstance(defn_type, SpecTypeDefnStringEnum):
|
|
1523
1523
|
assert path[1].parameters is None
|
|
1524
|
+
statement = f"$import: [{defn_type.namespace.name}]"
|
|
1524
1525
|
self.ensure(
|
|
1525
|
-
path[1].name in defn_type.values,
|
|
1526
|
+
path[1].name in defn_type.values,
|
|
1527
|
+
f"missing-enum-value: {path} have you specified the dependency in an import statement: {statement}",
|
|
1526
1528
|
)
|
|
1527
1529
|
return SpecTypeLiteralWrapper(
|
|
1528
1530
|
value=path[1].name,
|
uncountable/integration/cli.py
CHANGED
|
@@ -15,10 +15,13 @@ from uncountable.types import queued_job_t
|
|
|
15
15
|
|
|
16
16
|
def register_enqueue_job_parser(
|
|
17
17
|
sub_parser_manager: argparse._SubParsersAction,
|
|
18
|
+
parents: list[argparse.ArgumentParser],
|
|
18
19
|
) -> None:
|
|
19
20
|
run_parser = sub_parser_manager.add_parser(
|
|
20
21
|
"run",
|
|
21
|
-
|
|
22
|
+
parents=parents,
|
|
23
|
+
help="Process a job with a given host and job ID",
|
|
24
|
+
description="Process a job with a given host and job ID",
|
|
22
25
|
)
|
|
23
26
|
run_parser.add_argument("job_id", type=str, help="The ID of the job to process")
|
|
24
27
|
|
|
@@ -37,9 +40,13 @@ def register_enqueue_job_parser(
|
|
|
37
40
|
|
|
38
41
|
def register_list_queued_jobs(
|
|
39
42
|
sub_parser_manager: argparse._SubParsersAction,
|
|
43
|
+
parents: list[argparse.ArgumentParser],
|
|
40
44
|
) -> None:
|
|
41
45
|
list_queued_jobs_parser = sub_parser_manager.add_parser(
|
|
42
|
-
"list-queued-jobs",
|
|
46
|
+
"list-queued-jobs",
|
|
47
|
+
parents=parents,
|
|
48
|
+
help="List all jobs queued on the integration server",
|
|
49
|
+
description="List all jobs queued on the integration server",
|
|
43
50
|
)
|
|
44
51
|
|
|
45
52
|
list_queued_jobs_parser.add_argument(
|
|
@@ -81,24 +88,25 @@ def register_list_queued_jobs(
|
|
|
81
88
|
def main() -> None:
|
|
82
89
|
logger = Logger(get_current_span())
|
|
83
90
|
|
|
84
|
-
|
|
91
|
+
main_parser = argparse.ArgumentParser(
|
|
85
92
|
description="Execute a given integrations server command."
|
|
86
93
|
)
|
|
87
94
|
|
|
88
|
-
|
|
95
|
+
base_parser = argparse.ArgumentParser(add_help=False)
|
|
96
|
+
base_parser.add_argument(
|
|
89
97
|
"--host", type=str, default="localhost", nargs="?", help="The host to run on"
|
|
90
98
|
)
|
|
91
99
|
|
|
92
|
-
subparser_action =
|
|
100
|
+
subparser_action = main_parser.add_subparsers(
|
|
93
101
|
dest="command",
|
|
94
102
|
required=True,
|
|
95
103
|
help="The command to execute (e.g., 'run')",
|
|
96
104
|
)
|
|
97
105
|
|
|
98
|
-
register_enqueue_job_parser(subparser_action)
|
|
99
|
-
register_list_queued_jobs(subparser_action)
|
|
106
|
+
register_enqueue_job_parser(subparser_action, parents=[base_parser])
|
|
107
|
+
register_list_queued_jobs(subparser_action, parents=[base_parser])
|
|
100
108
|
|
|
101
|
-
args =
|
|
109
|
+
args = main_parser.parse_args()
|
|
102
110
|
with logger.push_scope(args.command):
|
|
103
111
|
args.func(args)
|
|
104
112
|
|
|
@@ -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
|
-
|
|
118
|
-
|
|
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
|
|
127
|
-
return
|
|
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,
|
|
@@ -111,9 +111,6 @@ def run_queued_job(
|
|
|
111
111
|
job_definition=job_details.job_definition,
|
|
112
112
|
job_uuid=queued_job.queued_job_uuid,
|
|
113
113
|
)
|
|
114
|
-
except Exception as e:
|
|
115
|
-
job_logger.log_exception(e)
|
|
116
|
-
return job_definition_t.JobResult(success=False)
|
|
117
114
|
except BaseException as e:
|
|
118
115
|
job_logger.log_exception(e)
|
|
119
|
-
|
|
116
|
+
return job_definition_t.JobResult(success=False)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: UncountablePythonSDK
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.120
|
|
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
|
|
@@ -40,6 +40,7 @@ Requires-Dist: protobuf>=4.21.1
|
|
|
40
40
|
Requires-Dist: azure-storage-blob==12.*
|
|
41
41
|
Requires-Dist: boto3-stubs[essential,ses]==1.*
|
|
42
42
|
Requires-Dist: msgspec==0.19.*
|
|
43
|
+
Requires-Dist: tabulate==0.9.0
|
|
43
44
|
Provides-Extra: test
|
|
44
45
|
Requires-Dist: mypy==1.*; extra == "test"
|
|
45
46
|
Requires-Dist: ruff==0.*; extra == "test"
|
|
@@ -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=
|
|
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
|
|
@@ -64,7 +64,7 @@ pkgs/strenum_compat/__init__.py,sha256=wXRFeNvBm8RU6dy1PFJ5sRLgUIEeH_DVR95Sv5qpG
|
|
|
64
64
|
pkgs/strenum_compat/strenum_compat.py,sha256=uOUAgpYTjHs1MX8dG81jRlyTkt3KNbkV_25zp7xTX2s,36
|
|
65
65
|
pkgs/type_spec/__init__.py,sha256=h5DmJTca4QVV10sZR1x0-MlkZfuGYDfapR3zHvXfzto,19
|
|
66
66
|
pkgs/type_spec/__main__.py,sha256=5bJaX9Y_-FavP0qwzhk-z-V97UY7uaezJTa1zhO_HHQ,1048
|
|
67
|
-
pkgs/type_spec/builder.py,sha256=
|
|
67
|
+
pkgs/type_spec/builder.py,sha256=fVFRSJwZDJz33CtD8lC9O5L53gtvcxdx4aNjH4z2j-k,54581
|
|
68
68
|
pkgs/type_spec/config.py,sha256=m0Rky7Rg2jMglDPQChF30p5h5P86Ap1GObwzLzmypNE,5829
|
|
69
69
|
pkgs/type_spec/cross_output_links.py,sha256=ttFNfuQmR3sNnPSeUER5IPgLiYc-FB5gjlf7RyFYMpc,3293
|
|
70
70
|
pkgs/type_spec/emit_io_ts.py,sha256=CUvBs0boB_X-Kndh66yYcqFfq3oC_LGs8YffLkJ0ZXA,5707
|
|
@@ -101,7 +101,7 @@ uncountable/core/environment.py,sha256=4gdJB0ZhRxKlqSKLaE4vUvEUGZ5fy8IAwXcGDRdYt
|
|
|
101
101
|
uncountable/core/file_upload.py,sha256=bgvXk9vfF5qlhy2NAUcEEG7Q7i-c1wr2HrpaWD7HldU,4516
|
|
102
102
|
uncountable/core/types.py,sha256=s2CjqYJpsmbC7xMwxxT7kJ_V9bwokrjjWVVjpMcQpKI,333
|
|
103
103
|
uncountable/integration/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
104
|
-
uncountable/integration/cli.py,sha256=
|
|
104
|
+
uncountable/integration/cli.py,sha256=eshJ0lv4u00UOFrlkCwamE8NaxX1qN2q79wCJcsFrJs,3580
|
|
105
105
|
uncountable/integration/construct_client.py,sha256=I53mGcdS88hba3HFwgXmWQaTd1d5u0jWNSwyc_vlVsQ,1937
|
|
106
106
|
uncountable/integration/cron.py,sha256=6eH-kIs3sdYPCyb62_L2M7U_uQTdMTdwY5hreEJb0hw,887
|
|
107
107
|
uncountable/integration/entrypoint.py,sha256=BHOYPQgKvZE6HG8Rv15MkdYl8lRkvfDgv1OdLo0oQ9Q,433
|
|
@@ -120,10 +120,10 @@ 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=
|
|
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
|
-
uncountable/integration/queue_runner/worker.py,sha256=
|
|
126
|
+
uncountable/integration/queue_runner/worker.py,sha256=WnFeDQN53QRhiF255ThIT2EeHdPw3QZ503_wPeWRqNE,4493
|
|
127
127
|
uncountable/integration/queue_runner/command_server/__init__.py,sha256=gQPVILGpWzCr2i5GJyoqna7AOSFvtn4tav69gB78mTQ,571
|
|
128
128
|
uncountable/integration/queue_runner/command_server/command_client.py,sha256=Kjov_fQdx-_jJpDeWxQEg8XmlfwWQL94ufIgEjib-nc,2776
|
|
129
129
|
uncountable/integration/queue_runner/command_server/command_server.py,sha256=nDTvFN3U5Tm2ZejQhqZpOaaWpVOJiVB26JlNIT2y0fY,3876
|
|
@@ -135,8 +135,8 @@ 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=
|
|
139
|
-
uncountable/integration/queue_runner/datastore/interface.py,sha256=
|
|
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
|
|
@@ -324,7 +324,7 @@ 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.
|
|
328
|
-
uncountablepythonsdk-0.0.
|
|
329
|
-
uncountablepythonsdk-0.0.
|
|
330
|
-
uncountablepythonsdk-0.0.
|
|
327
|
+
uncountablepythonsdk-0.0.120.dist-info/METADATA,sha256=v5j4j9nJrkLYfdm8h9Q-nEIwqmFiDSWSAGGlWUAO8bw,2174
|
|
328
|
+
uncountablepythonsdk-0.0.120.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
329
|
+
uncountablepythonsdk-0.0.120.dist-info/top_level.txt,sha256=1UVGjAU-6hJY9qw2iJ7nCBeEwZ793AEN5ZfKX9A1uj4,31
|
|
330
|
+
uncountablepythonsdk-0.0.120.dist-info/RECORD,,
|
|
File without changes
|
{uncountablepythonsdk-0.0.118.dist-info → uncountablepythonsdk-0.0.120.dist-info}/top_level.txt
RENAMED
|
File without changes
|