orchestrator-core 4.4.0rc2__py3-none-any.whl → 4.4.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__ = "4.4.0rc2"
16
+ __version__ = "4.4.1"
17
17
 
18
18
  from orchestrator.app import OrchestratorCore
19
19
  from orchestrator.settings import app_settings
@@ -13,11 +13,13 @@
13
13
 
14
14
 
15
15
  import logging
16
+ import time
16
17
 
17
18
  import typer
18
- from apscheduler.schedulers.blocking import BlockingScheduler
19
19
 
20
- from orchestrator.schedules.scheduler import get_paused_scheduler, jobstores, scheduler_dispose_db_connections
20
+ from orchestrator.schedules.scheduler import (
21
+ get_paused_scheduler,
22
+ )
21
23
 
22
24
  log = logging.getLogger(__name__)
23
25
 
@@ -27,18 +29,11 @@ app: typer.Typer = typer.Typer()
27
29
  @app.command()
28
30
  def run() -> None:
29
31
  """Start scheduler and loop eternally to keep thread alive."""
30
- # necessary to add the schedules to the DB since they are added to the BackgroundScheduler
31
32
  with get_paused_scheduler() as scheduler:
32
33
  scheduler.resume()
33
- scheduler.pause()
34
34
 
35
- blocking_scheduler = BlockingScheduler(jobstores=jobstores, jobstore_update_interval=5)
36
-
37
- try:
38
- blocking_scheduler.start()
39
- finally:
40
- blocking_scheduler.shutdown()
41
- scheduler_dispose_db_connections()
35
+ while True:
36
+ time.sleep(1)
42
37
 
43
38
 
44
39
  @app.command()
@@ -82,8 +82,8 @@ class ProcessType:
82
82
  )
83
83
 
84
84
  @strawberry.field(description="Returns user permissions for operations on this process") # type: ignore
85
- def user_permissions(self, info: OrchestratorInfo) -> FormUserPermissionsType:
86
- oidc_user = info.context.get_current_user
85
+ async def user_permissions(self, info: OrchestratorInfo) -> FormUserPermissionsType:
86
+ oidc_user = await info.context.get_current_user
87
87
  workflow = get_workflow(self.workflow_name)
88
88
  process = load_process(db.session.get(ProcessTable, self.process_id)) # type: ignore[arg-type]
89
89
  auth_resume, auth_retry = get_auth_callbacks(get_steps_to_evaluate_for_rbac(process), workflow) # type: ignore[arg-type]
@@ -33,8 +33,8 @@ class Workflow:
33
33
  return [Step(name=step.name, assignee=step.assignee) for step in get_workflow(self.name).steps] # type: ignore
34
34
 
35
35
  @strawberry.field(description="Return whether the currently logged-in used is allowed to start this workflow") # type: ignore
36
- def is_allowed(self, info: OrchestratorInfo) -> bool:
37
- oidc_user = info.context.get_current_user
36
+ async def is_allowed(self, info: OrchestratorInfo) -> bool:
37
+ oidc_user = await info.context.get_current_user
38
38
  workflow_table = get_original_model(self, WorkflowTable)
39
39
  workflow = get_workflow(workflow_table.name)
40
40
 
@@ -16,6 +16,7 @@ from contextlib import contextmanager
16
16
  from datetime import datetime
17
17
  from typing import Any, Generator
18
18
 
19
+ from apscheduler.executors.pool import ThreadPoolExecutor
19
20
  from apscheduler.jobstores.sqlalchemy import SQLAlchemyJobStore
20
21
  from apscheduler.schedulers.background import BackgroundScheduler
21
22
  from more_itertools import partition
@@ -28,24 +29,29 @@ from orchestrator.db.sorting.sorting import SortOrder
28
29
  from orchestrator.settings import app_settings
29
30
  from orchestrator.utils.helpers import camel_to_snake, to_camel
30
31
 
31
- jobstores = {"default": SQLAlchemyJobStore(url=str(app_settings.DATABASE_URI))}
32
+ executors = {
33
+ "default": ThreadPoolExecutor(1),
34
+ }
35
+ job_defaults = {
36
+ "coalesce": True,
37
+ }
32
38
 
33
- scheduler = BackgroundScheduler(jobstores=jobstores)
34
-
35
-
36
- def scheduler_dispose_db_connections() -> None:
37
- jobstores["default"].engine.dispose()
39
+ scheduler = BackgroundScheduler(executors=executors, job_defaults=job_defaults)
38
40
 
39
41
 
40
42
  @contextmanager
41
43
  def get_paused_scheduler() -> Generator[BackgroundScheduler, Any, None]:
44
+ try:
45
+ scheduler.add_jobstore(SQLAlchemyJobStore(url=str(app_settings.DATABASE_URI)))
46
+ except ValueError:
47
+ pass
42
48
  scheduler.start(paused=True)
43
49
 
