|
32 | 32 |
|
33 | 33 | @hooks.deploy
|
34 | 34 | def deploy(plugin_id: str, context: "Context", team_context: "TeamContext", parameters: Dict[str, Any]) -> None:
|
35 |
| - _logger.debug("Running hello_world deploy!") |
| 35 | + _logger.debug("Running emr_on_eks deploy!") |
36 | 36 | sh.run(f"echo 'Team name: {team_context.name} | Plugin ID: {plugin_id}'")
|
37 | 37 | cluster_name = f"orbit-{context.name}"
|
38 | 38 | virtual_cluster_name = f"orbit-{context.name}-{team_context.name}"
|
@@ -84,25 +84,23 @@ def deploy(plugin_id: str, context: "Context", team_context: "TeamContext", para
|
84 | 84 |
|
85 | 85 | @hooks.destroy
|
86 | 86 | def destroy(plugin_id: str, context: "Context", team_context: "TeamContext", parameters: Dict[str, Any]) -> None:
|
87 |
| - _logger.debug("Running hello_world destroy!") |
| 87 | + _logger.debug("Running emr_on_eks destroy!") |
88 | 88 | sh.run(f"echo 'Team name: {team_context.name} | Plugin ID: {plugin_id}'")
|
89 | 89 |
|
90 | 90 | virtual_cluster_name = f"orbit-{context.name}-{team_context.name}"
|
91 | 91 | emr = boto3.client("emr-containers")
|
92 | 92 | response = emr.list_virtual_clusters(
|
93 | 93 | containerProviderId=f"orbit-{context.name}", containerProviderType="EKS", maxResults=500
|
94 | 94 | )
|
95 |
| - if "virtualClusters" not in response or len(response["virtualClusters"]) == 0: |
96 |
| - raise Exception("Virtual EMR Cluster not found") |
97 |
| - for c in response["virtualClusters"]: |
98 |
| - if c["name"] == virtual_cluster_name: |
99 |
| - try: |
100 |
| - delete_response = emr.delete_virtual_cluster(id=c["id"]) |
101 |
| - _logger.debug("delete_virtual_cluster:", delete_response) |
102 |
| - return |
103 |
| - except Exception as e: |
104 |
| - _logger.warning(e) |
105 |
| - pass |
| 95 | + if "virtualClusters" in response: |
| 96 | + for c in response["virtualClusters"]: |
| 97 | + if c["name"] == virtual_cluster_name: |
| 98 | + try: |
| 99 | + delete_response = emr.delete_virtual_cluster(id=c["id"]) |
| 100 | + _logger.debug("delete_virtual_cluster:", delete_response) |
| 101 | + except Exception as e: |
| 102 | + _logger.warning(e) |
| 103 | + pass |
106 | 104 |
|
107 | 105 | cdk_destroy(
|
108 | 106 | stack_name=f"orbit-{context.name}-{team_context.name}-emr-on-eks",
|
|
0 commit comments