potiuk commented on a change in pull request #7791: Add ability to specify a
maximum modified time for objects in GCSToGCSOperator
URL: https://github.com/apache/airflow/pull/7791#discussion_r395970571
##########
File path: airflow/providers/google/cloud/operators/gcs_to_gcs.py
##########
@@ -277,14 +283,35 @@ def _copy_source_with_wildcard(self, hook, prefix):
destination_object=destination_object)
def _copy_single_object(self, hook, source_object, destination_object):
- if self.last_modified_time is not None:
+ if self.last_modified_time and self.maximum_modified_time:
+ # check to see if object was modified between last_modified_time
and
+ # maximum_modified_time
+ if hook.is_updated_between(self.source_bucket,
+ source_object,
+ self.last_modified_time,
+ self.maximum_modified_time
+ ):
+ self.log.debug("Object has been modified between %s and %s",
+ self.last_modified_time,
self.maximum_modified_time)
+ else:
+ return
+
+ elif self.last_modified_time is not None:
# Check to see if object was modified after last_modified_time
if hook.is_updated_after(self.source_bucket,
source_object,
self.last_modified_time):
self.log.debug("Object has been modified after %s ",
self.last_modified_time)
else:
return
+ elif self.maximum_modified_time is not None:
+ # Check to see if object was modified before maximum_modified_time
+ if hook.is_updated_before(self.source_bucket,
+ source_object,
+ self.maximum_modified_time):
+ self.log.debug("Object has been modified before %s ",
self.maximum_modified_time)
Review comment:
Same here.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services