44
50
  try:
45
51
  yield scheduler
46
52
  finally:
47
- scheduler.shutdown(wait=False)
48
- scheduler_dispose_db_connections()
53
+ scheduler.shutdown()
54
+ scheduler._jobstores["default"].engine.dispose()
49
55
 
50
56
 
51
57
  class ScheduledTask(BaseModel):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: orchestrator-core
3
- Version: 4.4.0rc2
3
+ Version: 4.4.1
4
4
  Summary: This is the orchestrator workflow engine.
5
5
  Author-email: SURF <automation-beheer@surf.nl>
6
6
  Requires-Python: >=3.11,<3.14
@@ -1,4 +1,4 @@
1
- orchestrator/__init__.py,sha256=fLvw8_VTviPfkaTAcyf3V0uttrRgYmGGS232qt74x3g,1066
1
+ orchestrator/__init__.py,sha256=4M-5vT7NIXhlohP0pzoqgU8XpZo6DiR2qUrj09ybyxA,1063
2
2
  orchestrator/app.py,sha256=7UrXKjBKNSEaSSXAd5ww_RdMFhFqE4yvfj8faS2MzAA,12089
3
3
  orchestrator/exception_handlers.py,sha256=UsW3dw8q0QQlNLcV359bIotah8DYjMsj2Ts1LfX4ClY,1268
4
4
  orchestrator/log_config.py,sha256=1tPRX5q65e57a6a_zEii_PFK8SzWT0mnA5w2sKg4hh8,1853
@@ -36,7 +36,7 @@ orchestrator/cli/migrate_domain_models.py,sha256=WRXy_1OnziQwpsCFZXvjB30nDJtjj0i
36
36
  orchestrator/cli/migrate_tasks.py,sha256=bju8XColjSZD0v3rS4kl-24dLr8En_H4-6enBmqd494,7255
37
37
  orchestrator/cli/migrate_workflows.py,sha256=nxUpx0vgEIc_8aJrjAyrw3E9Dt8JmaamTts8oiQ4vHY,8923
38
38
  orchestrator/cli/migration_helpers.py,sha256=C5tpkP5WEBr7G9S-1k1hgSI8ili6xd9Z5ygc9notaK0,4110
39
- orchestrator/cli/scheduler.py,sha256=k0ScKb6RldPOCuWGSZdGZJstxyNqmWGgPTrbrc3rGXU,2303
39
+ orchestrator/cli/scheduler.py,sha256=2q6xT_XVOodY3e_qzIV98MWNvKvrbFpOJajWesj1fcs,1911
40
40
  orchestrator/cli/domain_gen_helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
41
41
  orchestrator/cli/domain_gen_helpers/fixed_input_helpers.py,sha256=uzpwsaau81hHSxNMOS9-o7kF-9_78R0f_UE0AvWooZQ,6775
42
42
  orchestrator/cli/domain_gen_helpers/helpers.py,sha256=tIPxn8ezED_xYZxH7ZAtQLwkDc6RNmLZVxWAoJ3a9lw,4203
@@ -185,7 +185,7 @@ orchestrator/graphql/schemas/customer_description.py,sha256=fize71IMpkvk_rTzcqCY
185
185
  orchestrator/graphql/schemas/errors.py,sha256=VRl-Zd1FHMnscyozhfxzqeEUZ0ERAWum_Y8YwjGxwmA,203
186
186
  orchestrator/graphql/schemas/fixed_input.py,sha256=1yqYHADQRgHz8OIP7ObYsPFS-gmzfkCvEO0a-KKf7zI,513
187
187
  orchestrator/graphql/schemas/helpers.py,sha256=Kpj4kIbmoKKN35bdgUSwQvGUIbeg7VJAVMEq65YS_ik,346
188
- orchestrator/graphql/schemas/process.py,sha256=g3noYh_USfnaK59fnoX2DI5tAf1PhdLMJGI_lA2xX1M,4966
188
+ orchestrator/graphql/schemas/process.py,sha256=wN4pKDuPbPHyyfGYaqFXMXxKTDm_zIwmyCOhSu5H1Iw,4978
189
189
  orchestrator/graphql/schemas/product.py,sha256=vUCqcjrKBJj-VKSrMYPKzjmmxLMXL7alKTJ8UdUkhTg,4342
190
190
  orchestrator/graphql/schemas/product_block.py,sha256=Qk9cbA6vm7ZPrhdgPHatKRuy6TytBmxSr97McEOxAu8,2860
191
191
  orchestrator/graphql/schemas/resource_type.py,sha256=s5d_FwQXL2-Sc-IDUxTJun5qFQ4zOP4-XcHF9ql-t1g,898
@@ -194,7 +194,7 @@ orchestrator/graphql/schemas/settings.py,sha256=drhm5VcLmUbiYAk6WUSJcyJqjNM96E6G
194
194
  orchestrator/graphql/schemas/strawberry_pydantic_patch.py,sha256=CjNUhTKdYmLiaem-WY_mzw4HASIeaZitxGF8pPocqVw,1602
