Médéric Hurier
11/20/2021, 12:25 PMcontext
argument. Using context
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 ?sandy
11/20/2021, 10:01 PMMédéric Hurier
11/21/2021, 8:44 AMStefan Adelbert
11/22/2021, 2:07 AMtasks
and functions
, where the functions
are like ops
and take a single context
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 ops
which interact with the context, getting the logger and relevant resources and then call into your existing functionality - i.e. the ops
would be thin wrappers which conform your existing code, like shims.Médéric Hurier
11/22/2021, 7:27 AMsandy
11/22/2021, 3:38 PMMédéric Hurier
11/22/2021, 4:27 PMsandy
11/22/2021, 4:49 PMMédéric Hurier
11/23/2021, 7:38 AMdef f(a, b context=None)
, 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.