happy-iron-52048
12/02/2024, 5:54 PMdef with_target(stack, urn):
start_time = time.time() # Record the start time
stack.refresh(target=[urn])
end_time = time.time() # Record the end time
elapsed_time = end_time - start_time
print(f"Time taken to refresh the stack for URN '{urn}': {elapsed_time:.2f} seconds")
def without_target(stack):
start_time = time.time() # Record the start time
stack.refresh()
end_time = time.time() # Record the end time
elapsed_time = end_time - start_time
print(f"Without Target : {elapsed_time:.2f} seconds")
with_target(pulumi_service_stack2.stack,'urn:pulumi:pulsar-test-stack-3::pulumi_poc::aws:ec2/instance:Instance::bookie-4')
Time taken to refresh the stack for URN 'urn:pulumi:pulsar-test-stack-3::pulumi_poc::aws:ec2/instance:Instance::bookie-4': 7.78 seconds
without_target(pulumi_service_stack2.stack)
Without Target : 7.38 seconds
So this particular stack has about 15 ec2 resources.