195
195
  orchestrator/graphql/schemas/subscription.py,sha256=hTA34C27kgLguH9V53173CxMKIWiQKh3vFzyJ2yBfE0,9918
196
196
  orchestrator/graphql/schemas/version.py,sha256=HSzVg_y4Sjd5_H5rRUtu3FJKOG_8ifhvBNt_qjOtC-E,92
197
- orchestrator/graphql/schemas/workflow.py,sha256=WLbegRNxOfvXg4kPYrO5KPBwtHmUofAr2pvZT2JsW1c,1761
197
+ orchestrator/graphql/schemas/workflow.py,sha256=ewE5mRuqMq7rnx8Au2eTUm3YTY1pivOWATNacZQ-trY,1773
198
198
  orchestrator/graphql/utils/__init__.py,sha256=1JvenzEVW1CBa1sGVI9I8IWnnoXIkb1hneDqph9EEZY,524
199
199
  orchestrator/graphql/utils/create_resolver_error_handler.py,sha256=XzCnL482M4wz3fg5fUdGUwCAuzSZQ9Ufu1mscLyeoWU,1227
200
200
  orchestrator/graphql/utils/get_query_loaders.py,sha256=abS_HJ7K9een78gMiGq3IhwGwxQXHvZygExe0h_t9ns,815
@@ -249,7 +249,7 @@ orchestrator/migrations/versions/schema/2025-07-04_4b58e336d1bf_deprecating_work
249
249
  orchestrator/migrations/versions/schema/2025-07-28_850dccac3b02_update_description_of_resume_workflows_.py,sha256=R6Qoga83DJ1IL0WYPu0u5u2ZvAmqGlDmUMv_KtJyOhQ,812
250
250
  orchestrator/schedules/__init__.py,sha256=Zy0fTOBMGIRFoh5iVFDLF9_PRAFaONYDThGK9EsysWo,981
251
251
  orchestrator/schedules/resume_workflows.py,sha256=jRnVRWDy687pQu-gtk80ecwiLSdrvtL15tG3U2zWA6I,891
252
- orchestrator/schedules/scheduler.py,sha256=XJ_H6KaW2jDAXQXnNKQPD9AhRa0eZloChtDnvScV0ds,5689
252
+ orchestrator/schedules/scheduler.py,sha256=nnuehZnBbtC90MsFP_Q6kqcD1ihsq08vr1ALJ6jHF_s,5833
253
253
  orchestrator/schedules/scheduling.py,sha256=_mbpHMhijey8Y56ebtJ4wVkrp_kPVRm8hoByzlQF4SE,2821
254
254
  orchestrator/schedules/task_vacuum.py,sha256=mxb7fsy1GphRwvUWi_lvwNaj51YAXUdIDlkOJd90AFI,874
255
255
  orchestrator/schedules/validate_products.py,sha256=zWFQeVn3F8LP3joExLiKdmHs008pZsO-RolcIXHjFyE,1322
@@ -319,7 +319,7 @@ orchestrator/workflows/tasks/resume_workflows.py,sha256=T3iobSJjVgiupe0rClD34kUZ
319
319
  orchestrator/workflows/tasks/validate_product_type.py,sha256=paG-NAY1bdde3Adt8zItkcBKf5Pxw6f5ngGW6an6dYU,3192
320
320
  orchestrator/workflows/tasks/validate_products.py,sha256=GZJBoFF-WMphS7ghMs2-gqvV2iL1F0POhk0uSNt93n0,8510
321
321
  orchestrator/workflows/translations/en-GB.json,sha256=ST53HxkphFLTMjFHonykDBOZ7-P_KxksktZU3GbxLt0,846
322
- orchestrator_core-4.4.0rc2.dist-info/licenses/LICENSE,sha256=b-aA5OZQuuBATmLKo_mln8CQrDPPhg3ghLzjPjLn4Tg,11409
323
- orchestrator_core-4.4.0rc2.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
324
- orchestrator_core-4.4.0rc2.dist-info/METADATA,sha256=CvB_VqeeP4h65_MXfrolOh-XbflSyr3adVLmZLV5USw,5967
325
- orchestrator_core-4.4.0rc2.dist-info/RECORD,,
322
+ orchestrator_core-4.4.1.dist-info/licenses/LICENSE,sha256=b-aA5OZQuuBATmLKo_mln8CQrDPPhg3ghLzjPjLn4Tg,11409
323
+ orchestrator_core-4.4.1.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
324
+ orchestrator_core-4.4.1.dist-info/METADATA,sha256=kWsL3EEfOcsMRN6w6yux9mrAkzFM4iecoZy3IgTtw8k,5964
325
+ orchestrator_core-4.4.1.dist-info/RECORD,,