class DauphinExecutionStep(dauphin.ObjectType): class Meta: name = 'ExecutionStep' name = dauphin.NonNull(dauphin.String) inputs = dauphin.non_null_list('ExecutionStepInput') outputs = dauphin.non_null_list('ExecutionStepOutput') solid = dauphin.NonNull('Solid') tag = dauphin.NonNull('StepTag') def __init__(self, execution_step): super(DauphinExecutionStep, self).__init__() self.execution_step = check.inst_param(execution_step, 'execution_step', ExecutionStep) def resolve_inputs(self, info): return [ info.schema.type_named('ExecutionStepInput')(inp) for inp in self.execution_step.step_inputs ] def resolve_outputs(self, info): return [ info.schema.type_named('ExecutionStepOutput')(out) for out in self.execution_step.step_outputs ] def resolve_name(self, _info): return self.execution_step.key def resolve_solid(self, info): return info.schema.type_named('Solid')(self.execution_step.solid) def resolve_tag(self, _info): return self.execution_step.tag
class DauphinSolidDefinition(dauphin.ObjectType): class Meta: name = 'SolidDefinition' name = dauphin.NonNull(dauphin.String) description = dauphin.String() metadata = dauphin.non_null_list('SolidMetadataItemDefinition') input_definitions = dauphin.non_null_list('InputDefinition') output_definitions = dauphin.non_null_list('OutputDefinition') config_definition = dauphin.Field('ConfigTypeField') # solids - ? def __init__(self, solid_def): super(DauphinSolidDefinition, self).__init__( name=solid_def.name, description=solid_def.description ) self._solid_def = check.inst_param(solid_def, 'solid_def', SolidDefinition) def resolve_metadata(self, graphene_info): return [ graphene_info.schema.type_named('SolidMetadataItemDefinition')( key=item[0], value=item[1] ) for item in self._solid_def.metadata.items() ] def resolve_input_definitions(self, graphene_info): return [ graphene_info.schema.type_named('InputDefinition')(input_definition, self) for input_definition in self._solid_def.input_defs ] def resolve_output_definitions(self, graphene_info): return [ graphene_info.schema.type_named('OutputDefinition')(output_definition, self) for output_definition in self._solid_def.output_defs ] def resolve_config_definition(self, graphene_info): return ( graphene_info.schema.type_named('ConfigTypeField')( name="config", field=self._solid_def.config_field ) if self._solid_def.config_field else None )
class DauphinConfigType(dauphin.Interface): class Meta: name = 'ConfigType' key = dauphin.NonNull(dauphin.String) name = dauphin.String() description = dauphin.String() inner_types = dauphin.non_null_list('ConfigType') is_nullable = dauphin.NonNull(dauphin.Boolean) is_list = dauphin.NonNull(dauphin.Boolean) is_selector = dauphin.NonNull(dauphin.Boolean) is_builtin = dauphin.NonNull( dauphin.Boolean, description=''' True if the system defines it and it is the same type across pipelines. Examples include "Int" and "String."''', ) is_system_generated = dauphin.NonNull( dauphin.Boolean, description=''' Dagster generates types for base elements of the config system (e.g. the solids and context field of the base environment). These types are always present and are typically not relevant to an end user. This flag allows tool authors to filter out those types by default. ''', )
class DauphinInputDefinition(dauphin.ObjectType): class Meta: name = 'InputDefinition' solid_definition = dauphin.NonNull('SolidDefinition') name = dauphin.NonNull(dauphin.String) description = dauphin.String() type = dauphin.NonNull('Type') expectations = dauphin.non_null_list('Expectation') # inputs - ? def __init__(self, input_definition, solid_def): super(DauphinInputDefinition, self).__init__( name=input_definition.name, description=input_definition.description, solid_definition=solid_def, ) self._input_definition = check.inst_param(input_definition, 'input_definition', InputDefinition) def resolve_type(self, info): return info.schema.type_named('Type').to_dauphin_type( info, self._input_definition.runtime_type) def resolve_expectations(self, info): if self._input_definition.expectations: return [ info.schema.type_named('Expectation')( expectation for expectation in self._input_definition.expectations) ] else: return []
class DauphinStartSubplanExecutionSuccess(dauphin.ObjectType): class Meta: name = 'StartSubplanExecutionSuccess' pipeline = dauphin.Field(dauphin.NonNull('Pipeline')) has_failures = dauphin.Field(dauphin.NonNull(dauphin.Boolean)) step_results = dauphin.non_null_list(DauphinStepResult)
class DauphinType(dauphin.Interface): class Meta: name = 'Type' name = dauphin.NonNull(dauphin.String) description = dauphin.String() type_attributes = dauphin.NonNull('TypeAttributes') is_dict = dauphin.NonNull(dauphin.Boolean) is_nullable = dauphin.NonNull(dauphin.Boolean) is_list = dauphin.NonNull(dauphin.Boolean) is_selector = dauphin.NonNull(dauphin.Boolean) inner_types = dauphin.non_null_list('Type') @classmethod def to_dauphin_type(cls, info, config_or_runtime_type): if isinstance(config_or_runtime_type, ConfigType) and config_or_runtime_type.has_fields: return info.schema.type_named('CompositeType')( config_or_runtime_type) elif isinstance(config_or_runtime_type, ConfigType) and config_or_runtime_type.is_enum: return info.schema.type_named('EnumType')(config_or_runtime_type) else: return info.schema.type_named('RegularType')( config_or_runtime_type)
class DauphinLogMessageConnection(dauphin.ObjectType): class Meta: name = 'LogMessageConnection' nodes = dauphin.non_null_list('PipelineRunEvent') pageInfo = dauphin.NonNull('PageInfo') def __init__(self, pipeline_run): self._pipeline_run = check.inst_param( pipeline_run, 'pipeline_run', pipeline_run_storage.PipelineRun ) self._logs = self._pipeline_run.all_logs() def resolve_nodes(self, info): pipeline = model.get_pipeline_or_raise(info, self._pipeline_run.selector) return [ info.schema.type_named('PipelineRunEvent').from_dagster_event(info, log, pipeline) for log in self._logs ] def resolve_pageInfo(self, info): count = len(self._logs) lastCursor = None if count > 0: lastCursor = str(count - 1) return info.schema.type_named('PageInfo')( lastCursor=lastCursor, hasNextPage=None, hasPreviousPage=None, count=count, totalCount=count, )
class DauphinOutputDefinition(dauphin.ObjectType): class Meta: name = 'OutputDefinition' solid_definition = dauphin.NonNull('SolidDefinition') name = dauphin.NonNull(dauphin.String) description = dauphin.String() type = dauphin.NonNull('RuntimeType') expectations = dauphin.non_null_list('Expectation') # outputs - ? def __init__(self, output_definition, solid_def): super(DauphinOutputDefinition, self).__init__( name=output_definition.name, description=output_definition.description, solid_definition=solid_def, ) self._output_definition = check.inst_param( output_definition, 'output_definition', OutputDefinition ) def resolve_type(self, _graphene_info): return to_dauphin_runtime_type(self._output_definition.runtime_type) def resolve_expectations(self, graphene_info): if self._output_definition.expectations: return [ graphene_info.schema.type_named('Expectation')(expectation) for expectation in self._output_definition.expectations ] else: return []
class DauphinCompositeConfigType(dauphin.ObjectType): def __init__(self, config_type): check.inst_param(config_type, 'config_type', ConfigType) check.param_invariant(config_type.has_fields, 'config_type') self._config_type = config_type super(DauphinCompositeConfigType, self).__init__(**_ctor_kwargs(config_type)) class Meta: name = 'CompositeConfigType' interfaces = [DauphinConfigType] fields = dauphin.non_null_list('ConfigTypeField') def resolve_fields(self, _graphene_info): return sorted( [ DauphinConfigTypeField(name=name, field=field) for name, field in self._config_type.fields.items() ], key=lambda field: field.name, ) def resolve_inner_types(self, _graphene_info): return _resolve_inner_types(self._config_type)
class DauphinOutput(dauphin.ObjectType): class Meta: name = 'Output' solid = dauphin.NonNull('Solid') definition = dauphin.NonNull('OutputDefinition') depended_by = dauphin.non_null_list('Input') def __init__(self, output_handle, solid): super(DauphinOutput, self).__init__(solid=solid) self._solid = check.inst_param(solid, 'solid', DauphinSolid) self._output_handle = check.inst_param(output_handle, 'output_handle', SolidOutputHandle) def resolve_definition(self, info): return info.schema.type_named('OutputDefinition')( self._output_handle.output_def, self._solid.resolve_definition(info)) def resolve_depended_by(self, info): return [ info.schema.type_named('Input')(input_handle, DauphinSolid(input_handle.solid)) for input_handle in self._solid.depended_by.get( self._output_handle, []) ]
class DauphinSolid(dauphin.ObjectType): class Meta: name = 'Solid' name = dauphin.NonNull(dauphin.String) definition = dauphin.NonNull('SolidDefinition') inputs = dauphin.non_null_list('Input') outputs = dauphin.non_null_list('Output') def __init__(self, solid, depends_on=None, depended_by=None): super(DauphinSolid, self).__init__(name=solid.name) self._solid = check.inst_param(solid, 'solid', Solid) if depends_on: self.depends_on = { input_handle: output_handle for input_handle, output_handle in depends_on.items() } else: self.depends_on = {} if depended_by: self.depended_by = { output_handle: input_handles for output_handle, input_handles in depended_by.items() } else: self.depended_by = {} def resolve_definition(self, info): return info.schema.type_named('SolidDefinition')( self._solid.definition) def resolve_inputs(self, info): return [ info.schema.type_named('Input')(input_handle, self) for input_handle in self._solid.input_handles() ] def resolve_outputs(self, info): return [ info.schema.type_named('Output')(output_handle, self) for output_handle in self._solid.output_handles() ]
class DauphinEvaluationStack(dauphin.ObjectType): class Meta: name = 'EvaluationStack' entries = dauphin.non_null_list('EvaluationStackEntry') def resolve_entries(self, info): return map( info.schema.type_named('EvaluationStackEntry').from_native_entry, self.entries)
class DauphinExecutionStep(dauphin.ObjectType): class Meta: name = 'ExecutionStep' name = dauphin.Field(dauphin.NonNull(dauphin.String), deprecation_reason='Use key') key = dauphin.NonNull(dauphin.String) inputs = dauphin.non_null_list('ExecutionStepInput') outputs = dauphin.non_null_list('ExecutionStepOutput') solid = dauphin.NonNull('Solid') kind = dauphin.NonNull('StepKind') def __init__(self, execution_step): super(DauphinExecutionStep, self).__init__() self.execution_step = check.inst_param(execution_step, 'execution_step', ExecutionStep) def resolve_inputs(self, graphene_info): return [ graphene_info.schema.type_named('ExecutionStepInput')(inp) for inp in self.execution_step.step_inputs ] def resolve_outputs(self, graphene_info): return [ graphene_info.schema.type_named('ExecutionStepOutput')(out) for out in self.execution_step.step_outputs ] def resolve_key(self, _graphene_info): return self.execution_step.key def resolve_name(self, _graphene_info): return self.execution_step.key def resolve_solid(self, graphene_info): return graphene_info.schema.type_named('Solid')( self.execution_step.solid) def resolve_kind(self, _graphene_info): return self.execution_step.kind
class DauphinPipelineConfigValidationError(dauphin.Interface): class Meta: name = 'PipelineConfigValidationError' message = dauphin.NonNull(dauphin.String) path = dauphin.non_null_list(dauphin.String) stack = dauphin.NonNull('EvaluationStack') reason = dauphin.NonNull('EvaluationErrorReason') @staticmethod def from_dagster_error(graphene_info, error): check.inst_param(error, 'error', EvaluationError) if isinstance(error.error_data, RuntimeMismatchErrorData): return graphene_info.schema.type_named( 'RuntimeMismatchConfigError')( message=error.message, path=[], # TODO: remove stack=error.stack, reason=error.reason, type=error.error_data.config_type, value_rep=error.error_data.value_rep, ) elif isinstance(error.error_data, MissingFieldErrorData): return graphene_info.schema.type_named('MissingFieldConfigError')( message=error.message, path=[], # TODO: remove stack=error.stack, reason=error.reason, field=graphene_info.schema.type_named('ConfigTypeField')( name=error.error_data.field_name, field=error.error_data.field_def), ) elif isinstance(error.error_data, FieldNotDefinedErrorData): return graphene_info.schema.type_named( 'FieldNotDefinedConfigError')( message=error.message, path=[], # TODO: remove stack=error.stack, reason=error.reason, field_name=error.error_data.field_name, ) elif isinstance(error.error_data, SelectorTypeErrorData): return graphene_info.schema.type_named('SelectorTypeConfigError')( message=error.message, path=[], # TODO: remove stack=error.stack, reason=error.reason, incoming_fields=error.error_data.incoming_fields, ) else: check.failed('Error type not supported {error_data}'.format( error_data=repr(error.error_data)))
class DauphinExecutionPlan(dauphin.ObjectType): class Meta: name = 'ExecutionPlan' steps = dauphin.non_null_list('ExecutionStep') pipeline = dauphin.NonNull('Pipeline') def __init__(self, pipeline, execution_plan): super(DauphinExecutionPlan, self).__init__(pipeline=pipeline) self.execution_plan = check.inst_param(execution_plan, 'execution_plan', ExecutionPlan) def resolve_steps(self, _info): return [ DauphinExecutionStep(cn) for cn in self.execution_plan.topological_steps() ]
class DauphinRuntimeType(dauphin.Interface): class Meta: name = 'RuntimeType' key = dauphin.NonNull(dauphin.String) name = dauphin.String() display_name = dauphin.NonNull(dauphin.String) description = dauphin.String() is_nullable = dauphin.NonNull(dauphin.Boolean) is_list = dauphin.NonNull(dauphin.Boolean) is_builtin = dauphin.NonNull(dauphin.Boolean) input_schema_type = dauphin.Field(DauphinConfigType) output_schema_type = dauphin.Field(DauphinConfigType) inner_types = dauphin.non_null_list('RuntimeType')
class DauphinEnumConfigType(dauphin.ObjectType): def __init__(self, config_type): check.inst_param(config_type, 'config_type', ConfigType) check.param_invariant(config_type.is_enum, 'config_type') self._config_type = config_type super(DauphinEnumConfigType, self).__init__(**_ctor_kwargs(config_type)) class Meta: name = 'EnumConfigType' interfaces = [DauphinConfigType] values = dauphin.non_null_list('EnumConfigValue') def resolve_values(self, _info): return [ DauphinEnumConfigValue(value=ev.config_value, description=ev.description) for ev in self._config_type.enum_values ] def resolve_inner_types(self, _info): return _resolve_inner_types(self._config_type)
class DauphinEnumType(dauphin.ObjectType): class Meta: name = 'EnumType' interfaces = [DauphinType] values = dauphin.non_null_list('EnumValue') def __init__(self, enum_type): super(DauphinEnumType, self).__init__(**ctor_kwargs(enum_type)) self._enum_type = enum_type def resolve_values(self, info): return [ info.schema.type_named('EnumValue')(value=ev.config_value, description=ev.description) for ev in self._enum_type.enum_values ] def resolve_inner_types(self, info): return inner_types(info, self._enum_type) def resolve_type_attributes(self, _info): return type_attributes(self._enum_type)
class DauphinCompositeType(dauphin.ObjectType): class Meta: name = 'CompositeType' interfaces = [DauphinType] fields = dauphin.non_null_list('TypeField') def __init__(self, type_with_fields): super(DauphinCompositeType, self).__init__(**ctor_kwargs(type_with_fields)) self._type_with_fields = type_with_fields def resolve_inner_types(self, info): return inner_types(info, self._type_with_fields) def resolve_type_attributes(self, _info): return type_attributes(self._type_with_fields) def resolve_fields(self, info): return [ info.schema.type_named('TypeField')(name=k, field=v) for k, v in self._type_with_fields.fields.items() ]
class DauphinPipelineContext(dauphin.ObjectType): class Meta: name = 'PipelineContext' name = dauphin.NonNull(dauphin.String) description = dauphin.String() config = dauphin.Field('ConfigTypeField') resources = dauphin.non_null_list('Resource') def __init__(self, name, context): super(DauphinPipelineContext, self).__init__(name=name, description=context.description) self._context = check.inst_param(context, 'context', PipelineContextDefinition) def resolve_config(self, graphene_info): return ( graphene_info.schema.type_named('ConfigTypeField')( name="config", field=self._context.config_field ) if self._context.config_field else None ) def resolve_resources(self, _graphene_info): return [DauphinResource(*item) for item in self._context.resources.items()]
class DauphinSelectorTypeConfigError(dauphin.ObjectType): class Meta: name = 'SelectorTypeConfigError' interfaces = (DauphinPipelineConfigValidationError, ) incoming_fields = dauphin.non_null_list(dauphin.String)
class DauphinPipelineConnection(dauphin.ObjectType): class Meta: name = 'PipelineConnection' nodes = dauphin.non_null_list('Pipeline')
class DauphinPipeline(dauphin.ObjectType): class Meta: name = 'Pipeline' name = dauphin.NonNull(dauphin.String) description = dauphin.String() solids = dauphin.non_null_list('Solid') contexts = dauphin.non_null_list('PipelineContext') environment_type = dauphin.NonNull('ConfigType') config_types = dauphin.non_null_list('ConfigType') runtime_types = dauphin.non_null_list('RuntimeType') runs = dauphin.non_null_list('PipelineRun') def __init__(self, pipeline): super(DauphinPipeline, self).__init__(name=pipeline.name, description=pipeline.description) self._pipeline = check.inst_param(pipeline, 'pipeline', PipelineDefinition) def resolve_solids(self, graphene_info): return [ graphene_info.schema.type_named('Solid')( solid, self._pipeline.dependency_structure.deps_of_solid_with_input(solid.name), self._pipeline.dependency_structure.depended_by_of_solid(solid.name), ) for solid in self._pipeline.solids ] def resolve_contexts(self, graphene_info): return [ graphene_info.schema.type_named('PipelineContext')(name=name, context=context) for name, context in self._pipeline.context_definitions.items() ] def resolve_environment_type(self, _graphene_info): return to_dauphin_config_type(self._pipeline.environment_type) def resolve_config_types(self, _graphene_info): return sorted( list(map(to_dauphin_config_type, self._pipeline.all_config_types())), key=lambda config_type: config_type.key, ) def resolve_runtime_types(self, _graphene_info): return sorted( list( map( to_dauphin_runtime_type, [t for t in self._pipeline.all_runtime_types() if t.name], ) ), key=lambda config_type: config_type.name, ) def resolve_runs(self, graphene_info): return [ graphene_info.schema.type_named('PipelineRun')(r) for r in graphene_info.context.pipeline_runs.all_runs_for_pipeline(self._pipeline.name) ] def get_dagster_pipeline(self): return self._pipeline def get_type(self, _graphene_info, typeName): if self._pipeline.has_config_type(typeName): return to_dauphin_config_type(self._pipeline.config_type_named(typeName)) elif self._pipeline.has_runtime_type(typeName): return to_dauphin_runtime_type(self._pipeline.runtime_type_named(typeName)) else: check.failed('Not a config type or runtime type')
class DauphinPipelineConfigValidationInvalid(dauphin.ObjectType): class Meta: name = 'PipelineConfigValidationInvalid' pipeline = dauphin.Field(dauphin.NonNull('Pipeline')) errors = dauphin.non_null_list('PipelineConfigValidationError')
class DauphinStartSubplanExecutionInvalidStepsError(dauphin.ObjectType): class Meta: name = 'StartSubplanExecutionInvalidStepsError' invalid_step_keys = dauphin.Field(dauphin.non_null_list(dauphin.String))
class DaupinPipelineRunLogsSubscriptionPayload(dauphin.ObjectType): class Meta: name = 'PipelineRunLogsSubscriptionPayload' messages = dauphin.non_null_list('PipelineRunEvent')
class Arguments: pipelineName = dauphin.NonNull(dauphin.String) config = dauphin.Argument('PipelineConfig') stepExecutions = dauphin.non_null_list(DauphinStepExecution) executionMetadata = dauphin.Argument(dauphin.NonNull(DauphinExecutionMetadata))
class DauphinQuery(dauphin.ObjectType): class Meta: name = 'Query' version = dauphin.NonNull(dauphin.String) pipelineOrError = dauphin.Field( dauphin.NonNull('PipelineOrError'), params=dauphin.NonNull('ExecutionSelector') ) pipeline = dauphin.Field( dauphin.NonNull('Pipeline'), params=dauphin.NonNull('ExecutionSelector') ) pipelinesOrError = dauphin.NonNull('PipelinesOrError') pipelines = dauphin.Field(dauphin.NonNull('PipelineConnection')) configTypeOrError = dauphin.Field( dauphin.NonNull('ConfigTypeOrError'), pipelineName=dauphin.Argument(dauphin.NonNull(dauphin.String)), configTypeName=dauphin.Argument(dauphin.NonNull(dauphin.String)), ) runtimeTypeOrError = dauphin.Field( dauphin.NonNull('RuntimeTypeOrError'), pipelineName=dauphin.Argument(dauphin.NonNull(dauphin.String)), runtimeTypeName=dauphin.Argument(dauphin.NonNull(dauphin.String)), ) pipelineRuns = dauphin.non_null_list('PipelineRun') pipelineRun = dauphin.Field('PipelineRun', runId=dauphin.NonNull(dauphin.ID)) isPipelineConfigValid = dauphin.Field( dauphin.NonNull('PipelineConfigValidationResult'), args={ 'pipeline': dauphin.Argument(dauphin.NonNull('ExecutionSelector')), 'config': dauphin.Argument('PipelineConfig'), }, ) executionPlan = dauphin.Field( dauphin.NonNull('ExecutionPlanResult'), args={ 'pipeline': dauphin.Argument(dauphin.NonNull('ExecutionSelector')), 'config': dauphin.Argument('PipelineConfig'), }, ) def resolve_configTypeOrError(self, info, **kwargs): return model.get_config_type(info, kwargs['pipelineName'], kwargs['configTypeName']) def resolve_runtimeTypeOrError(self, info, **kwargs): return model.get_runtime_type(info, kwargs['pipelineName'], kwargs['runtimeTypeName']) def resolve_version(self, _info): return __version__ def resolve_pipelineOrError(self, info, **kwargs): return model.get_pipeline(info, kwargs['params'].to_selector()) def resolve_pipeline(self, info, **kwargs): return model.get_pipeline_or_raise(info, kwargs['params'].to_selector()) def resolve_pipelinesOrError(self, info): return model.get_pipelines(info) def resolve_pipelines(self, info): return model.get_pipelines_or_raise(info) def resolve_type(self, info, pipelineName, typeName): return model.get_pipeline_type(info, pipelineName, typeName) def resolve_pipelineRuns(self, info): return model.get_runs(info) def resolve_pipelineRun(self, info, runId): return model.get_run(info, runId) def resolve_isPipelineConfigValid(self, info, pipeline, config): return model.validate_pipeline_config(info, pipeline.to_selector(), config) def resolve_executionPlan(self, info, pipeline, config): return model.get_execution_plan(info, pipeline.to_selector(), config)
class DauphinError(dauphin.Interface): class Meta: name = 'Error' message = dauphin.String(required=True) stack = dauphin.non_null_list(dauphin.String)