Hi y'all is it possible to run ops form a while lo...
# ask-community
j
Hi y'all is it possible to run ops form a while loop? I keep getting an error:
Compute function of op 'get_data_to_score' has context argument, but no context was provided when invoking
the op with the loop looks like this:
Copy code
@op
def jit_scoring(trained_model):
    result = []
    while True:
        data_to_score = get_data_to_score()
        nrows = data_to_score['row_count']

        print(f'JIT NRows: {nrows}')
        if nrows < 1:
            break

        result.append(
            key_to_score(data_to_score['df'])
            .map(
                lambda key: ingest_data_and_score(
                    recruiter_in_batch=key, trained_model=trained_model
                )
            )
            .collect()
        )

    return result
d
That error looks like the definition of
get_data_to_score
takes an argument called
context
and you didn't pass one in the invocation
j
from what i understand
context
should be passed in by dagster. But just in case i was wrong in this assumption i tried to pass it in explicitly, it still failed with the same error
s
Hi @Jesse Myers - Dagster doesn't support the ability to run ops from other ops. You can still directly invoke them, as you're doing here, but it will treat them like a regular Python function, not invoke them using Dagster's execution machinery
j
Thanks Sandy, i'd see if using a plane function will be possible in this case. unfortunately that approach prevents us from using the IO manager that was used for that op