Skip to content
Permalink
Browse files

Expose CompositeSolid in GraphQL

Summary: See `schema.graphql` changes

Test Plan:
Query
{P5}

Response
{P4}

Reviewers: bengotow, schrockn

Reviewed By: schrockn

Differential Revision: https://dagster.phacility.com/D79
  • Loading branch information...
alangenfeld committed May 10, 2019
1 parent 4517e85 commit 9ec84107156e9967d011b9c42501d55011cd325c
Showing with 1,442 additions and 470 deletions.
  1. +63 −0 examples/toys/toys/composition.py
  2. +2 −0 examples/toys/toys/repo.py
  3. +11 −7 js_modules/dagit/src/SidebarSolidInfo.tsx
  4. +20 −7 js_modules/dagit/src/execute/types/SolidSelectorQuery.ts
  5. +1 −1 js_modules/dagit/src/filteredSchema.generated.json
  6. +12 −5 js_modules/dagit/src/graph/SolidNode.tsx
  7. +20 −7 js_modules/dagit/src/graph/types/PipelineGraphFragment.ts
  8. +20 −7 js_modules/dagit/src/graph/types/PipelineGraphSolidFragment.ts
  9. +20 −7 js_modules/dagit/src/graph/types/SolidNodeFragment.ts
  10. +45 −5 js_modules/dagit/src/schema.graphql
  11. +20 −7 js_modules/dagit/src/types/PipelineExplorerFragment.ts
  12. +51 −37 js_modules/dagit/src/types/PipelineExplorerRootQuery.ts
  13. +51 −37 js_modules/dagit/src/types/PipelineExplorerSolidFragment.ts
  14. +51 −37 js_modules/dagit/src/types/SidebarSolidInfoFragment.ts
  15. +51 −37 js_modules/dagit/src/types/SidebarTabbedContainerSolidFragment.ts
  16. +3 −2 python_modules/Makefile
  17. +1 −1 python_modules/dagster-airflow/dagster_airflow/query.py
  18. +4 −4 python_modules/dagster-airflow/dagster_airflow_tests/test_factory.py
  19. +2 −2 python_modules/dagster-graphql/dagster_graphql/schema/execution.py
  20. +10 −235 python_modules/dagster-graphql/dagster_graphql/schema/pipelines.py
  21. +391 −0 python_modules/dagster-graphql/dagster_graphql/schema/solids.py
  22. +1 −1 python_modules/dagster-graphql/dagster_graphql_tests/graphql/execution_queries.py
  23. +5 −3 python_modules/dagster-graphql/dagster_graphql_tests/graphql/production_query.py
  24. +53 −0 python_modules/dagster-graphql/dagster_graphql_tests/graphql/setup.py
  25. +431 −0 python_modules/dagster-graphql/dagster_graphql_tests/graphql/snapshots/snap_test_composites.py
  26. +1 −1 python_modules/dagster-graphql/dagster_graphql_tests/graphql/snapshots/snap_test_execution_plan.py
  27. +2 −2 python_modules/dagster-graphql/dagster_graphql_tests/graphql/snapshots/snap_test_expectations.py
  28. +84 −0 python_modules/dagster-graphql/dagster_graphql_tests/graphql/test_composites.py
  29. +1 −1 python_modules/dagster-graphql/dagster_graphql_tests/graphql/test_execution_plan.py
  30. +1 −1 python_modules/dagster-graphql/dagster_graphql_tests/graphql/test_expectations.py
  31. +6 −4 python_modules/dagster-graphql/dagster_graphql_tests/graphql/test_misc.py
  32. +1 −1 python_modules/dagster/dagster/core/definitions/__init__.py
  33. +7 −11 python_modules/dagster/dagster/core/definitions/solid.py
@@ -0,0 +1,63 @@
from dagster import (
PipelineDefinition,
CompositeSolidDefinition,
lambda_solid,
Int,
InputDefinition,
SolidInstance,
DependencyDefinition,
OutputDefinition,
Float,
)


@lambda_solid(inputs=[InputDefinition('num', Int)])
def add_one(num):
return num + 1


@lambda_solid(inputs=[InputDefinition('num')])
def div_two(num):
return num / 2


add_two = CompositeSolidDefinition(
'add_two',
solids=[add_one],
dependencies={
SolidInstance('add_one', 'adder_1'): {},
SolidInstance('add_one', 'adder_2'): {'num': DependencyDefinition('adder_1')},
},
input_mappings=[InputDefinition('num', Int).mapping_to('adder_1', 'num')],
output_mappings=[OutputDefinition(Int).mapping_from('adder_2')],
)

add_four = CompositeSolidDefinition(
'add_four',
solids=[add_two],
dependencies={
SolidInstance('add_two', 'adder_1'): {},
SolidInstance('add_two', 'adder_2'): {'num': DependencyDefinition('adder_1')},
},
input_mappings=[InputDefinition('num', Int).mapping_to('adder_1', 'num')],
output_mappings=[OutputDefinition(Int).mapping_from('adder_2')],
)

div_four = CompositeSolidDefinition(
'div_four',
solids=[div_two],
dependencies={
SolidInstance('div_two', 'div_1'): {},
SolidInstance('div_two', 'div_2'): {'num': DependencyDefinition('div_1')},
},
input_mappings=[InputDefinition('num', Int).mapping_to('div_1', 'num')],
output_mappings=[OutputDefinition(Float).mapping_from('div_2')],
)


def define_composition_pipeline():
return PipelineDefinition(
name='composition',
solids=[add_four, div_four],
dependencies={'div_four': {'num': DependencyDefinition('add_four')}},
)
@@ -4,6 +4,7 @@
from toys.sleepy import define_sleepy_pipeline
from toys.log_spew import define_spew_pipeline
from toys.many_events import define_many_events_pipeline
from toys.composition import define_composition_pipeline


