aru-trackunit commented on code in PR #29694:
URL: https://github.com/apache/airflow/pull/29694#discussion_r1121866085


##########
airflow/providers/google/suite/hooks/drive.py:
##########
@@ -243,8 +300,21 @@ def upload_file(
             .create(body=file_metadata, media_body=media, fields="id", 
supportsAllDrives=True)
             .execute(num_retries=self.num_retries)
         )
-        self.log.info("File %s uploaded to gdrive://%s.", local_location, 
remote_location)
-        return file.get("id")
+        file_id = file.get("id")
+
+        upload_location = remote_location
+
+        if folder_id != "root":
+            try:
+                upload_location = self._resolve_file_path(folder_id)
+            except (GoogleApiClientError, AirflowException) as e:

Review Comment:
   I disagree, because of the order of tasks. First file is uploaded and then 
we are trying to resolve its path, so if we fail on path resolution then file 
got uploaded, we failed the task due to unexpected behavior and we can't revert 
this change. So in my head there are 2 options:
   1. We keep the solution as is
   2. I move the path resolution code before uploading a file so the 
transaction doesn't need to be reverted.



-- 
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: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to