1313 Tuple ,
1414 Union ,
1515)
16- from zenml .client import Client
17- from zenml .config .compiler import Compiler
18-
1916from uuid import UUID
17+
2018from zenml import ExternalArtifact
2119from zenml .client import Client
20+ from zenml .config .compiler import Compiler
2221from zenml .config .step_configurations import Step
2322from zenml .exceptions import RunStoppedException
2423from zenml .logger import get_logger
2726 ArtifactVersionResponse ,
2827 PipelineRunResponse ,
2928 PipelineSnapshotResponse ,
30- PipelineSnapshotUpdate ,
3129)
3230from zenml .models .v2 .core .step_run import StepRunResponse
3331from zenml .orchestrators .publish_utils import (
@@ -169,18 +167,19 @@ def run_step_sync(
169167 compiled_step , invocation_id = _compile_step (
170168 self .pipeline , step , id , upstream_steps , inputs
171169 )
172- updated_snapshot = Client ().zen_store .update_snapshot (
173- self ._snapshot .id ,
174- snapshot_update = PipelineSnapshotUpdate (
175- add_steps = {invocation_id : compiled_step }
176- ),
177- )
178- step_config = updated_snapshot .step_configurations [invocation_id ]
170+ # updated_snapshot = Client().zen_store.update_snapshot(
171+ # self._snapshot.id,
172+ # snapshot_update=PipelineSnapshotUpdate(
173+ # add_steps={invocation_id: compiled_step}
174+ # ),
175+ # )
176+ # step_config = updated_snapshot.step_configurations[invocation_id]
179177 step_run = _run_step_sync (
180- snapshot = updated_snapshot ,
181- step = step_config ,
178+ snapshot = self . _snapshot ,
179+ step = compiled_step ,
182180 orchestrator_run_id = self ._run .orchestrator_run_id ,
183- retry = _should_retry_locally (step_config ),
181+ retry = _should_retry_locally (compiled_step ),
182+ dynamic = True ,
184183 )
185184 return _load_step_result (step_run .id )
186185
@@ -198,31 +197,20 @@ def run_step_in_thread(
198197 compiled_step , invocation_id = _compile_step (
199198 self .pipeline , step , id , upstream_steps , inputs
200199 )
201- updated_snapshot = Client ().zen_store .update_snapshot (
202- self ._snapshot .id ,
203- snapshot_update = PipelineSnapshotUpdate (
204- add_steps = {invocation_id : compiled_step }
205- ),
206- )
207- step_config = updated_snapshot .step_configurations [invocation_id ]
208200
209201 def _run () -> StepRunResult :
210202 step_run = _run_step_sync (
211- snapshot = updated_snapshot ,
212- step = step_config ,
203+ snapshot = self . _snapshot ,
204+ step = compiled_step ,
213205 orchestrator_run_id = self ._run .orchestrator_run_id ,
214- retry = _should_retry_locally (step_config ),
206+ retry = _should_retry_locally (compiled_step ),
207+ dynamic = True ,
215208 )
216209 return _load_step_result (step_run .id )
217210
218211 ctx = contextvars .copy_context ()
219- future = self ._executor .submit (
220- ctx .run , _run
221- )
222- return StepRunResultFuture (
223- wrapped = future , invocation_id = invocation_id
224- )
225-
212+ future = self ._executor .submit (ctx .run , _run )
213+ return StepRunResultFuture (wrapped = future , invocation_id = invocation_id )
226214
227215
228216def _prepare_step_run (
@@ -318,12 +306,14 @@ def _run_step_sync(
318306 step : "Step" ,
319307 orchestrator_run_id : str ,
320308 retry : bool = False ,
309+ dynamic : bool = False ,
321310) -> StepRunResponse :
322311 def _launch_step () -> StepRunResponse :
323312 launcher = StepLauncher (
324313 snapshot = snapshot ,
325314 step = step ,
326315 orchestrator_run_id = orchestrator_run_id ,
316+ dynamic = dynamic ,
327317 )
328318 return launcher .launch ()
329319
@@ -362,7 +352,7 @@ def _launch_step() -> StepRunResponse:
362352 raise
363353 else :
364354 break
365-
355+
366356 return step_run
367357
368358
@@ -377,7 +367,7 @@ def _convert_output_artifact(
377367 step_name = step_run .name ,
378368 ** artifact .model_dump (),
379369 )
380-
370+
381371 output_artifacts = step_run .regular_outputs
382372 if len (output_artifacts ) == 0 :
383373 return None
@@ -399,16 +389,19 @@ def _should_retry_locally(step: "Step") -> bool:
399389 return True
400390 else :
401391 # Running out of process with the orchestrator
402- return not Client ().active_stack .orchestrator .config .handles_step_retries
392+ return (
393+ not Client ().active_stack .orchestrator .config .handles_step_retries
394+ )
395+
403396
404397def _runs_in_process (step : "Step" ) -> bool :
405398 if step .config .step_operator :
406399 return False
407-
400+
408401 if not Client ().active_stack .orchestrator .supports_dynamic_out_of_process_steps :
409402 return False
410403
411404 if step .config .in_process is False :
412405 return False
413-
414- return True
406+
407+ return True
0 commit comments