Optionally raise an error if source file does not exist in GCSToGCSOperator #21388
Closed
2 tasks done
Labels
kind:feature
Feature Requests
Description
Right now when using GCSToGCSOperator to copy a file from one bucket to another, if the source file does not exist, nothing happens and the task is considered successful. This could be good for some use cases, for example, when you want to copy all the files from a directory or that match a specific pattern.
But for some other cases, like when you only want to copy one specific blob, it might be useful to raise an exception if the source file can't be found. Otherwise, the task would be failing silently.
My proposal is to add a new flag to GCSToGCSOperator to enable this feature. By default, for backward compatibility, the behavior would be the current one. But it would be possible to force the source file to be required and mark the task as failed if it doesn't exist.
Use case/motivation
Task would fail if the source file to copy does not exist, but only in the case you enable it.
Related issues
If you want to be sure that the source file exists and it will be copied on every execution, currently the operator does not allow you to make the task fail. If the status is successful but nothing is written in the destination, it would be failing silently.
Are you willing to submit a PR?
Code of Conduct
The text was updated successfully, but these errors were encountered: