Esempio n. 1
0
def ui(text, file, predefined, variables, remote, output, ephemeral_instance,
       **kwargs):
    query = None
    if text is not None and file is None and predefined is None:
        query = text.strip("'\" \n\t")
    elif file is not None and text is None and predefined is None:
        query = file.read()
    elif predefined is not None and text is None and file is None:
        query = PREDEFINED_QUERIES[predefined]
    else:
        raise click.UsageError(
            "Must select one and only one of text (-t), file (-f), or predefined (-p) "
            "to select GraphQL document to execute.")

    if remote:
        res = execute_query_against_remote(remote, query, variables)
        print(res)  # pylint: disable=print-call
    else:
        instance = DagsterInstance.ephemeral(
        ) if ephemeral_instance else DagsterInstance.get()
        with get_workspace_process_context_from_kwargs(
                instance, version=__version__, read_only=False,
                kwargs=kwargs) as workspace_process_context:
            execute_query_from_cli(
                workspace_process_context,
                query,
                variables,
                output,
            )
Esempio n. 2
0
def empty_app(instance):
    process_context = get_workspace_process_context_from_kwargs(
        instance=instance,
        version=__version__,
        read_only=False,
        kwargs={"empty_workspace": True},
    )
    return DagitWebserver(process_context).create_asgi_app(debug=True)
Esempio n. 3
0
def default_app():
    instance = DagsterInstance.get()
    process_context = get_workspace_process_context_from_kwargs(
        instance=instance,
        version=__version__,
        read_only=False,
        kwargs={},
    )
    return create_app(process_context, app_path_prefix="", debug=True)
Esempio n. 4
0
def default_app(debug=False):
    instance = DagsterInstance.get()
    process_context = get_workspace_process_context_from_kwargs(
        instance=instance,
        version=__version__,
        read_only=False,
        kwargs={},
    )

    return DagitWebserver(process_context, ).create_asgi_app(debug=debug)
Esempio n. 5
0
def empty_app(instance):
    process_context = get_workspace_process_context_from_kwargs(
        instance=instance,
        version=__version__,
        read_only=False,
        kwargs={"empty_workspace": True},
    )
    return create_app(
        process_context,
        debug=True,
        app_path_prefix="",
    )