def core_execute_run( recon_pipeline: ReconstructablePipeline, pipeline_run: PipelineRun, instance: DagsterInstance, resume_from_failure: bool = False, ) -> Generator[DagsterEvent, None, None]: check.inst_param(recon_pipeline, "recon_pipeline", ReconstructablePipeline) check.inst_param(pipeline_run, "pipeline_run", PipelineRun) check.inst_param(instance, "instance", DagsterInstance) # try to load the pipeline definition early try: recon_pipeline.get_definition() except Exception: yield instance.report_engine_event( "Could not load pipeline definition.", pipeline_run, EngineEventData.engine_error( serializable_error_info_from_exc_info(sys.exc_info())), ) yield from _report_run_failed_if_not_finished(instance, pipeline_run.run_id) raise try: yield from execute_run_iterator( recon_pipeline, pipeline_run, instance, resume_from_failure=resume_from_failure) except (KeyboardInterrupt, DagsterExecutionInterruptedError): yield from _report_run_failed_if_not_finished(instance, pipeline_run.run_id) yield instance.report_engine_event( message="Run execution terminated by interrupt", pipeline_run=pipeline_run, ) raise except Exception: yield instance.report_engine_event( "An exception was thrown during execution that is likely a framework error, " "rather than an error in user code.", pipeline_run, EngineEventData.engine_error( serializable_error_info_from_exc_info(sys.exc_info())), ) yield from _report_run_failed_if_not_finished(instance, pipeline_run.run_id) raise
def get_external_pipeline_subset_result( recon_pipeline: ReconstructablePipeline, solid_selection: Optional[List[str]]): check.inst_param(recon_pipeline, "recon_pipeline", ReconstructablePipeline) check.opt_list_param(solid_selection, "solid_selection", str) if solid_selection: try: sub_pipeline = recon_pipeline.subset_for_execution(solid_selection) definition = sub_pipeline.get_definition() except Exception: return ExternalPipelineSubsetResult( success=False, error=serializable_error_info_from_exc_info(sys.exc_info())) else: definition = recon_pipeline.get_definition() external_pipeline_data = external_pipeline_data_from_def(definition) return ExternalPipelineSubsetResult( success=True, external_pipeline_data=external_pipeline_data)