File tree 1 file changed +7
-2
lines changed
1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ def _attach_datetime(filename: str, destination: str):
30
30
now = datetime .utcnow ()
31
31
todays_day = now .weekday ()
32
32
33
- if todays_day == 0 :
33
+ if todays_day :
34
34
return
35
35
36
36
df = pd .read_csv (filename )
@@ -103,6 +103,9 @@ def _resume_redshift_cluster(cluster_identifier: str):
103
103
cluster_state = redshift_hook .cluster_status (cluster_identifier = cluster_identifier )
104
104
105
105
try :
106
+ if cluster_state == "available" :
107
+ return
108
+
106
109
redshift_hook .get_conn ().resume_cluster (ClusterIdentifier = cluster_identifier )
107
110
while cluster_state != "available" :
108
111
time .sleep (1 )
@@ -128,11 +131,13 @@ def _pause_redshift_cluster(cluster_identifier: str):
128
131
AirflowException: should fail the pipeline, and (possibly?) send an
129
132
alert to notify that your money is leaking.
130
133
"""
131
-
132
134
redshift_hook = RedshiftHook ()
133
135
cluster_state = redshift_hook .cluster_status (cluster_identifier = cluster_identifier )
134
136
135
137
try :
138
+ if cluster_state == 'paused' :
139
+ return
140
+
136
141
redshift_hook .get_conn ().pause_cluster (ClusterIdentifier = cluster_identifier )
137
142
except Exception as ex :
138
143
logging .warning (
You can’t perform that action at this time.
0 commit comments