Guillaume Latour
04/17/2023, 2:59 PMTimeWindowPartitionsDefinition
and a PartitionedParquetIOManager
. Now I am writing the logic to all the api and I must admit that I am a bit lost, I find myself re-reading the documentation again and again without finding a solution to implement this.
@op(out={'report': Out(io_manager_key="parquet_io_manager")})
def do_stuff(ids: List[int]) -> pd.DataFrame:
return pd.DataFrame({'dt_from': [], 'count': []})
@op
def report_submit(context) -> List[int]:
start_partition, end_partition = context.asset_partitions_time_window_for_output()
# call the api, treat the response and extract the job ids
return [1,2,3]
@graph_asset(partitions_def=six_hours_partitions)
def report() -> pd.DataFrame:
ids = report_submit()
return do_stuff(ids)
• I get an error saying that the report_submit
op is not in a partition context. How could I solve that? I saw on the documentation that some non- asset related op should use a partition config object. Am I really not in a partition context already?
• I think that I should use a sensor
for step 1.a. But if I do so, I feel like I am stepping out of the asset..owen
04/17/2023, 8:56 PM_asset__partitions_time_window_for_output
in a context where report_submit
does not have an output that produces an asset (the error message is pretty unclear here). it's just a helper op .
Instead, you could call context.partition_time_window
, which should work in the same way, but does not care about the relationship between output and asset.Guillaume Latour
04/18/2023, 5:14 AMreport_submit
op.
Also, I want to be able to relaunch this step if something goes wrong during the download and I am unsure the sensor will allow that.
Do you have any leads on how I may be able to do that?owen
04/18/2023, 4:57 PMGustavo Carvalho
05/13/2023, 4:58 AMop
of my graph_asset
. I can make it working using context.partition_time_window
, but it is not compatible with the Single Run Backfills feature , as it expects the asset
to be defined in terms of asset_partitions_time_window
or similar functions. Do you have a workaround for this case?owen
05/15/2023, 4:04 PMGustavo Carvalho
05/16/2023, 1:31 PM