def define_repo(repo_config=None):
@@ -14,6 +15,7 @@ def define_repo(repo_config=None):
'error_monster': define_error_monster_pipeline,
'log_spew': define_spew_pipeline,
'many_events': define_many_events_pipeline,
'composition': define_composition_pipeline,
},
repo_config=repo_config,
)
@@ -38,9 +38,11 @@ export default class SidebarSolidInfo extends React.Component<
key
value
}
configDefinition {
configType {
...ConfigTypeSchemaFragment
... on SolidDefinition {
configDefinition {
configType {
...ConfigTypeSchemaFragment
}
}
}
}
@@ -153,6 +155,10 @@ export default class SidebarSolidInfo extends React.Component<
public render() {
const { solid } = this.props;
const Plugin = pluginForMetadata(solid.definition.metadata);
const configDefinition =
solid.definition.__typename == "SolidDefinition"
? solid.definition.configDefinition
: null;

return (
<div>
@@ -167,11 +173,9 @@ export default class SidebarSolidInfo extends React.Component<
<Plugin.SidebarComponent solid={solid} />
)}
</SidebarSection>
{solid.definition.configDefinition && (
{configDefinition && (
<SidebarSection title={"Config"}>
<ConfigTypeSchema
type={solid.definition.configDefinition.configType}
/>
<ConfigTypeSchema type={configDefinition.configType} />
</SidebarSection>
)}
<SidebarSection title={"Inputs"}>{this.renderInputs()}</SidebarSection>
@@ -7,29 +7,42 @@
// GraphQL query operation: SolidSelectorQuery
// ====================================================

export interface SolidSelectorQuery_pipeline_solids_definition_metadata {
export interface SolidSelectorQuery_pipeline_solids_definition_CompositeSolidDefinition_metadata {
__typename: "MetadataItemDefinition";
key: string;
value: string;
}

export interface SolidSelectorQuery_pipeline_solids_definition_configDefinition_configType {
export interface SolidSelectorQuery_pipeline_solids_definition_CompositeSolidDefinition {
__typename: "CompositeSolidDefinition";
metadata: SolidSelectorQuery_pipeline_solids_definition_CompositeSolidDefinition_metadata[];
}

export interface SolidSelectorQuery_pipeline_solids_definition_SolidDefinition_metadata {
__typename: "MetadataItemDefinition";
key: string;
value: string;
}

export interface SolidSelectorQuery_pipeline_solids_definition_SolidDefinition_configDefinition_configType {
__typename: "EnumConfigType" | "CompositeConfigType" | "RegularConfigType" | "ListConfigType" | "NullableConfigType";
name: string | null;
description: string | null;
}

export interface SolidSelectorQuery_pipeline_solids_definition_configDefinition {
export interface SolidSelectorQuery_pipeline_solids_definition_SolidDefinition_configDefinition {
__typename: "ConfigTypeField";
configType: SolidSelectorQuery_pipeline_solids_definition_configDefinition_configType;
configType: SolidSelectorQuery_pipeline_solids_definition_SolidDefinition_configDefinition_configType;
}

export interface SolidSelectorQuery_pipeline_solids_definition {
export interface SolidSelectorQuery_pipeline_solids_definition_SolidDefinition {
__typename: "SolidDefinition";
metadata: SolidSelectorQuery_pipeline_solids_definition_metadata[];
configDefinition: SolidSelectorQuery_pipeline_solids_definition_configDefinition | null;
metadata: SolidSelectorQuery_pipeline_solids_definition_SolidDefinition_metadata[];
configDefinition: SolidSelectorQuery_pipeline_solids_definition_SolidDefinition_configDefinition | null;
}

export type SolidSelectorQuery_pipeline_solids_definition = SolidSelectorQuery_pipeline_solids_definition_CompositeSolidDefinition | SolidSelectorQuery_pipeline_solids_definition_SolidDefinition;

export interface SolidSelectorQuery_pipeline_solids_inputs_definition_type {
__typename: "RegularRuntimeType" | "ListRuntimeType" | "NullableRuntimeType";
displayName: string;

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -41,10 +41,12 @@ export default class SolidNode extends React.Component<ISolidNodeProps> {
key
value
}
configDefinition {
configType {
name
description
... on SolidDefinition {
configDefinition {
configType {
name
description
}
}
}
}
@@ -270,9 +272,14 @@ export default class SolidNode extends React.Component<ISolidNodeProps> {

public render() {
const { solid, layout, dim, selected, minified } = this.props;
const { configDefinition, metadata } = solid.definition;
const { metadata } = solid.definition;
const { x, y, width, height } = layout.solid;

let configDefinition = null;
if (solid.definition.__typename === "SolidDefinition") {
configDefinition = solid.definition.configDefinition;
}

const kind = metadata.find(m => m.key === "kind");

return (
@@ -7,29 +7,42 @@
// GraphQL fragment: PipelineGraphFragment
// ====================================================

export interface PipelineGraphFragment_solids_definition_metadata {
export interface PipelineGraphFragment_solids_definition_CompositeSolidDefinition_metadata {
__typename: "MetadataItemDefinition";
key: string;
value: string;
}

export interface PipelineGraphFragment_solids_definition_configDefinition_configType {
export interface PipelineGraphFragment_solids_definition_CompositeSolidDefinition {
__typename: "CompositeSolidDefinition";
metadata: PipelineGraphFragment_solids_definition_CompositeSolidDefinition_metadata[];
}

export interface PipelineGraphFragment_solids_definition_SolidDefinition_metadata {
__typename: "MetadataItemDefinition";
key: string;
value: string;
}

export interface PipelineGraphFragment_solids_definition_SolidDefinition_configDefinition_configType {
__typename: "EnumConfigType" | "CompositeConfigType" | "RegularConfigType" | "ListConfigType" | "NullableConfigType";
name: string | null;
description: string | null;
}

export interface PipelineGraphFragment_solids_definition_configDefinition {
export interface PipelineGraphFragment_solids_definition_SolidDefinition_configDefinition {
__typename: "ConfigTypeField";
configType: PipelineGraphFragment_solids_definition_configDefinition_configType;
configType: PipelineGraphFragment_solids_definition_SolidDefinition_configDefinition_configType;
}

export interface PipelineGraphFragment_solids_definition {
export interface PipelineGraphFragment_solids_definition_SolidDefinition {
__typename: "SolidDefinition";
metadata: PipelineGraphFragment_solids_definition_metadata[];
configDefinition: PipelineGraphFragment_solids_definition_configDefinition | null;
metadata: PipelineGraphFragment_solids_definition_SolidDefinition_metadata[];
configDefinition: PipelineGraphFragment_solids_definition_SolidDefinition_configDefinition | null;
}

export type PipelineGraphFragment_solids_definition = PipelineGraphFragment_solids_definition_CompositeSolidDefinition | PipelineGraphFragment_solids_definition_SolidDefinition;

export interface PipelineGraphFragment_solids_inputs_definition_type {
__typename: "RegularRuntimeType" | "ListRuntimeType" | "NullableRuntimeType";
displayName: string;
@@ -7,29 +7,42 @@
// GraphQL fragment: PipelineGraphSolidFragment
// ====================================================

export interface PipelineGraphSolidFragment_definition_metadata {
export interface PipelineGraphSolidFragment_definition_CompositeSolidDefinition_metadata {
__typename: "MetadataItemDefinition";
key: string;
value: string;
}

export interface PipelineGraphSolidFragment_definition_configDefinition_configType {
export interface PipelineGraphSolidFragment_definition_CompositeSolidDefinition {
__typename: "CompositeSolidDefinition";
metadata: PipelineGraphSolidFragment_definition_CompositeSolidDefinition_metadata[];
}

export interface PipelineGraphSolidFragment_definition_SolidDefinition_metadata {
__typename: "MetadataItemDefinition";
key: string;
value: string;
}

export interface PipelineGraphSolidFragment_definition_SolidDefinition_configDefinition_configType {
__typename: "EnumConfigType" | "CompositeConfigType" | "RegularConfigType" | "ListConfigType" | "NullableConfigType";
name: string | null;
description: string | null;
}

export interface PipelineGraphSolidFragment_definition_configDefinition {
export interface PipelineGraphSolidFragment_definition_SolidDefinition_configDefinition {
__typename: "ConfigTypeField";
configType: PipelineGraphSolidFragment_definition_configDefinition_configType;
configType: PipelineGraphSolidFragment_definition_SolidDefinition_configDefinition_configType;
}

export interface PipelineGraphSolidFragment_definition {
export interface PipelineGraphSolidFragment_definition_SolidDefinition {
__typename: "SolidDefinition";
metadata: PipelineGraphSolidFragment_definition_metadata[];
configDefinition: PipelineGraphSolidFragment_definition_configDefinition | null;
metadata: PipelineGraphSolidFragment_definition_SolidDefinition_metadata[];
configDefinition: PipelineGraphSolidFragment_definition_SolidDefinition_configDefinition | null;
}

export type PipelineGraphSolidFragment_definition = PipelineGraphSolidFragment_definition_CompositeSolidDefinition | PipelineGraphSolidFragment_definition_SolidDefinition;

export interface PipelineGraphSolidFragment_inputs_definition_type {
__typename: "RegularRuntimeType" | "ListRuntimeType" | "NullableRuntimeType";
displayName: string;
@@ -7,29 +7,42 @@
// GraphQL fragment: SolidNodeFragment
// ====================================================

export interface SolidNodeFragment_definition_metadata {
export interface SolidNodeFragment_definition_CompositeSolidDefinition_metadata {
__typename: "MetadataItemDefinition";
key: string;
value: string;
}

export interface SolidNodeFragment_definition_configDefinition_configType {
export interface SolidNodeFragment_definition_CompositeSolidDefinition {
__typename: "CompositeSolidDefinition";
metadata: SolidNodeFragment_definition_CompositeSolidDefinition_metadata[];
}

export interface SolidNodeFragment_definition_SolidDefinition_metadata {
__typename: "MetadataItemDefinition";
key: string;
value: string;
}

export interface SolidNodeFragment_definition_SolidDefinition_configDefinition_configType {
__typename: "EnumConfigType" | "CompositeConfigType" | "RegularConfigType" | "ListConfigType" | "NullableConfigType";
name: string | null;
description: string | null;
}

export interface SolidNodeFragment_definition_configDefinition {
export interface SolidNodeFragment_definition_SolidDefinition_configDefinition {
__typename: "ConfigTypeField";
configType: SolidNodeFragment_definition_configDefinition_configType;
configType: SolidNodeFragment_definition_SolidDefinition_configDefinition_configType;
}

export interface SolidNodeFragment_definition {
export interface SolidNodeFragment_definition_SolidDefinition {
__typename: "SolidDefinition";
metadata: SolidNodeFragment_definition_metadata[];
configDefinition: SolidNodeFragment_definition_configDefinition | null;
metadata: SolidNodeFragment_definition_SolidDefinition_metadata[];
configDefinition: SolidNodeFragment_definition_SolidDefinition_configDefinition | null;
}

export type SolidNodeFragment_definition = SolidNodeFragment_definition_CompositeSolidDefinition | SolidNodeFragment_definition_SolidDefinition;

export interface SolidNodeFragment_inputs_definition_type {
__typename: "RegularRuntimeType" | "ListRuntimeType" | "NullableRuntimeType";
displayName: string;
Oops, something went wrong.

0 comments on commit 9ec8410

Please sign in to comment.
You can’t perform that action at this time.