-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ETL - load func implemented pub/sub type of payload, cleanup driver c…
…lass.
- Loading branch information
Milo Hyben
committed
Aug 22, 2023
1 parent
98b403d
commit 27fbb12
Showing
2 changed files
with
94 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -358,7 +358,7 @@ def setup_etl(self): | |
), | ||
) | ||
|
||
# pubsub_v1.PublisherClient.publish User not authorized to perform this action | ||
# give the etl_service_account ability to push to pub/sub | ||
gcp.projects.IAMMember( | ||
'metamist-etl-editor-role', | ||
project=self.config.sample_metadata.gcp.project, | ||
|
@@ -378,15 +378,24 @@ def setup_etl_functions(self): | |
""" | ||
setup_etl_functions | ||
""" | ||
self.etl_extract_function | ||
self.etl_load_function | ||
# TODO | ||
return pulumi.ResourceOptions( | ||
depends_on=[ | ||
self.etl_extract_function, | ||
self.etl_load_function | ||
], | ||
) | ||
|
||
def setup_etl_pubsub(self): | ||
""" | ||
setup_etl_pubsub | ||
""" | ||
self.etl_pubsub_dead_letter_subscription | ||
self.etl_pubsub_push_subscription | ||
return pulumi.ResourceOptions( | ||
depends_on=[ | ||
self.etl_pubsub_dead_letter_subscription, | ||
self.etl_pubsub_push_subscription | ||
], | ||
) | ||
|
||
@cached_property | ||
def etl_extract_function(self): | ||
|
@@ -461,7 +470,7 @@ def etl_function(self, f_name: str): | |
), | ||
'PUBSUB_TOPIC': self.etl_pubsub_topic.id, | ||
# 'ALLOWED_USERS': '[email protected]', | ||
'ALLOWED_USERS': '[email protected]', | ||
# 'ALLOWED_USERS': '[email protected]', | ||
}, | ||
ingress_settings='ALLOW_ALL', | ||
all_traffic_on_latest_revision=True, | ||
|
@@ -480,18 +489,18 @@ def setup_metamist_etl_accessors(self): | |
for name, sa in self.etl_accessors.items(): | ||
gcp.cloudfunctionsv2.FunctionIamMember( | ||
f'metamist-etl-accessor-{name}', | ||
location=self.etl_function.location, | ||
project=self.etl_function.project, | ||
cloud_function=self.etl_function.name, | ||
location=self.etl_extract_function.location, | ||
project=self.etl_extract_function.project, | ||
cloud_function=self.etl_extract_function.name, | ||
role='roles/cloudfunctions.invoker', | ||
member=pulumi.Output.concat('serviceAccount:', sa.email), | ||
) | ||
|
||
gcp.cloudrun.IamMember( | ||
f'metamist-etl-run-accessor-{name}', | ||
location=self.etl_function.location, | ||
project=self.etl_function.project, | ||
service=self.etl_function.name, # it shared the name | ||
location=self.etl_extract_function.location, | ||
project=self.etl_extract_function.project, | ||
service=self.etl_extract_function.name, # it shared the name | ||
role='roles/run.invoker', | ||
member=pulumi.Output.concat('serviceAccount:', sa.email), | ||
) | ||
|
@@ -501,7 +510,7 @@ def setup_slack_notification(self): | |
return | ||
|
||
# Slack notifications | ||
filter_string = self.etl_function.name.apply( | ||
filter_string = self.etl_extract_function.name.apply( | ||
lambda fxn_name: f""" | ||
resource.type="cloud_function" | ||
AND resource.labels.function_name="{fxn_name}" | ||
|