Differential D4742 Diff 24115 python_modules/dagster-graphql/dagster_graphql_tests/graphql/test_run_cancellation.py
Changeset View
Changeset View
Standalone View
Standalone View
python_modules/dagster-graphql/dagster_graphql_tests/graphql/test_run_cancellation.py
import os | import os | ||||
import time | import time | ||||
from dagster_graphql.client.query import LAUNCH_PIPELINE_EXECUTION_MUTATION | from dagster_graphql.client.query import LAUNCH_PIPELINE_EXECUTION_MUTATION | ||||
from dagster_graphql.test.utils import execute_dagster_graphql, infer_pipeline_selector | from dagster_graphql.test.utils import execute_dagster_graphql, infer_pipeline_selector | ||||
from dagster import execute_pipeline | from dagster import execute_pipeline | ||||
from dagster.core.host_representation.handle import IN_PROCESS_NAME | |||||
from dagster.utils import safe_tempfile_path | from dagster.utils import safe_tempfile_path | ||||
from .graphql_context_test_suite import GraphQLContextVariant, make_graphql_context_test_suite | from .graphql_context_test_suite import GraphQLContextVariant, make_graphql_context_test_suite | ||||
from .setup import main_repo_location_name | |||||
RUN_CANCELLATION_QUERY = """ | RUN_CANCELLATION_QUERY = """ | ||||
mutation($runId: String!) { | mutation($runId: String!) { | ||||
terminatePipelineExecution(runId: $runId){ | terminatePipelineExecution(runId: $runId){ | ||||
__typename | __typename | ||||
... on TerminatePipelineExecutionSuccess{ | ... on TerminatePipelineExecutionSuccess{ | ||||
run { | run { | ||||
runId | runId | ||||
▲ Show 20 Lines • Show All 112 Lines • ▼ Show 20 Lines | def test_terminate_failed(self, graphql_context): | ||||
assert ( | assert ( | ||||
result.data["terminatePipelineExecution"]["__typename"] | result.data["terminatePipelineExecution"]["__typename"] | ||||
== "TerminatePipelineExecutionSuccess" | == "TerminatePipelineExecutionSuccess" | ||||
) | ) | ||||
def test_run_finished(self, graphql_context): | def test_run_finished(self, graphql_context): | ||||
instance = graphql_context.instance | instance = graphql_context.instance | ||||
pipeline = graphql_context.get_repository_location( | pipeline = graphql_context.get_repository_location( | ||||
main_repo_location_name() | IN_PROCESS_NAME | ||||
).get_reconstructable_pipeline("noop_pipeline") | ).get_reconstructable_pipeline("noop_pipeline") | ||||
pipeline_result = execute_pipeline(pipeline, instance=instance) | pipeline_result = execute_pipeline(pipeline, instance=instance) | ||||
assert pipeline_result.success | assert pipeline_result.success | ||||
assert pipeline_result.run_id | assert pipeline_result.run_id | ||||
time.sleep(0.05) # guarantee execution finish | time.sleep(0.05) # guarantee execution finish | ||||
Show All 12 Lines |