orchestrator-core 3.2.0rc1__py3-none-any.whl → 3.2.1__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.
orchestrator/__init__.py CHANGED
@@ -13,7 +13,7 @@
13
13
 
14
14
  """This is the orchestrator workflow engine."""
15
15
 
16
- __version__ = "3.2.0rc1"
16
+ __version__ = "3.2.1"
17
17
 
18
18
  from orchestrator.app import OrchestratorCore
19
19
  from orchestrator.settings import app_settings
@@ -128,7 +128,7 @@ def delete(process_id: UUID) -> None:
128
128
  status_code=HTTPStatus.CREATED,
129
129
  dependencies=[Depends(check_global_lock, use_cache=False)],
130
130
  )
131
- async def new_process(
131
+ def new_process(
132
132
  workflow_key: str,
133
133
  request: Request,
134
134
  json_data: list[dict[str, Any]] | None = Body(...),
@@ -10,12 +10,13 @@
10
10
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  # See the License for the specific language governing permissions and
12
12
  # limitations under the License.
13
-
14
13
  from collections.abc import Callable
15
14
  from functools import partial, wraps
15
+ from importlib import metadata
16
16
  from pathlib import Path
17
17
  from typing import Any
18
18
 
19
+ import semver
19
20
  import structlog
20
21
  from jinja2 import Environment
21
22
 
@@ -123,7 +124,17 @@ def get_product_workflow_path(config: dict, workflow_type: str) -> Path:
123
124
  return product_workflow_folder(config) / Path(f"{workflow_type}_{file_name}").with_suffix(".py")
124
125
 
125
126
 
127
+ def eval_pydantic_forms_version() -> bool:
128
+ updated_version = semver.Version.parse("2.0.0")
129
+
130
+ installed_version = metadata.version("pydantic-forms")
131
+ installed_semver = semver.Version.parse(installed_version)
132
+
133
+ return installed_semver >= updated_version
134
+
135
+
126
136
  def render_template(environment: Environment, config: dict, template: str, workflow: str = "") -> str:
137
+ use_updated_readonly_field = eval_pydantic_forms_version()
127
138
  product_block = root_product_block(config)
128
139
  types_to_import = get_name_spaced_types_to_import(product_block["fields"])
129
140
  fields = get_input_fields(product_block)
@@ -152,6 +163,7 @@ def render_template(environment: Environment, config: dict, template: str, workf
152
163
  product_types_module=get_product_types_module(),
153
164
  workflows_module=get_workflows_module(),
154
165
  workflow_validations=workflow_validations if workflow else [],
166
+ use_updated_readonly_field=use_updated_readonly_field,
155
167
  )
156
168
 
157
169
 
@@ -7,7 +7,12 @@ from typing import Annotated
7
7
  import structlog
8
8
  from pydantic import AfterValidator, ConfigDict, model_validator
9
9
  from pydantic_forms.types import FormGenerator, State, UUIDstr
10
+
11
+ {%- if use_updated_readonly_field is true %}
12
+ from pydantic_forms.validators import read_only_field
13
+ {%- else %}
10
14
  from pydantic_forms.validators import ReadOnlyField
15
+ {%- endif %}
11
16
 
12
17
  from orchestrator.forms import FormPage
13
18
  from orchestrator.forms.validators import CustomerId, Divider
@@ -52,7 +57,11 @@ def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator:
52
57
  divider_1: Divider
53
58
 
54
59
  {% for field in fields if not field.modifiable is defined -%}
60
+ {% if use_updated_readonly_field is true -%}
61
+ {{ field.name }}: read_only_field({{ product_block.name }}.{{ field.name }})
62
+ {% else -%}
55
63
  {{ field.name }}: ReadOnlyField({{ product_block.name }}.{{ field.name }})
64
+ {% endif -%}
56
65
  {% endfor -%}
57
66
 
58
67
  {% for field in fields if field.modifiable is defined -%}
@@ -0,0 +1,44 @@
1
+ """add cascade constraint on processes input state.
2
+
3
+ Revision ID: fc5c993a4b4a
4
+ Revises: 42b3d076a85b
5
+ Create Date: 2025-04-09 18:27:31.922214
6
+
7
+ """
8
+
9
+ from alembic import op
10
+
11
+ # revision identifiers, used by Alembic.
12
+ revision = "fc5c993a4b4a"
13
+ down_revision = "42b3d076a85b"
14
+ branch_labels = None
15
+ depends_on = None
16
+
17
+
18
+ def upgrade() -> None:
19
+ # Drop the existing foreign key constraint
20
+ op.drop_constraint("input_states_pid_fkey", "input_states", type_="foreignkey")
21
+
22
+ # Add a new foreign key constraint with cascade delete
23
+ op.create_foreign_key(
24
+ "input_states_pid_fkey",
25
+ "input_states",
26
+ "processes",
27
+ ["pid"],
28
+ ["pid"],
29
+ ondelete="CASCADE",
30
+ )
31
+
32
+
33
+ def downgrade() -> None:
34
+ # Drop the cascade foreign key constraint
35
+ op.drop_constraint("input_states_pid_fkey", "input_states", type_="foreignkey")
36
+
37
+ # Recreate the original foreign key constraint without cascade
38
+ op.create_foreign_key(
39
+ "input_states_pid_fkey",
40
+ "input_states",
41
+ "processes",
42
+ ["pid"],
43
+ ["pid"],
44
+ )
orchestrator/workflow.py CHANGED
@@ -223,7 +223,11 @@ def step(name: str) -> Callable[[StepFunc], Step]:
223
223
  def decorator(func: StepFunc) -> Step:
224
224
  @functools.wraps(func)
225
225
  def wrapper(state: State) -> Process:
226
- with bound_contextvars(func=func.__qualname__):
226
+ with bound_contextvars(
227
+ func=func.__qualname__,
228
+ workflow_name=state.get("workflow_name"),
229
+ process_id=state.get("process_id"),
230
+ ):
227
231
  step_in_inject_args = inject_args(func)
228
232
  try:
229
233
  with transactional(db, logger):
@@ -248,7 +252,11 @@ def retrystep(name: str) -> Callable[[StepFunc], Step]:
248
252
  def decorator(func: StepFunc) -> Step:
249
253
  @functools.wraps(func)
250
254
  def wrapper(state: State) -> Process:
251
- with bound_contextvars(func=func.__qualname__):
255
+ with bound_contextvars(
256
+ func=func.__qualname__,
257
+ workflow_name=state.get("workflow_name"),
258
+ process_id=state.get("process_id"),
259
+ ):
252
260
  step_in_inject_args = inject_args(func)
253
261
  try:
254
262
  with transactional(db, logger):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: orchestrator-core
3
- Version: 3.2.0rc1
3
+ Version: 3.2.1
4
4
  Summary: This is the orchestrator workflow engine.
5
5
  Requires-Python: >=3.11,<3.14
6
6
  Classifier: Intended Audience :: Information Technology
@@ -47,6 +47,7 @@ Requires-Dist: python-rapidjson>=1.18,<1.21
47
47
  Requires-Dist: pytz==2025.2
48
48
  Requires-Dist: redis==5.1.1
49
49
  Requires-Dist: schedule==1.1.0
50
+ Requires-Dist: semver==3.0.4
50
51
  Requires-Dist: sentry-sdk[fastapi]~=2.25.1
51
52
  Requires-Dist: SQLAlchemy==2.0.40
52
53
  Requires-Dist: SQLAlchemy-Utils==0.41.2
@@ -57,8 +58,8 @@ Requires-Dist: nwa-stdlib~=1.9.0
57
58
  Requires-Dist: oauth2-lib~=2.4.0
58
59
  Requires-Dist: tabulate==0.9.0
59
60
  Requires-Dist: strawberry-graphql>=0.246.2
60
- Requires-Dist: pydantic-forms~=1.4.0
61
- Requires-Dist: celery~=5.4.0 ; extra == "celery"
61
+ Requires-Dist: pydantic-forms>=1.4.0, <=2.0.0
62
+ Requires-Dist: celery~=5.5.1 ; extra == "celery"
62
63
  Requires-Dist: toml ; extra == "dev"
63
64
  Requires-Dist: bumpversion ; extra == "dev"
64
65
  Requires-Dist: mypy_extensions ; extra == "dev"
@@ -1,4 +1,4 @@
1
- orchestrator/__init__.py,sha256=DaljR2yKiWNT76zKyWAG4RD4RQ8cmT64er6J5BXvgOE,1066
1
+ orchestrator/__init__.py,sha256=6M2nhPcbqy6evQZotd6vfnqqrc1M9YfUxkRSSjW12kw,1063
2
2
  orchestrator/app.py,sha256=VN54_Zsx5x_3ym8aFadATg67a4J5lv8H-pxnPlR3RkM,11668
3
3
  orchestrator/exception_handlers.py,sha256=UsW3dw8q0QQlNLcV359bIotah8DYjMsj2Ts1LfX4ClY,1268
4
4
  orchestrator/log_config.py,sha256=1tPRX5q65e57a6a_zEii_PFK8SzWT0mnA5w2sKg4hh8,1853
@@ -8,7 +8,7 @@ orchestrator/settings.py,sha256=MTG7gnmbQYwUjAnhvX4Y3MEqmX8vIpAEC0lhDafa1zw,4039
8
8
  orchestrator/targets.py,sha256=ykjTGK7CozFaltNaxQcK90P4Cc1Qvf-W8dFztxtZhRQ,776
9
9
  orchestrator/types.py,sha256=qzs7xx5AYRmKbpYRyJJP3wuDb0W0bcAzefCN0RWLAco,15459
10
10
  orchestrator/version.py,sha256=b58e08lxs47wUNXv0jXFO_ykpksmytuzEXD4La4W-NQ,1366
11
- orchestrator/workflow.py,sha256=BITGaV8Pw4d9F-XCkaNGt7qoKO1fhklCq-SPmhgWdKI,43781
11
+ orchestrator/workflow.py,sha256=T_3Z1PrlF70C16ehAthKRF1hd3jpwV-MREDVxSLfxOw,44063
12
12
  orchestrator/api/__init__.py,sha256=GyHNfEFCGKQwRiN6rQmvSRH2iYX7npjMZn97n8XzmLU,571
13
13
  orchestrator/api/error_handling.py,sha256=YrPCxSa-DSa9KwqIMlXI-KGBGnbGIW5ukOPiikUH9E4,1502
14
14
  orchestrator/api/helpers.py,sha256=s0QRHYw8AvEmlkmRhuEzz9xixaZKUF3YuPzUVHkcoXk,6933
@@ -17,7 +17,7 @@ orchestrator/api/api_v1/__init__.py,sha256=GyHNfEFCGKQwRiN6rQmvSRH2iYX7npjMZn97n
17
17
  orchestrator/api/api_v1/api.py,sha256=m4iDktsSpzxUDaudkdgXeZ83a6B4wfc3pczQsa-Pb-8,2866
18
18
  orchestrator/api/api_v1/endpoints/__init__.py,sha256=GyHNfEFCGKQwRiN6rQmvSRH2iYX7npjMZn97n8XzmLU,571
19
19
  orchestrator/api/api_v1/endpoints/health.py,sha256=iaxs1XX1_250_gKNsspuULCV2GEMBjbtjsmfQTOvMAI,1284
20
- orchestrator/api/api_v1/endpoints/processes.py,sha256=UDYr7c9ypY_GS3jL_6vL1sRpTDCCSRyBa0XkgRVGZJs,13570
20
+ orchestrator/api/api_v1/endpoints/processes.py,sha256=i5GRoszvdmpZqOxSqON83DNuc0UIV-ohOqbAa0OhESE,13564
21
21
  orchestrator/api/api_v1/endpoints/product_blocks.py,sha256=kZ6ywIOsS_S2qGq7RvZ4KzjvaS1LmwbGWR37AKRvWOw,2146
22
22
  orchestrator/api/api_v1/endpoints/products.py,sha256=BfFtwu9dZXEQbtKxYj9icc73GKGvAGMR5ytyf41nQlQ,3081
23
23
  orchestrator/api/api_v1/endpoints/resource_types.py,sha256=gGyuaDyOD0TAVoeFGaGmjDGnQ8eQQArOxKrrk4MaDzA,2145
@@ -65,7 +65,7 @@ orchestrator/cli/generator/generator/settings.py,sha256=_IhRnQ7bpGjqYtFo-OiLky25
65
65
  orchestrator/cli/generator/generator/translations.py,sha256=ip0RghW2bY7CoemEab9SxSgjizI44G35AoNHuBsgvrU,1878
66
66
  orchestrator/cli/generator/generator/unittest.py,sha256=cLbPRjBQyKFLDNABoTR3WQ21EisAodHs5Q3EGx4VQ6c,4541
67
67
  orchestrator/cli/generator/generator/validations.py,sha256=yLv_S_ZBOc_z5DNjz4JY50A4ErWeOk8rk5orty9hwbM,1815
68
- orchestrator/cli/generator/generator/workflow.py,sha256=IHjF4XSlfveQlwWZqoQne6Y7tua4-QdqaR_UV4HhLDc,7968
68
+ orchestrator/cli/generator/generator/workflow.py,sha256=8mkb0a2zisb6iUFq8ICrOm2D3I_6fxxrit_LPxViSzk,8406
69
69
  orchestrator/cli/generator/products/workshop/circuit.yaml,sha256=AyRUWj61GUBoW9k9z1yfn9vZYXy52PiDMOayAr_FUdE,759
70
70
  orchestrator/cli/generator/products/workshop/node.yaml,sha256=4498iAjH6wHQAiRqsvczpgjJnyO8iCLokT6MgKwlxXQ,538
71
71
  orchestrator/cli/generator/products/workshop/user.yaml,sha256=92VrWlU1-C6KI8iONO-LGWt-U45rbZpCxhzF2Ags3iw,532
@@ -82,7 +82,7 @@ orchestrator/cli/generator/templates/enums.j2,sha256=pmx7_DeoE4X9u83_In18C97XqZP
82
82
  orchestrator/cli/generator/templates/lazy_workflow_instance.j2,sha256=BYB6LwE19OarY7_7Ovej5rqppZWtjiDkG7TDK5dYU7Y,523
83
83
  orchestrator/cli/generator/templates/list_definitions.j2,sha256=XS-F5XXy4HOdsZ-xahprwxfhU0UaiF4VeopkIxfoado,277
84
84
  orchestrator/cli/generator/templates/macros.j2,sha256=fEODRym4gLfL40w9OelXFMDtAjtzmN5nccWDk86oTNI,904
85
- orchestrator/cli/generator/templates/modify_product.j2,sha256=we2TqyHD5L8dprnOitmwBT8MU7PzVG8iMrzdxXquDfM,4751
85
+ orchestrator/cli/generator/templates/modify_product.j2,sha256=M1WDMmPwfXpUcuZUa-H5GnlKAr1t_xCQliLa66FI-YU,5057
86
86
  orchestrator/cli/generator/templates/new_product_migration.j2,sha256=d67I9haNkKdzWzNT0f1S6-UhG86fOWEohF0Al7NmXmA,3023
87
87
  orchestrator/cli/generator/templates/product.j2,sha256=gcN1poWRuGWbsLrQv0Z8SXO6MGuXBHBr33UvQtqsF8E,1241
88
88
  orchestrator/cli/generator/templates/product_block.j2,sha256=X5ynyBG39UiYekPHms7IkSHmxq2j-2OrhAYsFaRqktU,2454
@@ -232,6 +232,7 @@ orchestrator/migrations/versions/schema/2025-01-19_4fjdn13f83ga_add_validate_pro
232
232
  orchestrator/migrations/versions/schema/2025-02-12_bac6be6f2b4f_added_input_state_table.py,sha256=0vBDGltmOs_gcTTYlWBNOgItzqCXm8qqT02jZfTpL5c,1753
233
233
  orchestrator/migrations/versions/schema/2025-03-06_42b3d076a85b_subscription_instance_as_json_function.py,sha256=jtwDFOh-NlE31aH5dFmbynb23TZN6Mkzevxx-KLP7KE,776
234
234
  orchestrator/migrations/versions/schema/2025-03-06_42b3d076a85b_subscription_instance_as_json_function.sql,sha256=hPldk0DAesUbHv3Qd_N7U-cAk-t1wIgxt4FOA120gQ8,1776
235
+ orchestrator/migrations/versions/schema/2025-04-09_fc5c993a4b4a_add_cascade_constraint_on_processes_.py,sha256=6kHRNSZxUze2jy7b8uRvkt5mzsax10Z-Z3lsACtPLRM,1067
235
236
  orchestrator/schedules/__init__.py,sha256=JnnaglfK1qYUBKI6Dd9taV-tCZIPlAdAkHtnkJDMXxY,1066
236
237
  orchestrator/schedules/resume_workflows.py,sha256=kSotzTAXjX7p9fpSYiGOpuxuTQfv54eRFAe0YSG0DHc,832
237
238
  orchestrator/schedules/scheduling.py,sha256=ehtwgpbvMOk1jhn-hHgVzg_9wLJkI6l3mRY3DcO9ZVY,1526
@@ -298,7 +299,7 @@ orchestrator/workflows/tasks/resume_workflows.py,sha256=MzJqlSXUvKStkT7NGzxZyRlf
298
299
  orchestrator/workflows/tasks/validate_product_type.py,sha256=UVX_6Kh8ueQs8ujLawnKVDdNc8UhWp_u69aNA8okR_w,3184
299
300
  orchestrator/workflows/tasks/validate_products.py,sha256=i6jQME9N8sZZWo4pkNOS1Zgwh3eB2w66DnJi9k93yNk,8521
300
301
  orchestrator/workflows/translations/en-GB.json,sha256=ST53HxkphFLTMjFHonykDBOZ7-P_KxksktZU3GbxLt0,846
301
- orchestrator_core-3.2.0rc1.dist-info/licenses/LICENSE,sha256=b-aA5OZQuuBATmLKo_mln8CQrDPPhg3ghLzjPjLn4Tg,11409
302
- orchestrator_core-3.2.0rc1.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
303
- orchestrator_core-3.2.0rc1.dist-info/METADATA,sha256=FwPfK9U6vXuYqVzjbf7ObcO3HtBfCktD58FXTvM0gJw,4994
304
- orchestrator_core-3.2.0rc1.dist-info/RECORD,,
302
+ orchestrator_core-3.2.1.dist-info/licenses/LICENSE,sha256=b-aA5OZQuuBATmLKo_mln8CQrDPPhg3ghLzjPjLn4Tg,11409
303
+ orchestrator_core-3.2.1.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
304
+ orchestrator_core-3.2.1.dist-info/METADATA,sha256=SA6f9kL3n50wDwmn93yGZmHg6KGdkVpPKLKSh0j1mJ8,5029
305
+ orchestrator_core-3.2.1.dist-info/RECORD,,