def test_get_partition_sets_for_pipeline(self, graphql_context, snapshot): selector = infer_repository_selector(graphql_context) result = execute_dagster_graphql( graphql_context, GET_PARTITION_SETS_FOR_PIPELINE_QUERY, variables={ 'repositorySelector': selector, 'pipelineName': 'no_config_pipeline' }, ) assert result.data snapshot.assert_match(result.data) invalid_pipeline_result = execute_dagster_graphql( graphql_context, GET_PARTITION_SETS_FOR_PIPELINE_QUERY, variables={ 'repositorySelector': selector, 'pipelineName': 'invalid_pipeline' }, ) assert invalid_pipeline_result.data snapshot.assert_match(invalid_pipeline_result.data)
def test_get_schedule_states_for_repository_after_reconcile_using_mutation( graphql_context): selector = infer_repository_selector(graphql_context) external_repository = graphql_context.get_repository_location( main_repo_location_name()).get_repository(main_repo_name()) result = execute_dagster_graphql( graphql_context, RECONCILE_SCHEDULER_STATE_QUERY, variables={"repositorySelector": selector}, ) assert result.data assert result.data["reconcileSchedulerState"] assert result.data["reconcileSchedulerState"]["message"] == "Success" result = execute_dagster_graphql( graphql_context, GET_SCHEDULE_STATES_QUERY, variables={"repositorySelector": selector}, ) assert result.data assert result.data["scheduleStatesOrError"] assert result.data["scheduleStatesOrError"][ "__typename"] == "ScheduleStates" results = result.data["scheduleStatesOrError"]["results"] assert len(results) == len(external_repository.get_external_schedules()) for schedule_state in results: assert schedule_state["status"] == ScheduleStatus.STOPPED.value
def test_query_all_solids(graphql_context, snapshot): selector = infer_repository_selector(graphql_context) result = execute_dagster_graphql( graphql_context, all_solids_query(), variables={"repositorySelector": selector}) snapshot.assert_match(result.data)
def test_schedule_next_tick(self, graphql_context): repository_selector = infer_repository_selector(graphql_context) external_repository = graphql_context.get_repository_location( repository_selector["repositoryLocationName"]).get_repository( repository_selector["repositoryName"]) graphql_context.instance.reconcile_scheduler_state(external_repository) schedule_name = "no_config_pipeline_hourly_schedule" external_schedule = external_repository.get_external_schedule( schedule_name) selector = infer_instigation_selector(graphql_context, schedule_name) # need to be running in order to generate a future tick graphql_context.instance.start_schedule_and_update_storage_state( external_schedule) result = execute_dagster_graphql( graphql_context, INSTIGATION_QUERY, variables={"instigationSelector": selector}) assert result.data assert result.data["instigationStateOrError"][ "__typename"] == "InstigationState" next_tick = result.data["instigationStateOrError"]["nextTick"] assert next_tick
def test_get_partition_set(self, graphql_context, snapshot): selector = infer_repository_selector(graphql_context) result = execute_dagster_graphql( graphql_context, GET_PARTITION_SET_QUERY, variables={ 'partitionSetName': 'integer_partition', 'repositorySelector': selector }, ) assert result.data snapshot.assert_match(result.data) invalid_partition_set_result = execute_dagster_graphql( graphql_context, GET_PARTITION_SET_QUERY, variables={ 'partitionSetName': 'invalid_partition', 'repositorySelector': selector }, ) print(invalid_partition_set_result.data) assert (invalid_partition_set_result.data['partitionSetOrError'] ['__typename'] == 'PartitionSetNotFoundError') assert invalid_partition_set_result.data snapshot.assert_match(invalid_partition_set_result.data)
def test_repository_batching(): with instance_for_test() as instance: repo = get_repo_at_time_1() foo_pipeline = repo.get_pipeline("foo_pipeline") evolving_pipeline = repo.get_pipeline("evolving_pipeline") foo_run_ids = [execute_pipeline(foo_pipeline, instance=instance).run_id for i in range(3)] evolving_run_ids = [ execute_pipeline(evolving_pipeline, instance=instance).run_id for i in range(2) ] with define_out_of_process_context(__file__, "get_repo_at_time_1", instance) as context: traced_counter.set(Counter()) result = execute_dagster_graphql( context, REPOSITORY_RUNS_QUERY, variables={"repositorySelector": infer_repository_selector(context)}, ) assert result.data assert "repositoryOrError" in result.data assert "pipelines" in result.data["repositoryOrError"] pipelines = result.data["repositoryOrError"]["pipelines"] assert len(pipelines) == 2 pipeline_runs = {pipeline["name"]: pipeline["runs"] for pipeline in pipelines} assert len(pipeline_runs["foo_pipeline"]) == 3 assert len(pipeline_runs["evolving_pipeline"]) == 2 assert set(foo_run_ids) == set(run["runId"] for run in pipeline_runs["foo_pipeline"]) assert set(evolving_run_ids) == set( run["runId"] for run in pipeline_runs["evolving_pipeline"] ) counter = traced_counter.get() counts = counter.counts() assert counts assert len(counts) == 1 # We should have a single batch call to fetch run records, instead of 3 separate calls # to fetch run records (which is fetched to instantiate GrapheneRun) assert counts.get("DagsterInstance.get_run_records") == 1
def test_get_partition_tags(self, graphql_context): selector = infer_repository_selector(graphql_context) result = execute_dagster_graphql( graphql_context, GET_PARTITION_SET_TAGS_QUERY, variables={ "partitionSetName": "integer_partition", "repositorySelector": selector }, ) assert not result.errors assert result.data partitions = result.data["partitionSetOrError"]["partitionsOrError"][ "results"] assert len(partitions) == 1 sorted_items = sorted(partitions[0]["tagsOrError"]["results"], key=lambda item: item["key"]) tags = OrderedDict( {item["key"]: item["value"] for item in sorted_items}) assert tags == { "foo": "0", "dagster/partition": "0", "dagster/partition_set": "integer_partition", }
def test_get_schedule_definitions_for_repository(graphql_context): selector = infer_repository_selector(graphql_context) result = execute_dagster_graphql( graphql_context, GET_SCHEDULE_DEFINITIONS_QUERY, variables={'repositorySelector': selector}, ) assert result.data assert result.data['scheduleDefinitionsOrError'] assert result.data['scheduleDefinitionsOrError'][ '__typename'] == 'ScheduleDefinitions' external_repository = graphql_context.get_repository_location( main_repo_location_name()).get_repository(main_repo_name()) results = result.data['scheduleDefinitionsOrError']['results'] assert len(results) == len(external_repository.get_external_schedules()) for schedule in results: if schedule['name'] == 'run_config_error_schedule': assert schedule['runConfigOrError']['__typename'] == 'PythonError' elif schedule['name'] == 'invalid_config_schedule': assert (schedule['runConfigOrError']['yaml'] == 'solids:\n takes_an_enum:\n config: invalid\n') else: assert schedule['runConfigOrError'][ 'yaml'] == 'storage:\n filesystem: {}\n'
def test_query_inputs_outputs(graphql_context, snapshot): selector = infer_repository_selector(graphql_context) result = execute_dagster_graphql( graphql_context, INPUT_OUTPUT_DEFINITIONS_QUERY, variables={"repositorySelector": selector} ) assert result.data snapshot.assert_match(result.data)
def test_get_partition_set(self, graphql_context, snapshot): selector = infer_repository_selector(graphql_context) result = execute_dagster_graphql( graphql_context, GET_PARTITION_SET_QUERY, variables={ "partitionSetName": "integer_partition", "repositorySelector": selector }, ) assert result.data snapshot.assert_match(result.data) invalid_partition_set_result = execute_dagster_graphql( graphql_context, GET_PARTITION_SET_QUERY, variables={ "partitionSetName": "invalid_partition", "repositorySelector": selector }, ) assert (invalid_partition_set_result.data["partitionSetOrError"] ["__typename"] == "PartitionSetNotFoundError") assert invalid_partition_set_result.data snapshot.assert_match(invalid_partition_set_result.data)
def test_sensor_next_tick(self, graphql_context): repository_selector = infer_repository_selector(graphql_context) external_repository = graphql_context.get_repository_location( repository_selector["repositoryLocationName"]).get_repository( repository_selector["repositoryName"]) graphql_context.instance.reconcile_scheduler_state(external_repository) sensor_name = "always_no_config_sensor" external_sensor = external_repository.get_external_sensor(sensor_name) selector = infer_instigation_selector(graphql_context, sensor_name) # need to be running and create a sensor tick in the last 30 seconds in order to generate a # future tick graphql_context.instance.start_sensor(external_sensor) _create_sensor_tick(graphql_context.instance) result = execute_dagster_graphql( graphql_context, INSTIGATION_QUERY, variables={"instigationSelector": selector}) assert result.data assert result.data["instigationStateOrError"][ "__typename"] == "InstigationState" next_tick = result.data["instigationStateOrError"]["nextTick"] assert next_tick
def test_asset_observations(self, graphql_context): _create_run(graphql_context, "observation_job") result = execute_dagster_graphql( graphql_context, GET_ASSET_OBSERVATIONS, variables={"repositorySelector": infer_repository_selector(graphql_context)}, ) assert result.data assert result.data["repositoryOrError"] and result.data["repositoryOrError"]["assetNodes"] asset_node = [ asset_node for asset_node in result.data["repositoryOrError"]["assetNodes"] if asset_node["opName"] == "asset_yields_observation" ][0] assert asset_node["assetObservations"] assert asset_node["assetObservations"][0]["runOrError"]["jobName"] == "observation_job" asset_key_path = asset_node["assetObservations"][0]["assetKey"]["path"] assert asset_key_path assert asset_key_path == ["asset_yields_observation"] metadata = asset_node["assetObservations"][0]["metadataEntries"] assert metadata assert metadata[0]["text"] == "FOO" assert asset_node["assetObservations"][0]["label"] == "asset_yields_observation"
def test_launch_full_pipeline_backfill(self, graphql_context): repository_selector = infer_repository_selector(graphql_context) result = execute_dagster_graphql( graphql_context, LAUNCH_PARTITION_BACKFILL_MUTATION, variables={ "backfillParams": { "selector": { "repositorySelector": repository_selector, "partitionSetName": "integer_partition", }, "partitionNames": ["2", "3"], } }, ) assert not result.errors assert result.data assert result.data["launchPartitionBackfill"][ "__typename"] == "PartitionBackfillSuccess" backfill_id = result.data["launchPartitionBackfill"]["backfillId"] result = execute_dagster_graphql(graphql_context, PARTITION_PROGRESS_QUERY, variables={"backfillId": backfill_id}) assert not result.errors assert result.data assert result.data["partitionBackfillOrError"][ "__typename"] == "PartitionBackfill" assert result.data["partitionBackfillOrError"]["status"] == "REQUESTED" assert result.data["partitionBackfillOrError"]["isPersisted"] assert result.data["partitionBackfillOrError"]["numRequested"] == 0 assert result.data["partitionBackfillOrError"]["numTotal"] == 2
def test_get_schedule_definitions_for_repository(graphql_context): selector = infer_repository_selector(graphql_context) result = execute_dagster_graphql( graphql_context, GET_SCHEDULE_DEFINITIONS_QUERY, variables={"repositorySelector": selector}, ) assert result.data assert result.data["scheduleDefinitionsOrError"] assert result.data["scheduleDefinitionsOrError"][ "__typename"] == "ScheduleDefinitions" external_repository = graphql_context.get_repository_location( main_repo_location_name()).get_repository(main_repo_name()) results = result.data["scheduleDefinitionsOrError"]["results"] assert len(results) == len(external_repository.get_external_schedules()) for schedule in results: if (schedule["name"] == "run_config_error_schedule" or schedule["name"] == "tags_error_schedule"): assert schedule["runConfigOrError"]["__typename"] == "PythonError" elif schedule["name"] == "invalid_config_schedule": assert (schedule["runConfigOrError"]["yaml"] == "solids:\n takes_an_enum:\n config: invalid\n") else: assert schedule["runConfigOrError"][ "yaml"] == "storage:\n filesystem: {}\n"
def test_repository_batching(graphql_context): instance = graphql_context.instance if not instance.supports_batch_tick_queries or not instance.supports_bucket_queries: pytest.skip("storage cannot batch fetch") traced_counter.set(Counter()) selector = infer_repository_selector(graphql_context) result = execute_dagster_graphql( graphql_context, REPOSITORY_SENSORS_QUERY, variables={"repositorySelector": selector}, ) assert result.data assert "repositoryOrError" in result.data assert "sensors" in result.data["repositoryOrError"] counter = traced_counter.get() counts = counter.counts() assert counts assert len(counts) == 3 # We should have a single batch call to fetch run records (to fetch sensor runs) and a single # batch call to fetch instigator state, instead of separate calls for each sensor (~5 distinct # sensors in the repo) # 1) `get_run_records` is fetched to instantiate GrapheneRun # 2) `all_instigator_state` is fetched to instantiate GrapheneSensor assert counts.get("DagsterInstance.get_run_records") == 1 assert counts.get("DagsterInstance.all_instigator_state") == 1 assert counts.get("DagsterInstance.get_batch_ticks") == 1
def test_launch_from_failure(self, graphql_context): repository_selector = infer_repository_selector(graphql_context) partition_set_selector = { "repositorySelector": repository_selector, "partitionSetName": "chained_integer_partition", } # trigger failure in the conditionally_fail solid with environ({"TEST_SOLID_SHOULD_FAIL": "YES"}): result = execute_dagster_graphql_and_finish_runs( graphql_context, LAUNCH_PARTITION_BACKFILL_MUTATION, variables={ "backfillParams": { "selector": partition_set_selector, "partitionNames": ["2", "3"], } }, ) assert not result.errors assert result.data assert result.data["launchPartitionBackfill"][ "__typename"] == "PartitionBackfillSuccess" assert len( result.data["launchPartitionBackfill"]["launchedRunIds"]) == 2 for run_id in result.data["launchPartitionBackfill"]["launchedRunIds"]: logs = get_all_logs_for_finished_run_via_subscription( graphql_context, run_id)["pipelineRunLogs"]["messages"] assert step_did_succeed(logs, "always_succeed.compute") assert step_did_fail(logs, "conditionally_fail.compute") assert step_did_skip(logs, "after_failure.compute") # re-execute from failure (without the failure environment variable) result = execute_dagster_graphql_and_finish_runs( graphql_context, LAUNCH_PARTITION_BACKFILL_MUTATION, variables={ "backfillParams": { "selector": partition_set_selector, "partitionNames": ["2", "3"], "fromFailure": True, } }, ) assert not result.errors assert result.data assert result.data["launchPartitionBackfill"][ "__typename"] == "PartitionBackfillSuccess" assert len( result.data["launchPartitionBackfill"]["launchedRunIds"]) == 2 for run_id in result.data["launchPartitionBackfill"]["launchedRunIds"]: logs = get_all_logs_for_finished_run_via_subscription( graphql_context, run_id)["pipelineRunLogs"]["messages"] assert step_did_not_run(logs, "always_succeed.compute") assert step_did_succeed(logs, "conditionally_fail.compute") assert step_did_succeed(logs, "after_failure.compute")
def test_launch_partial_backfill(self, graphql_context): # execute a full pipeline, without the failure environment variable repository_selector = infer_repository_selector(graphql_context) partition_set_selector = { "repositorySelector": repository_selector, "partitionSetName": "chained_integer_partition", } result = execute_dagster_graphql_and_finish_runs( graphql_context, LAUNCH_PARTITION_BACKFILL_MUTATION, variables={ "backfillParams": { "selector": partition_set_selector, "partitionNames": ["2", "3"], } }, ) assert not result.errors assert result.data assert result.data["launchPartitionBackfill"][ "__typename"] == "PartitionBackfillSuccess" assert len( result.data["launchPartitionBackfill"]["launchedRunIds"]) == 2 for run_id in result.data["launchPartitionBackfill"]["launchedRunIds"]: logs = get_all_logs_for_finished_run_via_subscription( graphql_context, run_id)["pipelineRunLogs"]["messages"] assert step_did_succeed(logs, "always_succeed") assert step_did_succeed(logs, "conditionally_fail") assert step_did_succeed(logs, "after_failure") # reexecute a partial pipeline partial_steps = ["after_failure"] result = execute_dagster_graphql_and_finish_runs( graphql_context, LAUNCH_PARTITION_BACKFILL_MUTATION, variables={ "backfillParams": { "selector": partition_set_selector, "partitionNames": ["2", "3"], "reexecutionSteps": partial_steps, } }, ) assert not result.errors assert result.data assert result.data["launchPartitionBackfill"][ "__typename"] == "PartitionBackfillSuccess" assert len( result.data["launchPartitionBackfill"]["launchedRunIds"]) == 2 for run_id in result.data["launchPartitionBackfill"]["launchedRunIds"]: logs = get_all_logs_for_finished_run_via_subscription( graphql_context, run_id)["pipelineRunLogs"]["messages"] assert step_did_not_run(logs, "always_succeed") assert step_did_not_run(logs, "conditionally_fail") assert step_did_succeed(logs, "after_failure")
def test_get_sensors(self, graphql_context, snapshot): selector = infer_repository_selector(graphql_context) result = execute_dagster_graphql( graphql_context, GET_SENSORS_QUERY, variables={"repositorySelector": selector}, ) assert result.data assert result.data["sensorsOrError"] assert result.data["sensorsOrError"]["__typename"] == "Sensors" results = result.data["sensorsOrError"]["results"] snapshot.assert_match(results)
def test_query_get_solid_exists(graphql_context): selector = infer_repository_selector(graphql_context) result = execute_dagster_graphql( graphql_context, get_solid_query_exists(), variables={"repositorySelector": selector}) assert not result.errors print(result.data["repositoryOrError"]) # pylint: disable=print-call assert result.data["repositoryOrError"]["usedSolid"]["definition"][ "name"] == "sum_solid"
def test_query_get_solid_exists(graphql_context): selector = infer_repository_selector(graphql_context) result = execute_dagster_graphql( graphql_context, get_solid_query_exists(), variables={'repositorySelector': selector}) assert not result.errors print(result.data['repositoryOrError']) # pylint: disable=print-call assert result.data['repositoryOrError']['usedSolid']['definition'][ 'name'] == 'sum_solid'
def test_basic_graphs(self, graphql_context, snapshot): selector = infer_repository_selector(graphql_context) selector.update({"graphName": "simple_graph"}) result = execute_dagster_graphql(graphql_context, GRAPH_QUERY, {"selector": selector}) assert result assert result.data assert result.data["graphOrError"]["__typename"] == "Graph" snapshot.assert_match(result.data)
def test_resume_backfill(self, graphql_context): repository_selector = infer_repository_selector(graphql_context) result = execute_dagster_graphql( graphql_context, LAUNCH_PARTITION_BACKFILL_MUTATION, variables={ "backfillParams": { "selector": { "repositorySelector": repository_selector, "partitionSetName": "integer_partition", }, "partitionNames": ["2", "3"], } }, ) assert not result.errors assert result.data assert result.data["launchPartitionBackfill"][ "__typename"] == "LaunchBackfillSuccess" backfill_id = result.data["launchPartitionBackfill"]["backfillId"] result = execute_dagster_graphql(graphql_context, PARTITION_PROGRESS_QUERY, variables={"backfillId": backfill_id}) assert not result.errors assert result.data assert result.data["partitionBackfillOrError"][ "__typename"] == "PartitionBackfill" assert result.data["partitionBackfillOrError"]["status"] == "REQUESTED" assert result.data["partitionBackfillOrError"]["numRequested"] == 0 assert result.data["partitionBackfillOrError"]["numTotal"] == 2 # manually mark as failed backfill = graphql_context.instance.get_backfill(backfill_id) graphql_context.instance.update_backfill( backfill.with_status(BulkActionStatus.FAILED)) result = execute_dagster_graphql(graphql_context, RESUME_BACKFILL_MUTATION, variables={"backfillId": backfill_id}) assert result.data assert result.data["resumePartitionBackfill"][ "__typename"] == "ResumeBackfillSuccess" result = execute_dagster_graphql(graphql_context, PARTITION_PROGRESS_QUERY, variables={"backfillId": backfill_id}) assert not result.errors assert result.data assert result.data["partitionBackfillOrError"][ "__typename"] == "PartitionBackfill" assert result.data["partitionBackfillOrError"]["status"] == "REQUESTED"
def test_get_schedule_states_for_repository(graphql_context): selector = infer_repository_selector(graphql_context) result = execute_dagster_graphql( graphql_context, GET_SCHEDULE_STATES_QUERY, variables={'repositorySelector': selector}, ) assert result.data assert result.data['scheduleStatesOrError'] assert result.data['scheduleStatesOrError']['__typename'] == 'ScheduleStates' # Since we haven't run reconcile yet, there should be no states in storage results = result.data['scheduleStatesOrError']['results'] assert len(results) == 0
def test_get_schedule_state_with_for_repository_not_reconciled(graphql_context): selector = infer_repository_selector(graphql_context) result = execute_dagster_graphql( graphql_context, GET_SCHEDULE_STATES_QUERY, variables={"repositorySelector": selector}, ) assert result.data assert result.data["scheduleStatesOrError"] assert result.data["scheduleStatesOrError"]["__typename"] == "ScheduleStates" # Since we haven't run reconcile yet, there should be no states in storage results = result.data["scheduleStatesOrError"]["results"] assert len(results) == 0
def test_op_assets(self, graphql_context, snapshot): _create_run(graphql_context, "two_assets_job") result = execute_dagster_graphql( graphql_context, GET_OP_ASSETS, variables={ "repositorySelector": infer_repository_selector(graphql_context), "opName": "asset_two", }, ) assert result.data snapshot.assert_match(result.data)
def test_get_schedule_states_for_repository_with_removed_schedule_definitions(graphql_context): selector = infer_repository_selector(graphql_context) external_repository = graphql_context.get_repository_location( main_repo_location_name() ).get_repository(main_repo_name()) graphql_context.instance.reconcile_scheduler_state(external_repository) result = execute_dagster_graphql( graphql_context, GET_SCHEDULE_STATES_WITHOUT_DEFINITIONS_QUERY, variables={"repositorySelector": selector}, ) assert result.data["scheduleStatesOrError"] assert result.data["scheduleStatesOrError"]["__typename"] == "ScheduleStates" results = result.data["scheduleStatesOrError"]["results"] assert len(results) == 0
def test_launch_full_pipeline_backfill(self, graphql_context): repository_selector = infer_repository_selector(graphql_context) result = execute_dagster_graphql( graphql_context, LAUNCH_PARTITION_BACKFILL_MUTATION, variables={ "backfillParams": { "selector": { "repositorySelector": repository_selector, "partitionSetName": "integer_partition", }, "partitionNames": ["2", "3"], } }, ) assert not result.errors assert result.data assert result.data["launchPartitionBackfill"]["__typename"] == "PartitionBackfillSuccess" assert len(result.data["launchPartitionBackfill"]["launchedRunIds"]) == 2
def test_get_partition_tags(self, graphql_context): selector = infer_repository_selector(graphql_context) result = execute_dagster_graphql( graphql_context, GET_PARTITION_SET_TAGS_QUERY, variables={'partitionSetName': 'integer_partition', 'repositorySelector': selector}, ) assert not result.errors assert result.data partitions = result.data['partitionSetOrError']['partitionsOrError']['results'] assert len(partitions) == 1 sorted_items = sorted(partitions[0]['tagsOrError']['results'], key=lambda item: item['key']) tags = OrderedDict({item['key']: item['value'] for item in sorted_items}) assert tags == { 'foo': '0', 'dagster/partition': '0', 'dagster/partition_set': 'integer_partition', }
def test_launch_partial_backfill(self, graphql_context): # execute a full pipeline, without the failure environment variable repository_selector = infer_repository_selector(graphql_context) partition_set_selector = { "repositorySelector": repository_selector, "partitionSetName": "chained_integer_partition", } # reexecute a partial pipeline partial_steps = ["after_failure"] result = execute_dagster_graphql_and_finish_runs( graphql_context, LAUNCH_PARTITION_BACKFILL_MUTATION, variables={ "backfillParams": { "selector": partition_set_selector, "partitionNames": ["2", "3"], "reexecutionSteps": partial_steps, } }, ) assert not result.errors assert result.data assert result.data["launchPartitionBackfill"][ "__typename"] == "PartitionBackfillSuccess" backfill_id = result.data["launchPartitionBackfill"]["backfillId"] result = execute_dagster_graphql(graphql_context, PARTITION_PROGRESS_QUERY, variables={"backfillId": backfill_id}) assert not result.errors assert result.data assert result.data["partitionBackfillOrError"][ "__typename"] == "PartitionBackfill" assert result.data["partitionBackfillOrError"]["status"] == "REQUESTED" assert result.data["partitionBackfillOrError"]["isPersisted"] assert result.data["partitionBackfillOrError"]["numRequested"] == 0 assert result.data["partitionBackfillOrError"]["numTotal"] == 2 assert result.data["partitionBackfillOrError"]["reexecutionSteps"] == [ "after_failure" ]
def test_get_partition_runs(self, graphql_context): repository_selector = infer_repository_selector(graphql_context) result = execute_dagster_graphql_and_finish_runs( graphql_context, LAUNCH_PARTITION_BACKFILL_MUTATION, variables={ "backfillParams": { "selector": { "repositorySelector": repository_selector, "partitionSetName": "integer_partition", }, "partitionNames": ["2", "3"], "forceSynchronousSubmission": True, } }, ) assert not result.errors assert result.data["launchPartitionBackfill"][ "__typename"] == "PartitionBackfillSuccess" assert len( result.data["launchPartitionBackfill"]["launchedRunIds"]) == 2 run_ids = result.data["launchPartitionBackfill"]["launchedRunIds"] result = execute_dagster_graphql( graphql_context, query=GET_PARTITION_SET_RUNS_QUERY, variables={ "partitionSetName": "integer_partition", "repositorySelector": repository_selector, }, ) assert not result.errors assert result.data partitions = result.data["partitionSetOrError"]["partitionsOrError"][ "results"] assert len(partitions) == 10 for partition in partitions: if partition["name"] not in ("2", "3"): assert len(partition["runs"]) == 0 else: assert len(partition["runs"]) == 1 assert partition["runs"][0]["runId"] in run_ids