File tree Expand file tree Collapse file tree 3 files changed +4
-29
lines changed Expand file tree Collapse file tree 3 files changed +4
-29
lines changed Original file line number Diff line number Diff line change @@ -52,30 +52,6 @@ def persist(
52
52
)
53
53
54
54
55
- class CloudDatastoreExportEntitiesLink (BaseGoogleLink ):
56
- """Helper class for constructing Cloud Datastore Export Entities Link"""
57
-
58
- name = "Export Entities"
59
- key = "export_conf"
60
- format_str = DATASTORE_EXPORT_ENTITIES_LINK
61
-
62
- @staticmethod
63
- def persist (
64
- context : "Context" ,
65
- task_instance ,
66
- output_url : str ,
67
- ):
68
- task_instance .xcom_push (
69
- context = context ,
70
- key = CloudDatastoreExportEntitiesLink .key ,
71
- value = {
72
- "project_id" : task_instance .project_id ,
73
- "bucket_name" : task_instance .bucket ,
74
- "export_name" : output_url .split ('/' )[3 ],
75
- },
76
- )
77
-
78
-
79
55
class CloudDatastoreEntitiesLink (BaseGoogleLink ):
80
56
"""Helper class for constructing Cloud Datastore Entities Link"""
81
57
Original file line number Diff line number Diff line change 25
25
from airflow .providers .google .cloud .hooks .gcs import GCSHook
26
26
from airflow .providers .google .cloud .links .datastore import (
27
27
CloudDatastoreEntitiesLink ,
28
- CloudDatastoreExportEntitiesLink ,
29
28
CloudDatastoreImportExportLink ,
30
29
)
30
+ from airflow .providers .google .common .links .storage import StorageLink
31
31
32
32
if TYPE_CHECKING :
33
33
from airflow .utils .context import Context
@@ -78,7 +78,7 @@ class CloudDatastoreExportEntitiesOperator(BaseOperator):
78
78
'labels' ,
79
79
'impersonation_chain' ,
80
80
)
81
- operator_extra_links = (CloudDatastoreExportEntitiesLink (),)
81
+ operator_extra_links = (StorageLink (),)
82
82
83
83
def __init__ (
84
84
self ,
@@ -138,10 +138,10 @@ def execute(self, context: 'Context') -> dict:
138
138
state = result ['metadata' ]['common' ]['state' ]
139
139
if state != 'SUCCESSFUL' :
140
140
raise AirflowException (f'Operation failed: result={ result } ' )
141
- CloudDatastoreExportEntitiesLink .persist (
141
+ StorageLink .persist (
142
142
context = context ,
143
143
task_instance = self ,
144
- output_url = result ['response' ]['outputUrl' ],
144
+ uri = f" { self . bucket } / { result ['response' ]['outputUrl' ]. split ( '/' )[ 3 ] } " ,
145
145
)
146
146
return result
147
147
Original file line number Diff line number Diff line change @@ -905,7 +905,6 @@ extra-links:
905
905
- airflow.providers.google.cloud.operators.cloud_composer.CloudComposerEnvironmentsLink
906
906
- airflow.providers.google.cloud.links.dataflow.DataflowJobLink
907
907
- airflow.providers.google.cloud.links.datastore.CloudDatastoreImportExportLink
908
- - airflow.providers.google.cloud.links.datastore.CloudDatastoreExportEntitiesLink
909
908
- airflow.providers.google.cloud.links.datastore.CloudDatastoreEntitiesLink
910
909
- airflow.providers.google.common.links.storage.StorageLink
911
910
You canβt perform that action at this time.
0 commit comments