-
Notifications
You must be signed in to change notification settings - Fork 107
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
Improve instance_types.rake logic #301
Conversation
1449476
to
e4257da
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great idea to add the parsing to ec2instances upstream!
:virtualization_type => [:hvm], | ||
:network_performance => :low, | ||
:physical_processor => "Intel Xeon family", | ||
:processor_clock_speed => 3.3, | ||
:processor_clock_speed => "up to 3.3", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this a problem, that this is now a string?
is the db a string?
will it impact UI sorting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original code was
o[:processor_clock_speed] = row[:clock_speed_ghz].scan(/[\d\.]/).join
And that won't work because some of the new values of row[:clock_speed_ghz]
are like '2.3 to 2.7'
. The scan
will return '2.32.7' which doesn't make sense and also breaks the numeric field.
This is the part need your help. Do you know how we use this? Or who would know that I can ask?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually this won't matter, the db doesn't care about this, it only cares about
new_result = {
:type => ManageIQ::Providers::Amazon::CloudManager::Flavor.name,
:ems_ref => uid,
:name => name,
:description => flavor[:description],
:enabled => !flavor[:disabled],
:cpus => cpus,
:cpu_cores => 1,
:memory => flavor[:memory],
:supports_32_bit => flavor[:architecture].include?(:i386),
:supports_64_bit => flavor[:architecture].include?(:x86_64),
:supports_hvm => flavor[:virtualization_type].include?(:hvm),
:supports_paravirtual => flavor[:virtualization_type].include?(:paravirtual),
:block_storage_based_only => flavor[:ebs_only],
:cloud_subnet_required => flavor[:vpc_only],
:ephemeral_disk_size => flavor[:instance_store_size],
:ephemeral_disk_count => flavor[:instance_store_volumes]
}
as in parsing code here
:instance_store_volumes => 1, # SSD | ||
:architecture => [:x86_64], | ||
:virtualization_type => [], | ||
:network_performance => :high, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is :network_performance
a free text? IIRC it should be rather a set of [:high, :low, etc]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly, there are new values breaking the original parsing logic which was
- o[:network_performance] = case i[:network_performance]
- when '10 Gigabit', '20 Gigabit'
- :very_high
- else
- i[:network_performance].downcase.tr(' ', '_').to_sym
- end
Yes, AWS use free text for this field. So it's hard to parse it into structured type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont think we actually use this.
else | ||
i[:network_performance].downcase.tr(' ', '_').to_sym | ||
end | ||
# see https://github.com/ManageIQ/manageiq/issues/741#issuecomment-57353290 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd leave this comment in the code as a pointer to what 'ebs_only' means
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, done!
@@ -5,9 +5,6 @@ task :instance_types => [:environment] do | |||
# This task creates a instance_types.rb file in the current directory based upon the current | |||
# instance_types.rb file and data from | |||
# curl https://raw.githubusercontent.com/powdahound/ec2instances.info/master/www/instances.json > lib/tasks_private/instance_types_data/instances.json | |||
# https://aws.amazon.com/ec2/instance-types/#instance-type-matrix > lib/tasks_private/instance_types_data/instance_types.csv |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that this is now included in ec2instances.info, which is great
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, they just merged my vantage-sh/ec2instances.info#270 hours ago 😉
@@ -5,9 +5,6 @@ task :instance_types => [:environment] do | |||
# This task creates a instance_types.rb file in the current directory based upon the current | |||
# instance_types.rb file and data from | |||
# curl https://raw.githubusercontent.com/powdahound/ec2instances.info/master/www/instances.json > lib/tasks_private/instance_types_data/instances.json | |||
# https://aws.amazon.com/ec2/instance-types/#instance-type-matrix > lib/tasks_private/instance_types_data/instance_types.csv | |||
# https://aws.amazon.com/ec2/previous-generation/#Previous_Generation_Instance_Details_and_Pricing_ > lib/tasks_private/instance_types_data/instance_types_previous.csv |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but this isnt included...
did you remove it, because we assume that previous generations do not change anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original output from ec2instance.info
already has a field generation
which has value either 'current' or 'previous'. So that's how I determine it.
e4257da
to
933a3d0
Compare
Checked commits jameswnl/manageiq-providers-amazon@e5b8c2a~...20fa57d with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 app/models/manageiq/providers/amazon/instance_types.rb
|
@miq-bot remove_label wip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it :)
@bronaghs I had a quick search for :network_performance
and :processor_clock_speed
and it seems changing them from numerical to free text has no impact, because they are not really used in the UI.
So, please merge if you like
I have submitted this PR. That PR will enhance the site's json output so that we can eliminate the tedious manual step to curl and using 3rd party site to convert html to csv
Meanwhile we can use my forked copy and runpython scrape.py
locally to generate the json file.update
The PR to http://ec2instances.info has been merged