def __init__(self, pipeline_run): super().__init__( runId=pipeline_run.run_id, status=PipelineRunStatus(pipeline_run.status), mode=pipeline_run.mode, ) self._pipeline_run = check.inst_param(pipeline_run, "pipeline_run", PipelineRun)
def launch_run(self, instance, run): self.validate() variables = {'runId': run.run_id} response = requests.post( urljoin(self._address, '/graphql'), params={ 'query': START_PIPELINE_EXECUTION_FOR_CREATED_RUN_MUTATION, 'variables': seven.json.dumps(variables), }, timeout=self._timeout, ) response.raise_for_status() result = response.json()['data']['startPipelineExecutionForCreatedRun'] if result['__typename'] == 'StartPipelineRunSuccess': return run.with_status(PipelineRunStatus(result['run']['status'])) if result['__typename'] == 'PipelineConfigValidationInvalid': return run.run_with_status(PipelineRunStatus.FAILURE) raise DagsterLaunchFailedError( 'Failed to launch run with {cls} targeting {address}:\n{result}'. format(cls=self.__class__.__name__, address=self._address, result=result))
def launch_run(self, instance, run): self.validate() execution_params = execution_params_from_pipeline_run(run) variables = {'executionParams': execution_params.to_graphql_input()} instance.create_run(run) response = requests.post( urljoin(self._address, '/graphql'), params={ 'query': START_PIPELINE_EXECUTION_MUTATION, 'variables': seven.json.dumps(variables), }, timeout=self._timeout, ) response.raise_for_status() result = response.json()['data']['startPipelineExecution'] if result['__typename'] == 'StartPipelineExecutionSuccess': return run.run_with_status( PipelineRunStatus(result['run']['status'])) raise DagsterLaunchFailedError( 'Failed to launch run with {cls} targeting {address}:\n{result}'. format(cls=self.__class__.__name__, address=self._address, result=result))
def __init__(self, record): check.inst_param(record, "record", RunRecord) pipeline_run = record.pipeline_run super().__init__( runId=pipeline_run.run_id, status=PipelineRunStatus(pipeline_run.status), mode=pipeline_run.mode, ) self._pipeline_run = pipeline_run self._run_record = record self._run_stats = None
def get_run_status(self, run_id: str) -> PipelineRunStatus: """Get the status of a given Pipeline Run Args: run_id (str): run id of the requested pipeline run. Raises: DagsterGraphQLClientError("PipelineNotFoundError", message): if the requested run id is not found DagsterGraphQLClientError("PythonError", message): on internal framework errors Returns: PipelineRunStatus: returns a status Enum describing the state of the requested pipeline run """ check.str_param(run_id, "run_id") res_data: Dict[str, Dict[str, Any]] = self._execute( GET_PIPELINE_RUN_STATUS_QUERY, {"runId": run_id}) query_result: Dict[str, Any] = res_data["pipelineRunOrError"] query_result_type: str = query_result["__typename"] if query_result_type == "PipelineRun" or query_result_type == "Run": return PipelineRunStatus(query_result["status"]) else: raise DagsterGraphQLClientError(query_result_type, query_result["message"])