syedahsn commented on code in PR #36828:
URL: https://github.com/apache/airflow/pull/36828#discussion_r1457843632


##########
airflow/providers/amazon/aws/operators/ec2.py:
##########
@@ -183,22 +183,36 @@ def execute(self, context: Context):
             MaxCount=self.max_count,
             **self.config,
         )["Instances"]
-        instance_ids = []
-        for instance in instances:
-            instance_ids.append(instance["InstanceId"])
-            self.log.info("Created EC2 instance %s", instance["InstanceId"])
+
+        instance_ids = self._on_kill_instance_ids = [instance["InstanceId"] 
for instance in instances]

Review Comment:
   Hmm, I honestly didn't consider that perspective, but I think your approach 
is correct - better to be cautious and have a potentially redundant variable 
rather than introducing a race condition of some sort. Thanks for explaining 
your thoughts, I appreciate it!



-- 
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