Médéric Hurier11/20/2021, 12:25 PM
seems to "break" Python functions, as you have to provide this argument when you call the function directly. On the other hand, this argument is not explicit when you call an op from a graph/job. It's an important buy-in to migrate an existing code base to Dagster. Is there a way around it? Would it be better to use context as an optional keyword argument instead of a positional argument ?
sandy11/20/2021, 10:01 PM
Médéric Hurier11/21/2021, 8:44 AM
Stefan Adelbert11/22/2021, 2:07 AM
, where the
and take a single
parameter. Because of this similarity, I'm hoping that the migration process will be relatively easy... In your case, where your existing code is quite different, maybe it would make sense to do a gradual approach where you write dasgter
which interact with the context, getting the logger and relevant resources and then call into your existing functionality - i.e. the
would be thin wrappers which conform your existing code, like shims.
Médéric Hurier11/22/2021, 7:27 AM
sandy11/22/2021, 3:38 PM
Médéric Hurier11/22/2021, 4:27 PM
sandy11/22/2021, 4:49 PM
Médéric Hurier11/23/2021, 7:38 AM
, but never let it be None in reality. The op decorator could always pass an empty context, or warn the user before calling the user function if the context is None/empty and there are required fields.
def f(a, b context=None)