Brendan Jackson
06/28/2023, 9:23 AMbuild_op_context
allows a single partition key, not a rangeBrendan Jackson
06/28/2023, 9:44 AMsean
06/28/2023, 1:16 PMbuild_op_context
, if you create a issue for it I’m pretty sure I can knock it out quickly.Brendan Jackson
06/28/2023, 1:38 PMcontext = dagster.build_op_context(partition_key="2023-01-05")
and then time_window = context.asset_partitions_time_window_for_output()
works.
Obviously this doesn't cover a range beyond a single day (which I would like to test).
(I notice that this method is marked deprecated
on the OpExecutionContext
(but not the AssetExecutionContext
) - which leaves me a bit confused. What's going on here?)
Finally, this context.partition_time_window
does not work, despite the above working. This is another confusing part! Any ideas before I make the issue?Brendan Jackson
06/28/2023, 1:44 PMsean
06/28/2023, 1:51 PMasset_partitions_time_window_for_output
works, since it can be derived from one partition key.
(I notice that this method is marked deprecated on the OpExecutionContext (but not the AssetExecutionContext) - which leaves me a bit confused. What’s going on here?)I’m not 100% up to date here but that’s probably bc
OpExecutionContext
is only being used now in situations where there is no associated asset. If you have an @asset
it should always receive the AssetExecutionContext
subclass instead.
Finally, this context.partition_time_window does not work, despite the above working. This is another confusing part! Any ideas before I make the issue?Seems odd, what error gets thrown?
Brendan Jackson
06/28/2023, 1:52 PMAttributeError: 'BoundOpExecutionContext' object has no attribute '_step_execution_context'. Did you mean: 'get_step_execution_context'?
Brendan Jackson
06/28/2023, 1:53 PMsean
06/28/2023, 2:07 PMBrendan Jackson
06/28/2023, 2:10 PM@asset
, context.partition_time_window
should be preferred to context.asset_partitions_time_window_for_output()
? The latter I'd expect from the name to be more associated with output steps.sean
06/28/2023, 2:32 PMBrendan Jackson
08/04/2023, 10:22 AMasset_partitions_time_window_for_output()
vs partition_time_window
? The former works in tests, the latter does not. Latest version of Dagster
I also still can't use ranges (using PartitionKeyRange
when building a context results in Tried to access partition_key for a non-partitioned asset
, while partition_key
alone does not).Brendan Jackson
08/04/2023, 10:33 AM> return self._step_execution_context.partition_time_window
E AttributeError: 'BoundOpExecutionContext' object has no attribute '_step_execution_context'. Did you mean: 'get_step_execution_context'?