julwin opened a new issue, #28304:
URL: https://github.com/apache/airflow/issues/28304

   ### Apache Airflow version
   
   2.5.0
   
   ### What happened
   
   When using dynamic task mapping, I tried to update an airflow dataset for 
every file in a S3 location. 
   The URI for the dataset should be generated inside of a Taskflow task, 
containing the basename of the processed file.
   
   The
   ```python
   @task()
   def extract_s3_destination():
     dataset = Dataset("s3://dataset-bucket/example.csv")
     return {"filename": path, "dest_key": dest_key, "outlets": [dataset]}
   ```
   
   When handing this over to `expand_kwargs` (even with strict=False), this 
error occurs:
   
   ```python
   filenames = extract_s3_destination.expand(path=XComArg(list_modified_files))
   
   copy_to_s3 = LocalFilesystemToS3Operator.partial(
           task_id="copy_file_to_s3",
           aws_conn_id="s3",
           gzip=True,
           replace=True,
           dest_bucket="{{ conn.s3.login }}",
       ).expand_kwargs(filenames, strict=False)
   ```
   
   
   ```
   {manager.py:56} WARNING - DatasetModel 
Dataset(uri='unprocessed/customfilename20221212.zip', extra=None) not found
   ```
   
   The same happens when 
   
   ### What you think should happen instead
   
   The Dataset should be updated if not exists or created, the way you would 
expect it after reading these examples from the Documentation:
   
   ```
   from airflow import Dataset
   
   with DAG(...):
       MyOperator(
           # this task updates example.csv
           outlets=[Dataset("s3://dataset-bucket/example.csv")],
           ...,
       )
   
   
   with DAG(
       # this DAG should be run when example.csv is updated (by dag1)
       schedule=[Dataset("s3://dataset-bucket/example.csv")],
       ...,
   ):
       ...
   ```
   
   ### How to reproduce
   
   _No response_
   
   ### Operating System
   
   kubernetes / airflow executor / default image
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Official Apache Airflow Helm Chart
   
   ### Deployment details
   
   _No response_
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to