Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Monitor Spot Instance Price in Real Time using Moto #783

Open
arita37 opened this issue Dec 1, 2016 · 8 comments
Open

Monitor Spot Instance Price in Real Time using Moto #783

arita37 opened this issue Dec 1, 2016 · 8 comments

Comments

@arita37
Copy link

arita37 commented Dec 1, 2016

Hi,
Am wondering if there is a way to monitor Real Time price of EC2 instances using Moto ?
It means having the price every 5 mins in a server mode.

Thanks,r egards

@spulec
Copy link
Collaborator

spulec commented Dec 3, 2016

The describe_spot_price_history method is not currently implemented, but I would be happy to accept a pull request if anyone wants to take a try.

@spulec
Copy link
Collaborator

spulec commented Mar 7, 2018

Closing this out; feel free to reopen with more info on the request

@spulec spulec closed this as completed Mar 7, 2018
@tonyhutter
Copy link

tonyhutter commented Aug 21, 2020

I'm interested in this. I'm currently blocking on writing a test case for buildbot because my test calls describe_spot_price_history:
buildbot/buildbot#5401 (comment)

@tonyhutter
Copy link

I'm working on implementing this - once it's usable I'll put together a PR.

@Conan-Kudo
Copy link

@tonyhutter Any progress on this?

@tonyhutter
Copy link

tonyhutter commented Jan 13, 2021

I'm dusting this off again. Ultimately what I'd like to do is change describe_spot_instance_requests()'s status to first report pending-evaluation the first time you call describe_spot_instance_requests(), and then have it report fulfilled on subsequent calls. Currently it's hard coded to always report pending-evaluation. I'd like to do something like this:

DESCRIBE_SPOT_INSTANCES_TEMPLATE=
...

       <type>{{ request.type }}</type>
       <state>{{ request.state }}</state>
       <status>
-        <code>pending-evaluation</code>
+        <code>{{ request.describe_spot_instance_state }}</code>
         <updateTime>2015-01-01T00:00:00.000Z</updateTime>
         <message>Your Spot request has been submitted for review, and is pending evaluation.</message>
       </status>

To do that, I need to store the state somewhere between calls, but I'm not clear on where the right place would be. I'm also not super familiar with python, and am trying to wrap my head around all the moto classes... Any help would be appreciated!

@tonyhutter
Copy link

@spulec please re-open this issue

@bblommers
Copy link
Collaborator

Hi @tonyhutter, it looks like the status-code should be an attribute of the SpotInstanceRequest-class (in moto/ec2/models.py).

The Transcribe-service has a similar logic, where the status is updated/progressed on subsequent calls, so you might be able to use that for inspiration: https://github.com/spulec/moto/pull/3299/files#diff-0297ad13d08f2d965600fdea42e6586509a141db019fbf79dfb49de2bd2c8076R260

@bblommers bblommers reopened this Jan 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants