Hi, how can I pass context from one op that calls ...
# ask-community
d
Hi, how can I pass context from one op that calls another. I am getting the following error when I try to call an op with configured from inside another op.
Copy code
dagster.core.errors.DagsterInvalidInvocationError: Compute function of solid '00' has context argument, but no context was provided when invoking.
Copy code
@op
def airbyte_it(context):
    print(context.op_config["it"])

@op
def call_it(ids):
    for airbtye_id in ids:
        airbyte_it.configured({"it": airbtye_id}, name=str(airbtye_id))()
c
Calling ops from within other ops is not recommended/supported behavior, and may result in an explicit error in future versions of dagster. If you need to pass information between ops, we recommend doing so with inputs and outputs
d
Chris, thanks for all your help. My issue is that I need to call an op that requires a value be passed to it's configuration via configured at runtime. So if I'm processing a dynamic output I can map it to another op, but from that op I cannot call configured. This option tries to define the "configured" at start-up and therefor does not work
Copy code
def _for_each(val):
        airbyte_it.configured({"it": val}, name=str(val))()

    results = dynamic_workspace().map(_for_each)
and this option gives the following error:
Copy code
dagster.core.errors.DagsterInvalidInvocationError: Compute function of solid '40' has context argument, but no context was provided when invoking.
Copy code
results = dynamic_workspace().map(pass_airbyte)

@op
def pass_airbyte(this):
    airbyte_it.configured({"id": this}, name=str(this))()
Any insight into how I can call an op with configured for a dynamic output? Thanks in advance.
850 Views