https://dagster.io/ logo
#ask-community
Title
# ask-community
s

szalai1

07/30/2021, 5:40 PM
hey, getting an odd error, from a very simple pipeline
keyError: 'result'
Copy code
from dagster import AssetMaterialization, Field, OutputDefinition, SolidExecutionContext, solid, Noneable, AssetKey, Output
from modes import annotations

@solid(
    config_schema={
        "template_survey_guid": str,
        "pot_guid": Field(Noneable(str), is_required=False, default_value=None),
    },
    required_resource_keys={"attest_client"},
    output_defs=[OutputDefinition(name="survey_guid", dagster_type=str)],
    tags=annotations,
)
def start_survey_based_on_draft(context: SolidExecutionContext):
    template_guid = context.solid_config["template_survey_guid"]
    pot_guid = context.solid_config["pot_guid"]
    attest_client = context.resources.attest_client
    new_survey_guid = attest_client.clone_survey(template_guid)
    survey_guid = attest_client.purchase_draft_survey(new_survey_guid, pot_guid)
   # yield AssetMaterialization(asset_key=AssetKey("survey_guid"), metadata_entries=[])
    yield Output(value=survey_guid, output_name="survey_guid")
code
error
p

prha

07/30/2021, 6:40 PM
@szalai1 is this while trying to execute the solid? Also, what version of dagster are you running? I just tried executing this solid and couldn’t hit the error you pasted.
s

szalai1

07/30/2021, 6:49 PM
version 0.12.1, yes this is when I'm running the solid
when I removed the output name, it started working again
also if I uncomment the materialization event
it fails again
dagster.core.errors.DagsterStepOutputNotFoundError: Core compute for solid "start_survey_based_on_draft" did not return an output for non-optional output "result"
p

prha

07/30/2021, 9:07 PM
This is what I’m able to run (without hitting the error):
Copy code
@solid(
    config_schema={
        "template_survey_guid": str,
        "pot_guid": Field(Noneable(str), is_required=False, default_value=None),
    },
    required_resource_keys={"attest_client"},
    output_defs=[OutputDefinition(name="survey_guid", dagster_type=str)],
)
def start_survey_based_on_draft(context: SolidExecutionContext):
    template_guid = context.solid_config["template_survey_guid"]
    pot_guid = context.solid_config["pot_guid"]
    attest_client = context.resources.attest_client
    new_survey_guid = attest_client.clone_survey(template_guid)
    survey_guid = attest_client.purchase_draft_survey(new_survey_guid, pot_guid) or ""
    yield Output(value=survey_guid, output_name="survey_guid")


@resource()
def attest_client_resource():
    client = mock.MagicMock()
    client.clone_survey.return_value = "testtttt clone"
    client.purchase_draft_survey.return_value = "testtttt purchase"
    return client


@pipeline(mode_defs=[ModeDefinition(resource_defs={"attest_client": attest_client_resource})])
def attest_pipeline():
    start_survey_based_on_draft()
^^ this was on
0.12.1
41 Views