Skip to content

Instantly share code, notes, and snippets.

@ktechmidas
Last active March 31, 2017 04:22
Show Gist options
  • Save ktechmidas/bcd7e1d262fc3aa1c2dff0cf5b68fa7f to your computer and use it in GitHub Desktop.
Save ktechmidas/bcd7e1d262fc3aa1c2dff0cf5b68fa7f to your computer and use it in GitHub Desktop.
def getprice(instlist):
print instlist
pdb.set_trace()
for idx, inst in enumerate(instlist):
price_history = conn.get_spot_price_history(instance_type = inst, product_description = 'Linux/UNIX', max_results=10, availability_zone=az)
price = float(str(price_history[0]).split(':')[1]) / max_bid
print price_history[0]
#pdb.set_trace()
if price > 0.9:
instlist.pop(idx)
return instlist
-----
root@ip-10-10-1-64:~/cluster# ./systems.py -a test
['m4.large', 'r4.large']
> /root/cluster/systems.py(329)getprice()
-> for idx, inst in enumerate(instlist):
(Pdb) n
> /root/cluster/systems.py(330)getprice()
-> price_history = conn.get_spot_price_history(instance_type = inst, product_description = 'Linux/UNIX', max_results=10, availability_zone=az)
(Pdb) n
> /root/cluster/systems.py(331)getprice()
-> price = float(str(price_history[0]).split(':')[1]) / max_bid
(Pdb) n
> /root/cluster/systems.py(332)getprice()
-> print price_history[0]
(Pdb) n
SpotPriceHistory(m4.large):0.031400
> /root/cluster/systems.py(334)getprice()
-> if price > 0.9:
(Pdb) n
> /root/cluster/systems.py(335)getprice()
-> instlist.pop(idx)
(Pdb) n
> /root/cluster/systems.py(329)getprice()
-> for idx, inst in enumerate(instlist):
(Pdb) n
> /root/cluster/systems.py(336)getprice()
-> return instlist
(Pdb) n
--Return--
> /root/cluster/systems.py(336)getprice()->['r4.large']
-> return instlist
(Pdb) n
> /root/cluster/systems.py(440)main()
-> print instlist
(Pdb) n
['r4.large']
--Return--
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment