UncountablePythonSDK 0.0.68__py3-none-any.whl → 0.0.69__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.68
3
+ Version: 0.0.69
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=jD38J5O9MhuLHpA86cUgbFO8fVXouYupS3nGRAnh2x0,138
6
+ docs/requirements.txt,sha256=pHca02KQbB3qx4V6MUrwtctgvIheT--jGQvs6OVqaUg,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
@@ -18,7 +18,12 @@ examples/async_batch.py,sha256=CffQ8O9drJ-Mdd6S5DnMIOBsHv5aVkTZrD3l3xBnB4s,1094
18
18
  examples/create_entity.py,sha256=t6WBZsWRDbWZgFCWXKGgKL5LAB6-38oaiNYGxMAa2No,686
19
19
  examples/edit_recipe_inputs.py,sha256=mtk_oSkN-OT2hKkb1XKXrRiUaGYTJstXuOKyTR51Fjo,1663
20
20
  examples/invoke_uploader.py,sha256=rEvmVY5TjigN_-4PTQdkjY-bC5DrYMcJgquyZ4Tt5FM,748
21
+ examples/set_recipe_metadata_file.py,sha256=oPBhMo9T17zj4YpJRkmVH9lknYcT8livph0KssxYtg4,1048
22
+ examples/set_recipe_output_file_sdk.py,sha256=Lz1amqppnWTX83z-C090wCJ4hcKmCD3kb-4v0uBRi0Y,782
21
23
  examples/upload_files.py,sha256=tUfKFqiqwnw08OL5Y8_e4j5pSRhp94cFex8XTuVa_ig,487
24
+ examples/integration-server/pyproject.toml,sha256=yVYpx5VG3bKQCYjmCSKN_MRjxoOoF2xF2KzkCcvDHh4,9134
25
+ examples/integration-server/jobs/materials_auto/example_cron.py,sha256=ITXXIDLrFhwS_YMrcuEBTciGoC8ozjB9SXL-qTCZT2k,707
26
+ examples/integration-server/jobs/materials_auto/profile.yaml,sha256=WZTNlgc8uH412oRmWHWWuenYo_6LnrIL11V0HMkGsB0,352
22
27
  pkgs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
28
  pkgs/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
29
  pkgs/argument_parser/__init__.py,sha256=CsQ6QoPKSLLRVl-z6URAmPkiUL9ZPZoV4rJHgy_-RjA,385
@@ -86,6 +91,7 @@ uncountable/integration/cron.py,sha256=Gwu1Mq4lZZvtvx5tlnWJHnXJp948Xk9CXdS1ULVCV
86
91
  uncountable/integration/entrypoint.py,sha256=wgOXhTzErttRjOzV4rS4psZW5qUKIa5ez89QndQl61k,785
87
92
  uncountable/integration/job.py,sha256=UrsZHWXKE2wD5M3lFKJCXvDdWj7QMDtAREKv6RBnT3Q,1548
88
93
  uncountable/integration/scan_profiles.py,sha256=fHRS9Su6JlYWKBGZkA3KgUSqbT_PrB91Xe2rkdvv1Ew,1396
94
+ uncountable/integration/scheduler.py,sha256=1YwY2f26Wr1kIlJfUthuRIXsUJZfynf9X3Zu76NK3ts,3262
89
95
  uncountable/integration/server.py,sha256=-ALtXNlBDnDbeSJcqAHHJzl46mGuq43aIM9RLzG-ZWA,4701
90
96
  uncountable/integration/telemetry.py,sha256=MwQLmgCoxpmA_UTp3e2ZB37wcDzKM0qzm5MrmaiJWhU,7142
91
97
  uncountable/integration/db/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -96,8 +102,8 @@ uncountable/integration/executors/generic_upload_executor.py,sha256=PpxZmGUac4Pt
96
102
  uncountable/integration/executors/script_executor.py,sha256=OmSBOtU48G3mqza9c2lCm84pGGyaDk-ZBJCx3RsdJXc,846
97
103
  uncountable/integration/secret_retrieval/__init__.py,sha256=3QXVj35w8rRMxVvmmsViFYDi3lcb3g70incfalOEm6o,87
98
104
  uncountable/integration/secret_retrieval/retrieve_secret.py,sha256=eoPWbkUtCn_63A4TFlK_nvEDvfm4u2fiOoglmAkBG3U,3004
99
- uncountable/integration/webhook_server/entrypoint.py,sha256=2Eq1JYKGj6rM4Yb5eeuEcARA2Y_lEV8LT7J7HtelyaM,6102
100
- uncountable/types/__init__.py,sha256=zejeAhEYwf5Jbs-n7S9Wr6NPFXfhWIFdyARB1v40scc,8390
105
+ uncountable/integration/webhook_server/entrypoint.py,sha256=01yx5I_4e380oGqaceCcsGhV1JPHcY5lXIFJoghFmwc,6179
106
+ uncountable/types/__init__.py,sha256=MDzXxVKMd9OY6WGXqTRRO_XxgHeHy9OOig9L__BlF9s,8498
101
107
  uncountable/types/async_batch.py,sha256=_OhT25_dEVts_z_n1kqfJH3xlZg3btLqR6TNkfFLlXE,609
102
108
  uncountable/types/async_batch_processor.py,sha256=obVzN-PcYLV2pHScszfCGjSq6-Xc34WM1ysx6Fv6tZk,11293
103
109
  uncountable/types/async_batch_t.py,sha256=ipSGz93O1KB-WE2dvlvflTKS51rJrf3bJkUojyxos7I,2193
@@ -107,13 +113,13 @@ uncountable/types/calculations.py,sha256=FFO_D3BbKoGDZnqWvTKpW4KF359i2vrKjpdFCLY
107
113
  uncountable/types/calculations_t.py,sha256=7GTSi2L8NYjzjUJJx3cmtVkK9uD-uhfYvIFK-ffQj-8,556
108
114
  uncountable/types/chemical_structure.py,sha256=E-LnikTFDoVQ1b2zKaVUIO_PAKm-7aZZYJi8I8SDSic,302
109
115
  uncountable/types/chemical_structure_t.py,sha256=aFsTkkbzy6Gvyde3qrrEYD95gcYhxkgKMiDRaRE0o-Y,760
110
- uncountable/types/client_base.py,sha256=hjKTulIhW_zgRHxQz84JfUyEqIpV8sH3AB1TfWhlizU,66363
116
+ uncountable/types/client_base.py,sha256=wgAU6xbOmY9oiKN54JYoJmA3UzJSXewCI2YBWzweuHs,67232
111
117
  uncountable/types/client_config.py,sha256=4h5Liko9uKCo9_0gdbPhoK6Jr2Kv7tioLiQ8iKeq-_4,301
112
118
  uncountable/types/client_config_t.py,sha256=_HdS37gMSTIiD4qLnW9dIgt8_Rt5A6xhwMGGga7vnLg,625
113
119
  uncountable/types/curves.py,sha256=W6uMpG5SyW1MS82szNpxkFEn1MnxNpBFyFbQb2Ysfng,366
114
120
  uncountable/types/curves_t.py,sha256=TDpsThz4lKmiBmS9b4ItUSCp64TGv8-qDkxb4B2RoTo,1314
115
121
  uncountable/types/entity.py,sha256=3XhLteFDRDZvHejDuYh-KvB65hpwrBygljFfiUcOAM8,315
116
- uncountable/types/entity_t.py,sha256=D-Z92DPWObIYdqaQE4UDQX2RB3GBUuyAgcAkKaSBuWw,14599
122
+ uncountable/types/entity_t.py,sha256=YXwFnscd4ivJOSH9IpYvCxeHhZob29ZvkGFgkypYAlo,14705
117
123
  uncountable/types/experiment_groups.py,sha256=_0OXcPzSAbkE-rfKt5tPx178YJ4pcEKZvrCxUHgDnvw,309
118
124
  uncountable/types/experiment_groups_t.py,sha256=0IGAXwkYiwdjj6aFjLMihxwauACQTyuRU_1usJTeUg4,593
119
125
  uncountable/types/field_values.py,sha256=uuIWX-xmfvcinYPdfkWJeb56zzQY01mc9rmotMPMh24,503
@@ -149,7 +155,7 @@ uncountable/types/recipe_inputs_t.py,sha256=t5nFzuF1AU6SUHpya6xKHSlcckmt3XxAuk9o
149
155
  uncountable/types/recipe_links.py,sha256=YRiu6t7FWr7ZWycIaOPXBtQFqbY_q5unaP6KQzh1LzE,343
150
156
  uncountable/types/recipe_links_t.py,sha256=ZaTeP8AsIT9-gDRi_uQreDsAzEmqF34YTesh9uydYa0,1417
151
157
  uncountable/types/recipe_metadata.py,sha256=Zpcrupq_mlT2UhXpMJup5XjtubmvgZ8SbJNq7da2pCs,441
152
- uncountable/types/recipe_metadata_t.py,sha256=y2O2rIanS6WG0j1UDSsRSwyEKYNDeNaixlR3PmkYnkU,1455
158
+ uncountable/types/recipe_metadata_t.py,sha256=3gcspWc7CYCoLtoDLhhthPg3o5NaZZTF4NZvH8xTufk,1521
153
159
  uncountable/types/recipe_output_metadata.py,sha256=83jKZCvogG9QjZeJpQptdSam_MnnUj-tqh9EVIrTWjE,322
154
160
  uncountable/types/recipe_output_metadata_t.py,sha256=jazuYonhY0FklLy2jWoS51LM6Mc_1ZBHvPu7-6btJd0,607
155
161
  uncountable/types/recipe_tags.py,sha256=eyYa_rox00a1JQ0lOQv9STnJI04ksCL_3kHSDx5w7rM,291
@@ -241,6 +247,7 @@ uncountable/types/api/recipes/remove_recipe_from_project.py,sha256=3lqSU9UQIPMmO
241
247
  uncountable/types/api/recipes/set_recipe_inputs.py,sha256=yCGFQoguzsSK_weOK4kcvqnUSkRJV1rzKxWnanIZbko,1444
242
248
  uncountable/types/api/recipes/set_recipe_metadata.py,sha256=J2F1FDgFLKjlbGw29TW1Xefy38Zt-C7V1WDK70gRiuY,914
243
249
  uncountable/types/api/recipes/set_recipe_output_annotations.py,sha256=ayG9vnCroYGQ3mmNBALLlQhf9otrR-q0QiNLnWgmIsw,2930
250
+ uncountable/types/api/recipes/set_recipe_output_file.py,sha256=8s0oxgjhv_hIyV3EoAjIBb970TrJJbKTFaSdNvbgU78,1225
244
251
  uncountable/types/api/recipes/set_recipe_outputs.py,sha256=I7NUDO_QrKt1rZB7zHr6WWS2FdXCK8Bqc0BxFkDfjyQ,1729
245
252
  uncountable/types/api/recipes/set_recipe_tags.py,sha256=kYX13RvHyUOlzL6LbBKDQ8yNvpvNobbnF2WDtgZsKRc,2493
246
253
  uncountable/types/api/recipes/unarchive_recipes.py,sha256=KZKzw0fbQdOBUR3YBunFrHFcex4qPMiA8mDgsB6n24k,814
@@ -249,7 +256,7 @@ uncountable/types/api/triggers/__init__.py,sha256=gCgbynxG3jA8FQHzercKtrHKHkiIKr
249
256
  uncountable/types/api/triggers/run_trigger.py,sha256=_Rpha9nxXI3Xr17CrGDtofg4HZ81x2lt0rMZ6As0qfE,893
250
257
  uncountable/types/api/uploader/__init__.py,sha256=gCgbynxG3jA8FQHzercKtrHKHkiIKr8APdZYUniAor8,55
251
258
  uncountable/types/api/uploader/invoke_uploader.py,sha256=Rc77y5q-3R9-SNQgm8P35zKaW2D1Hbtm7PDixnOn1G0,1025
252
- UncountablePythonSDK-0.0.68.dist-info/METADATA,sha256=Z5ykvYEK4fZGam_k4Mzjy9ABSyoCpGLhSx5Q9mzTiyY,1993
253
- UncountablePythonSDK-0.0.68.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
254
- UncountablePythonSDK-0.0.68.dist-info/top_level.txt,sha256=1UVGjAU-6hJY9qw2iJ7nCBeEwZ793AEN5ZfKX9A1uj4,31
255
- UncountablePythonSDK-0.0.68.dist-info/RECORD,,
259
+ UncountablePythonSDK-0.0.69.dist-info/METADATA,sha256=8gI9naRGRIPuEbO1GWAD8E-WBs1Ya09vjlx4omQj5y8,1993
260
+ UncountablePythonSDK-0.0.69.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
261
+ UncountablePythonSDK-0.0.69.dist-info/top_level.txt,sha256=1UVGjAU-6hJY9qw2iJ7nCBeEwZ793AEN5ZfKX9A1uj4,31
262
+ UncountablePythonSDK-0.0.69.dist-info/RECORD,,
docs/requirements.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  furo==2024.8.6
2
2
  myst-parser==4.0.0
3
- sphinx-autoapi==3.2.0
3
+ sphinx-autoapi==3.3.0
4
4
  sphinx-copybutton==0.5.2
5
5
  Sphinx==8.0.0
6
6
  sphinx_design==0.6.1
@@ -0,0 +1,18 @@
1
+ from uncountable.integration.job import CronJob, CronJobArguments, register_job
2
+ from uncountable.types import entity_t
3
+ from uncountable.types.job_definition_t import JobResult
4
+
5
+
6
+ @register_job
7
+ class MyCronJob(CronJob):
8
+ def run(self, args: CronJobArguments) -> JobResult:
9
+ matfam = args.client.get_entities_data(
10
+ entity_ids=[1],
11
+ entity_type=entity_t.EntityType.MATERIAL_FAMILY,
12
+ ).entity_details[0]
13
+ name = None
14
+ for field_val in matfam.field_values:
15
+ if field_val.field_ref_name == "name":
16
+ name = field_val.value
17
+ args.logger.log_info(f"material family found with name: {name}")
18
+ return JobResult(success=True)
@@ -0,0 +1,19 @@
1
+ base_url: http://0.0.0.0:5000
2
+ auth_retrieval:
3
+ type: basic
4
+ api_id_secret:
5
+ type: env
6
+ env_key: API_ID
7
+ api_key_secret:
8
+ type: env
9
+ env_key: API_SECRET_KEY
10
+ jobs:
11
+ - id: example_cron
12
+ enabled: true
13
+ type: cron
14
+ name: MyCron - Example
15
+ cron_spec: "* * * * *"
16
+ executor:
17
+ type: script
18
+ import_path: example_cron
19
+
@@ -0,0 +1,224 @@
1
+ [project]
2
+ # begin_project_name
3
+ # DO NOT MODIFY
4
+ name = "integration-server-testing"
5
+ # end_project_name
6
+ dynamic = ["version"]
7
+ dependencies = [
8
+ "mypy == 1.*",
9
+ "ruff == 0.*",
10
+ "openpyxl == 3.*",
11
+ "more_itertools == 10.*",
12
+ "types-paramiko == 3.4.0.20240423",
13
+ "types-openpyxl == 3.*",
14
+ "types-pysftp == 0.*",
15
+ "types-pytz == 2024.*",
16
+ "types-requests == 2.*",
17
+ "types-simplejson == 3.*",
18
+ "pandas-stubs",
19
+ "xlrd == 2.*"
20
+ ]
21
+
22
+ [tool.mypy]
23
+ strict = true
24
+ show_error_codes = true
25
+ check_untyped_defs = true
26
+ disallow_any_generics = false
27
+ disallow_incomplete_defs = true
28
+ disallow_subclassing_any = false
29
+ disallow_untyped_calls = false
30
+ disallow_untyped_decorators = true
31
+ disallow_untyped_defs = true
32
+ implicit_reexport = true
33
+ no_implicit_optional = true
34
+ no_implicit_reexport = true
35
+ strict_equality = true
36
+ warn_redundant_casts = true
37
+ warn_unused_ignores = false
38
+ warn_no_return = true
39
+ warn_return_any = true
40
+ local_partial_types = true
41
+ warn_unreachable = false
42
+ warn_unused_configs = true
43
+ exclude = [
44
+ "env"
45
+ ]
46
+
47
+ [tool.ruff]
48
+ preview = true
49
+ lint.select = ['ALL']
50
+ lint.ignore = [
51
+ "A001", # Variable shadows python built-in. Nice to have
52
+ "A002", # Variable shadows python built-in. Nice to have
53
+ "A003", # Class attribute shadows python built-in. Nice to have
54
+ "ANN", # Missing type annotations. Skip in favor of mypy
55
+ "ARG", # Unused arguments. Skip
56
+ "B006", # Do not use mutable data structures for argument defaults. Priority.
57
+ "B023", # Function doesn't bind loop variable. Priority
58
+ "B904", # Exception handling raise from. Skip
59
+ "BLE", # Blind exception. Should Add
60
+ "C401", # Unecessary generator. Skip
61
+ "C403", # Unnecessary list comprehension. Skip
62
+ "C405", # Unnecessary list. rewrite as set. Skip
63
+ "C408", # Unnecessary dict call. Skip
64
+ "C416", # Unnecessary list comprehension. Skip
65
+ "C417", # Unnecessary use of map. Should Add
66
+ "COM812", # Trailing comma. Too opinionated. Skip
67
+ "CPY", # Copyright notices. Skip
68
+ "D", # Docstrings. Skip
69
+ "DOC", # Docstrings. Skip
70
+ "DTZ001", # Missing tzinfo. Should add
71
+ "DTZ002", # Use of today instead of now. Should add
72
+ "DTZ003", # Use of utcnow not allowed. Should add
73
+ "DTZ004", # Use of utcfrom timestamp not allowed. Should add
74
+ "DTZ005", # now without tz not allowed. Should add
75
+ "DTZ006", # use of from timestamp without tz not allowed. Should add
76
+ "DTZ007", # replace timezone after strptime. Should add
77
+ "DTZ011", # Use of today not allowed. Should add
78
+ "E501", # Line length. Skip
79
+ "EM101", # exception must not use a string literal. skip
80
+ "EM102", # exception must not use an f string. skip
81
+ "EM103", # exception must not use a format string. skip
82
+ "ERA", # Rules around commented code. Skip
83
+ "EXE002", # Executable files need shebang. Skip
84
+ "F841", # TEMPORARY DISABLE TO CLEAR UP BUILD. Unused variables. Prioritize.
85
+ "FBT001", # boolean positional args. Skip
86
+ "FBT002", # boolean default positional. Skip
87
+ "FBT003", # boolean positional. Skip
88
+ "FIX001", # Fixme comment. Skip
89
+ "FIX002", # todo comment. Skip
90
+ "FIX004", # hack comment. Skip
91
+ "FLY002", # Use F-String instead of join. Should Add
92
+ "FURB101", # replace read function. Skip
93
+ "FURB103", # opinionated file opening. Skip
94
+ "FURB113", # extend vs append. Skip
95
+ "FURB118", # opinionated rules about lambdas. skip
96
+ "FURB140", # starmap vs generator. Skip
97
+ "G004", # avoid f strings in log statements. Should add
98
+ "INP001", # implicit imports. use __init__. Skip
99
+ "ISC001", # rule conflicts with formatter. Skip
100
+ "ISC003", # Explicitly concatenated string should be implicitly concatenated. Skip
101
+ "N801", # class name case. Skip
102
+ "N802", # function name lower case. Skip
103
+ "N803", # argument name lower cas. Skip
104
+ "N804", # cls_ first variable. Should add
105
+ "N806", # lower case variable. Skip
106
+ "N812", # case consistency on import. Skip
107
+ "N815", # mix casing, skip
108
+ "N817", # don't use acronym. Should add
109
+ "N818", # exception override should be named with error. should add
110
+ "N999", # module naming. Should add
111
+ "PD002", # avoid inplace. Skip
112
+ "PD004", # .notna. Should add
113
+ "PD010", # .pivottable. Should add
114
+ "PD011", # use .to_numpy. Skip
115
+ "PD015", # use .merge. Should add
116
+ "PD901", # avoid generic df name. Skip
117
+ "PERF203", # avoid try except in loop. Skip
118
+ "PERF401", # use list comprehension. Skip
119
+ "PERF402", # use list.copy. Skip
120
+ "PERF403", # use dictionary comprehension. Skip
121
+ "S307", # avoid eval. Should add
122
+ "PGH003", # ignore specific rules. Skip
123
+ "PGH004", # ignore specific rules. Skip
124
+ "PLC0414", # import alias doesn't rename. Skip
125
+ "PLC0415", # import at top level. Skip
126
+ "PLC1901", # falsy empty string. Skip
127
+ "PLR0124", # self comparison. Skip
128
+ "PLR0402", # alias import. Skip
129
+ "PLR0911", # too many return statements. Skip
130
+ "PLR0912", # too many branches. Skip
131
+ "PLR0913", # too many arguments. Skip
132
+ "PLR0915", # too many statements. Skip
133
+ "PLR0916", # too many expressions. Skip
134
+ "PLR0917", # too many positional arguments. Skip
135
+ "PLR1714", # multiple comparisons. Skip
136
+ "PLR2004", # magic values. skip
137
+ "PLR5501", # use elif instead of else if. skip
138
+ "PLR6104", # use augmented assignment. confuses strings, wait for fix. skip
139
+ "PLR6201", # use a set literal for membership test. skip
140
+ "PLR6301", # method inference. skip
141
+ "PLW0108", # inline lambda. skip
142
+ "PLW0120", # else without break. skip
143
+ "PLW0602", # global withotu assignment. consider
144
+ "PLW0603", # discourage global. skip
145
+ "PLW1510", # subprocess run without check arg. skip
146
+ "PLW1514", # open without encoding. skip
147
+ "PLW2901", # for loop variable overwritten. skip
148
+ "PT001", # change ficture decorator. should add
149
+ "PT011", # use more specific raises decorator. should add
150
+ "PT018", # break down complex assertsions. skip
151
+ "PTH", # enforces new python path library usage. skip
152
+ "PYI030", # turn union of literals to just literal with multiple. should add
153
+ "PYI041", # use float instead of int | float. should remove floats
154
+ "RET", # enforces return semantics. break up and re-evaluate later
155
+ "RSE102", # unnecessary parens on exception. skip.
156
+ "RUF001", # ambiguous characters. skip
157
+ "RUF005", # prefer star to concatenation. skip
158
+ "RUF010", # use explicit conversion flag. skip
159
+ "RUF012", # type with class var. should add
160
+ "RUF015", # prefer next for single element. skip
161
+ "RUF100", # unused noqa. should add
162
+ "S", # should split up
163
+ "S101", # allow asserts. skip
164
+ "SIM102", # use single if instead of nested. skip
165
+ "SIM105", # use exception supress. skip
166
+ "SIM108", # use ternary. skip
167
+ "SIM110", # use any/all. should add
168
+ "SIM112", # case of env variable. skip
169
+ "SIM114", # combine if branches. skip
170
+ "SIM115", # use context handler for files. should add
171
+ "SIM117", # use single with. should add
172
+ "SLF001", # private member access. should add
173
+ "SLOT000", # subclass of string should define slot. should add
174
+ "T201", # print. skip
175
+ "T203", # pprint. skip
176
+ "TCH001", # move application import into type checking. skip
177
+ "TCH002", # move third party import into type checking. consider
178
+ "TCH003", # move library into type checking lbock. consider
179
+ "TD", # todo comments. skip
180
+ "TID252", # eliminate relative imports from parents. skip
181
+ "TRY002", # create your own exception. skip
182
+ "TRY003", # avoid long messages. skip
183
+ "TRY004", # prefer type error. should add
184
+ "TRY201", # raise without exception name. consider
185
+ "TRY300", # move statement to else block. consider
186
+ "TRY301", # move raise to inner function. skip
187
+ "UP007", # use union for type annotations. should add
188
+ "UP013", # eliminate typeddict. should add
189
+ "UP031", # use format specifiers. should add
190
+ "B905", # zip strict. we have a deprecated pattern here, consider
191
+ "UP036", # outdated version block, consider
192
+ "RUF007", # prefer itertools.pairwise over zip, consider
193
+ "RUF022", # __all__ is not sorted. skip due to isort complication
194
+ "UP017", # use datetime.UTC, TODO add back in
195
+ "UP035", # replacing List with list, TODO add back in
196
+ "UP038", # isinstance X | Y instead of (X, Y), TODO add back in
197
+ # ## FROM RUFF UPGRADE
198
+ "PLC2701", # private name imports. should add
199
+ "PLR1702", # too many nested blocks -- add with config. skip
200
+ "RUF025", # unnecessary dict comprehension. skip
201
+ "SIM113", # index variable should use enumerate. should add.
202
+ "PLR0914" # too many local variables. configure below. should add with config
203
+ ]
204
+ line-length = 90
205
+ target-version = "py311"
206
+
207
+ exclude = [
208
+ 'env'
209
+ ]
210
+ [tool.ruff.lint.per-file-ignores]
211
+ "__init__.py" = ["F401"]
212
+
213
+ [tool.ruff.lint.isort]
214
+ split-on-trailing-comma = true
215
+
216
+ [tool.ruff.lint.mccabe]
217
+ max-complexity = 130 # goal would be to bring this down to ~50 or so
218
+
219
+ [tool.ruff.lint.pylint]
220
+ max-locals=50
221
+
222
+ [tool.setuptools]
223
+ py-modules = []
224
+
@@ -0,0 +1,40 @@
1
+ import os
2
+
3
+ from uncountable.core import (
4
+ AsyncBatchProcessor,
5
+ AuthDetailsApiKey,
6
+ Client,
7
+ MediaFileUpload,
8
+ )
9
+ from uncountable.types import recipe_metadata_t
10
+ from uncountable.types.identifier_t import IdentifierKeyBatchReference
11
+
12
+ client = Client(
13
+ base_url="http://localhost:5000",
14
+ auth_details=AuthDetailsApiKey(
15
+ api_id=os.environ["UNC_API_ID"],
16
+ api_secret_key=os.environ["UNC_API_SECRET_KEY"],
17
+ ),
18
+ )
19
+ uploaded_file = client.upload_files(
20
+ file_uploads=[
21
+ MediaFileUpload(path="/home/logan/Downloads/my_file_to_upload.csv"),
22
+ ]
23
+ )[0]
24
+
25
+ batch_processor = AsyncBatchProcessor(client=client)
26
+
27
+ recipe_batch_identifier = batch_processor.create_recipe(
28
+ material_family_id=1, workflow_id=1
29
+ ).batch_reference
30
+
31
+ batch_processor.set_recipe_metadata(
32
+ recipe_key=IdentifierKeyBatchReference(reference=recipe_batch_identifier),
33
+ recipe_metadata=[
34
+ recipe_metadata_t.MetadataValue(
35
+ metadata_id=102, value_file_ids=[uploaded_file.file_id]
36
+ )
37
+ ],
38
+ )
39
+
40
+ batch_processor.send()
@@ -0,0 +1,26 @@
1
+ import os
2
+ from pathlib import Path
3
+
4
+ import uncountable.types.api.recipes.set_recipe_output_file as set_recipe_output_file_t
5
+ from uncountable.core import AuthDetailsApiKey, Client, MediaFileUpload
6
+
7
+ client = Client(
8
+ base_url="http://localhost:5000",
9
+ auth_details=AuthDetailsApiKey(
10
+ api_id=os.environ["UNC_API_ID"],
11
+ api_secret_key=os.environ["UNC_API_SECRET_KEY"],
12
+ ),
13
+ )
14
+ uploaded_file = client.upload_files(
15
+ file_uploads=[
16
+ MediaFileUpload(
17
+ path=str((Path.home() / "Downloads" / "my_file_to_upload.csv").absolute())
18
+ ),
19
+ ]
20
+ )[0]
21
+
22
+ client.set_recipe_output_file(
23
+ output_file_data=set_recipe_output_file_t.RecipeOutputFileValue(
24
+ recipe_id=58070, output_id=148, file_id=uploaded_file.file_id, experiment_num=1
25
+ )
26
+ )
@@ -0,0 +1,107 @@
1
+ import multiprocessing
2
+ import subprocess
3
+ import sys
4
+ import time
5
+ from dataclasses import dataclass
6
+
7
+ from opentelemetry.trace import get_current_span
8
+
9
+ from uncountable.integration.entrypoint import main as cron_target
10
+ from uncountable.integration.telemetry import Logger
11
+
12
+ SHUTDOWN_TIMEOUT_SECS = 30
13
+
14
+
15
+ @dataclass(kw_only=True)
16
+ class ProcessInfo:
17
+ name: str
18
+ process: multiprocessing.Process | subprocess.Popen[bytes]
19
+
20
+ @property
21
+ def is_alive(self) -> bool:
22
+ match self.process:
23
+ case multiprocessing.Process():
24
+ return self.process.is_alive()
25
+ case subprocess.Popen():
26
+ return self.process.poll() is None
27
+
28
+ @property
29
+ def pid(self) -> int | None:
30
+ return self.process.pid
31
+
32
+
33
+ def handle_shutdown(logger: Logger, processes: list[ProcessInfo]) -> None:
34
+ logger.log_info("received shutdown command, shutting down sub-processes")
35
+ for proc_info in processes:
36
+ if proc_info.is_alive:
37
+ proc_info.process.terminate()
38
+
39
+ shutdown_start = time.time()
40
+ still_living_processes = processes
41
+ while (
42
+ time.time() - shutdown_start < SHUTDOWN_TIMEOUT_SECS
43
+ and len(still_living_processes) > 0
44
+ ):
45
+ current_loop_processes = [*still_living_processes]
46
+ logger.log_info(
47
+ "waiting for sub-processes to shut down",
48
+ attributes={
49
+ "still_living_processes": [
50
+ proc_info.name for proc_info in still_living_processes
51
+ ]
52
+ },
53
+ )
54
+ still_living_processes = []
55
+ for proc_info in current_loop_processes:
56
+ if not proc_info.is_alive:
57
+ logger.log_info(f"{proc_info.name} shut down successfully")
58
+ else:
59
+ still_living_processes.append(proc_info)
60
+ time.sleep(1)
61
+
62
+ for proc_info in still_living_processes:
63
+ logger.log_warning(
64
+ f"{proc_info.name} failed to shut down after {SHUTDOWN_TIMEOUT_SECS} seconds, forcefully terminating"
65
+ )
66
+ proc_info.process.kill()
67
+
68
+
69
+ def check_process_health(logger: Logger, processes: list[ProcessInfo]) -> None:
70
+ for proc_info in processes:
71
+ if not proc_info.is_alive:
72
+ logger.log_error(
73
+ f"process {proc_info.name} shut down unexpectedly! shutting down scheduler"
74
+ )
75
+ handle_shutdown(logger, processes)
76
+ sys.exit(1)
77
+
78
+
79
+ def main() -> None:
80
+ logger = Logger(get_current_span())
81
+ processes: list[ProcessInfo] = []
82
+
83
+ def add_process(process: ProcessInfo) -> None:
84
+ processes.append(process)
85
+ logger.log_info(f"started process {process.name}")
86
+
87
+ cron_process = multiprocessing.Process(target=cron_target, args={"blocking": True})
88
+ cron_process.start()
89
+ add_process(ProcessInfo(name="cron server", process=cron_process))
90
+
91
+ uwsgi_process = subprocess.Popen([
92
+ "/app/env/bin/uwsgi",
93
+ "-H",
94
+ "/app/env",
95
+ "--die-on-term",
96
+ ])
97
+ add_process(ProcessInfo(name="uwsgi", process=uwsgi_process))
98
+
99
+ try:
100
+ while True:
101
+ check_process_health(logger, processes=processes)
102
+ time.sleep(1)
103
+ except KeyboardInterrupt:
104
+ handle_shutdown(logger, processes=processes)
105
+
106
+
107
+ main()
@@ -114,7 +114,7 @@ def register_route(
114
114
  "webhook_executor"
115
115
  ) as span:
116
116
  job_logger = JobLogger(
117
- profile_metadata=profile_metadata,
117
+ profile_metadata=profile_meta,
118
118
  job_definition=job,
119
119
  base_span=span,
120
120
  )
@@ -126,7 +126,7 @@ def register_route(
126
126
  profile_metadata=profile_meta,
127
127
  args=WebhookJobArguments(
128
128
  job_definition=job,
129
- profile_metadata=profile_metadata,
129
+ profile_metadata=profile_meta,
130
130
  client=client,
131
131
  batch_processor=AsyncBatchProcessor(client=client),
132
132
  logger=job_logger,
@@ -145,20 +145,24 @@ def register_route(
145
145
  server_logger.log_info(f"job {job.id} webhook registered at: {route}")
146
146
 
147
147
 
148
- profiles = load_profiles()
149
- for profile in profiles:
150
- server_logger = Logger(get_current_span())
151
- profile_metadata = job_definition_t.ProfileMetadata(
152
- name=profile.name,
153
- auth_retrieval=profile.definition.auth_retrieval,
154
- base_url=profile.definition.base_url,
155
- client_options=profile.definition.client_options,
156
- )
157
- for job in profile.definition.jobs:
158
- if isinstance(job, job_definition_t.WebhookJobDefinition):
159
- register_route(
160
- server_logger=server_logger, profile_meta=profile_metadata, job=job
161
- )
148
+ def main() -> None:
149
+ profiles = load_profiles()
150
+ for profile in profiles:
151
+ server_logger = Logger(get_current_span())
152
+ profile_metadata = job_definition_t.ProfileMetadata(
153
+ name=profile.name,
154
+ auth_retrieval=profile.definition.auth_retrieval,
155
+ base_url=profile.definition.base_url,
156
+ client_options=profile.definition.client_options,
157
+ )
158
+ for job in profile.definition.jobs:
159
+ if isinstance(job, job_definition_t.WebhookJobDefinition):
160
+ register_route(
161
+ server_logger=server_logger, profile_meta=profile_metadata, job=job
162
+ )
163
+
164
+
165
+ main()
162
166
 
163
167
 
164
168
  if __name__ == "__main__":
@@ -86,6 +86,7 @@ from .api.inputs import set_intermediate_type as set_intermediate_type_t
86
86
  from .api.recipes import set_recipe_inputs as set_recipe_inputs_t
87
87
  from .api.recipes import set_recipe_metadata as set_recipe_metadata_t
88
88
  from .api.recipes import set_recipe_output_annotations as set_recipe_output_annotations_t
89
+ from .api.recipes import set_recipe_output_file as set_recipe_output_file_t
89
90
  from .api.recipes import set_recipe_outputs as set_recipe_outputs_t
90
91
  from .api.recipes import set_recipe_tags as set_recipe_tags_t
91
92
  from .api.entity import set_values as set_values_t
@@ -185,6 +186,7 @@ __all__: list[str] = [
185
186
  "set_recipe_inputs_t",
186
187
  "set_recipe_metadata_t",
187
188
  "set_recipe_output_annotations_t",
189
+ "set_recipe_output_file_t",
188
190
  "set_recipe_outputs_t",
189
191
  "set_recipe_tags_t",
190
192
  "set_values_t",
@@ -0,0 +1,46 @@
1
+ # DO NOT MODIFY -- This file is generated by type_spec
2
+ # flake8: noqa: F821
3
+ # ruff: noqa: E402 Q003
4
+ # fmt: off
5
+ # isort: skip_file
6
+ from __future__ import annotations
7
+ import typing # noqa: F401
8
+ import datetime # noqa: F401
9
+ from decimal import Decimal # noqa: F401
10
+ import dataclasses
11
+ from ... import base_t
12
+ from ... import response_t
13
+
14
+ __all__: list[str] = [
15
+ "Arguments",
16
+ "Data",
17
+ "ENDPOINT_METHOD",
18
+ "ENDPOINT_PATH",
19
+ "RecipeOutputFileValue",
20
+ ]
21
+
22
+ ENDPOINT_METHOD = "POST"
23
+ ENDPOINT_PATH = "api/external/recipes/external_set_recipe_output_file"
24
+
25
+
26
+ # DO NOT MODIFY -- This file is generated by type_spec
27
+ @dataclasses.dataclass(kw_only=True)
28
+ class RecipeOutputFileValue:
29
+ recipe_id: base_t.ObjectId
30
+ output_id: base_t.ObjectId
31
+ experiment_num: int
32
+ condition_id: typing.Optional[base_t.ObjectId] = None
33
+ file_id: typing.Optional[base_t.ObjectId] = None
34
+
35
+
36
+ # DO NOT MODIFY -- This file is generated by type_spec
37
+ @dataclasses.dataclass(kw_only=True)
38
+ class Arguments:
39
+ output_file_data: RecipeOutputFileValue
40
+
41
+
42
+ # DO NOT MODIFY -- This file is generated by type_spec
43
+ @dataclasses.dataclass(kw_only=True)
44
+ class Data(response_t.Response):
45
+ pass
46
+ # DO NOT MODIFY -- This file is generated by type_spec
@@ -74,6 +74,7 @@ import uncountable.types.api.inputs.set_intermediate_type as set_intermediate_ty
74
74
  import uncountable.types.api.recipes.set_recipe_inputs as set_recipe_inputs_t
75
75
  import uncountable.types.api.recipes.set_recipe_metadata as set_recipe_metadata_t
76
76
  import uncountable.types.api.recipes.set_recipe_output_annotations as set_recipe_output_annotations_t
77
+ import uncountable.types.api.recipes.set_recipe_output_file as set_recipe_output_file_t
77
78
  import uncountable.types.api.recipes.set_recipe_outputs as set_recipe_outputs_t
78
79
  import uncountable.types.api.recipes.set_recipe_tags as set_recipe_tags_t
79
80
  import uncountable.types.api.entity.set_values as set_values_t
@@ -1321,6 +1322,25 @@ class ClientMethods(ABC):
1321
1322
  )
1322
1323
  return self.do_request(api_request=api_request, return_type=set_recipe_output_annotations_t.Data)
1323
1324
 
1325
+ def set_recipe_output_file(
1326
+ self,
1327
+ *,
1328
+ output_file_data: set_recipe_output_file_t.RecipeOutputFileValue,
1329
+ ) -> set_recipe_output_file_t.Data:
1330
+ """Sets output file value for an experiment. Include a single file as part of the FormData of the request with the filename as the key
1331
+
1332
+ :param output_file_data: The output file to set
1333
+ """
1334
+ args = set_recipe_output_file_t.Arguments(
1335
+ output_file_data=output_file_data,
1336
+ )
1337
+ api_request = APIRequest(
1338
+ method=set_recipe_output_file_t.ENDPOINT_METHOD,
1339
+ endpoint=set_recipe_output_file_t.ENDPOINT_PATH,
1340
+ args=args,
1341
+ )
1342
+ return self.do_request(api_request=api_request, return_type=set_recipe_output_file_t.Data)
1343
+
1324
1344
  def set_recipe_outputs(
1325
1345
  self,
1326
1346
  *,
@@ -119,6 +119,7 @@ __all__: list[str] = [
119
119
  "recipe_permission_view": "Recipe Permission View",
120
120
  "recipe_project": "Recipe Project",
121
121
  "recipe_step": "Recipe Step",
122
+ "recipe_workflow_step": "Recipe Workflow Step",
122
123
  "recipe_tag": "Recipe Tag",
123
124
  "recipe_metadata": "Experiment Metadata",
124
125
  "metadata_value": "Metadata Value",
@@ -271,6 +272,7 @@ class EntityType(StrEnum):
271
272
  RECIPE_PERMISSION_VIEW = "recipe_permission_view"
272
273
  RECIPE_PROJECT = "recipe_project"
273
274
  RECIPE_STEP = "recipe_step"
275
+ RECIPE_WORKFLOW_STEP = "recipe_workflow_step"
274
276
  RECIPE_TAG = "recipe_tag"
275
277
  RECIPE_METADATA = "recipe_metadata"
276
278
  METADATA_VALUE = "metadata_value"
@@ -29,6 +29,7 @@ class MetadataValue:
29
29
  value_numeric: typing.Optional[Decimal] = None
30
30
  value_str: typing.Optional[str] = None
31
31
  value_json: typing.Optional[base_t.JsonValue] = None
32
+ value_file_ids: typing.Optional[list[base_t.ObjectId]] = None
32
33
 
33
34
 
34
35
  # DO NOT MODIFY -- This file is generated by type_spec