Skip to content

Commit 656eb7d

Browse files
committed
Added (temporal) simple way to use the experimental executor
1 parent 754adb9 commit 656eb7d

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

graphql/execution/executor.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
collect_fields, default_resolve_fn, get_field_def,
1717
get_operation_root_type)
1818
from .executors.sync import SyncExecutor
19+
from .experimental.executor import execute as experimental_execute
1920
from .middleware import MiddlewareManager
2021

2122
logger = logging.getLogger(__name__)
@@ -25,9 +26,19 @@ def is_promise(obj):
2526
return type(obj) == Promise
2627

2728

29+
use_experimental_executor = False
30+
31+
2832
def execute(schema, document_ast, root_value=None, context_value=None,
2933
variable_values=None, operation_name=None, executor=None,
3034
return_promise=False, middleware=None):
35+
if use_experimental_executor:
36+
return experimental_execute(
37+
schema, document_ast, root_value, context_value,
38+
variable_values, operation_name, executor,
39+
return_promise, middleware
40+
)
41+
3142
assert schema, 'Must provide schema'
3243
assert isinstance(schema, GraphQLSchema), (
3344
'Schema must be an instance of GraphQLSchema. Also ensure that there are ' +

graphql/execution/experimental/executor.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@
1111
logger = logging.getLogger(__name__)
1212

1313

14-
def is_promise(obj):
15-
return isinstance(obj, Promise)
16-
17-
1814
def execute(schema, document_ast, root_value=None, context_value=None,
1915
variable_values=None, operation_name=None, executor=None,
2016
return_promise=False, middleware=None):

graphql/execution/experimental/fragment.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@
88
from ...type import (GraphQLInterfaceType, GraphQLList, GraphQLNonNull,
99
GraphQLObjectType, GraphQLUnionType)
1010
from ..base import ResolveInfo, Undefined, collect_fields, get_field_def
11-
from ..executor import is_promise
1211
from ..values import get_argument_values
1312

1413

14+
def is_promise(obj):
15+
return isinstance(obj, Promise)
16+
17+
1518
def get_base_type(type):
1619
if isinstance(type, (GraphQLList, GraphQLNonNull)):
1720
return get_base_type(type.of_type)

0 commit comments

Comments
 (0)