Given this code ```@job(config=build_and_validate_...
# ask-ai
s
Given this code
Copy code
@job(config=build_and_validate_electrothermal_models_config)
def build_and_validate_electrothermal_models_job():
    model_assembly_results: Optional[ModelAssemblyResults] = \
        electrothermal_model_phase_group_op()
    electrothermal_model_selection_config = \
        DagsterElectrothermalModelSelectionConfig(
            single_cell_model_ids=model_assembly_results.single_cell_model_ids,
            consensus_model_ids=model_assembly_results.consensus_model_ids
        )
How do I fix the 'InvokedNodeOutputHandle' object has no attribute error
s
The error you're encountering suggests that you're trying to access attributes on an
InvokedNodeOutputHandle
object, which is not allowed. This object represents the output of an op or graph when it is invoked within a job or another graph, and it does not have the attributes you're trying to access. In the code snippet you provided, you're attempting to access
single_cell_model_ids
and
consensus_model_ids
attributes on the
model_assembly_results
variable, which seems to be the output of the
electrothermal_model_phase_group_op()
op. However, if
electrothermal_model_phase_group_op
is an op that yields an
Output
, you cannot directly access attributes on its result like this. To fix this issue, you need to ensure that the
electrothermal_model_phase_group_op
op is yielding an
Output
object that can be passed to downstream ops. If
electrothermal_model_phase_group_op
needs to yield multiple outputs, you should define it with multiple
Out
objects and yield
Output
objects accordingly. Here's an example of how you might structure an op with multiple outputs:
Copy code
python from dagster import job, op, Out, Output  @op(out={"single_cell_model_ids": Out(), "consensus_model_ids": Out()}) def electrothermal_model_phase_group_op():     # Your logic here     yield Output(value=single_cell_model_ids, output_name="single_cell_model_ids")     yield Output(value=consensus_model_ids, output_name="consensus_model_ids")  @job def build_and_validate_electrothermal_models_job():     results = electrothermal_model_phase_group_op()     electrothermal_model_selection_config = DagsterElectrothermalModelSelectionConfig(         single_cell_model_ids=results.single_cell_model_ids,         consensus_model_ids=results.consensus_model_ids     )     # Use electrothermal_model_selection_config in subsequent ops
In this example,
electrothermal_model_phase_group_op
is defined with two named outputs. When you invoke this op within a job, you can access these outputs by their names. If you need to pass these outputs to another op, you would connect them in the job definition like so:
Copy code
python @op def downstream_op(single_cell_model_ids, consensus_model_ids):     # Your logic here  @job def build_and_validate_electrothermal_models_job():     results = electrothermal_model_phase_group_op()     downstream_op(         single_cell_model_ids=results.single_cell_model_ids,         consensus_model_ids=results.consensus_model_ids     )
Make sure that the downstream ops are expecting the correct inputs and that the outputs from
electrothermal_model_phase_group_op
are connected correctly. If you continue to encounter issues, please check the documentation for the latest guidance on defining and connecting ops with multiple outputs.