[ 
https://issues.apache.org/jira/browse/BEAM-14314?focusedWorklogId=765178&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-765178
 ]

ASF GitHub Bot logged work on BEAM-14314:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 02/May/22 22:14
            Start Date: 02/May/22 22:14
    Worklog Time Spent: 10m 
      Work Description: Abacn commented on code in PR #17380:
URL: https://github.com/apache/beam/pull/17380#discussion_r863227799


##########
sdks/python/apache_beam/io/gcp/gcsio.py:
##########
@@ -532,39 +510,85 @@ def last_updated(self, path):
 
     Returns: last updated time of the GCS object in second.
     """
+    return self._updated_to_seconds(self._gcs_object(path).updated)
+
+  def _status(self, path):
+    """For internal use only; no backwards-compatibility guarantees.
+
+    Returns supported fields (checksum, kms_key, last_updated, size) of a
+    single object as a dict at once.
+
+    This method does not perform glob expansion. Hence the given path must be
+    for a single GCS object.
+
+    Returns: dict of fields of the GCS object.
+    """
+    gcs_object = self._gcs_object(path)
+    file_status = {}
+    if hasattr(gcs_object, 'crc32c'):
+      file_status['checksum'] = gcs_object.crc32c
+    if hasattr(gcs_object, 'kmsKeyName'):
+      file_status['kms_key'] = gcs_object.kmsKeyName
+    if hasattr(gcs_object, 'updated'):
+      file_status['last_updated'] = 
self._updated_to_seconds(gcs_object.updated)

Review Comment:
   Yes, the response returned by client.objects.Get contains a updated field 
which is a datetime object 
https://cloud.google.com/storage/docs/json_api/v1/objects#resource-representations
 . This piece of code uses existing code in GcsIO.last_updated method.





Issue Time Tracking
-------------------

    Worklog Id:     (was: 765178)
    Time Spent: 5h 40m  (was: 5.5h)

> Add last_updated field in filesystem.FileMetaData
> -------------------------------------------------
>
>                 Key: BEAM-14314
>                 URL: https://issues.apache.org/jira/browse/BEAM-14314
>             Project: Beam
>          Issue Type: New Feature
>          Components: io-py-common
>            Reporter: Yi Hu
>            Assignee: Yi Hu
>            Priority: P2
>          Time Spent: 5h 40m
>  Remaining Estimate: 0h
>
> This will be the python counterpart of BEAM-5910
> Per python naming convention, the field will be named as 
> "last_updated_in_seconds".



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to