Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Diego Lima
/
aws-price-parser
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 43227420
authored
Nov 06, 2017
by
diegolima
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ignorar instancias nao-existentes em uma regiao
1 parent
83423130
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
35 deletions
gce_parser.py
gce_parser.py
View file @
4322742
...
...
@@ -58,41 +58,42 @@ with open(FCATALOG) as url:
cost
=
DATA
[
'gcp_price_list'
][
product
][
region
]
if
PRODUCT_FAMILY
==
COMPUTE_PRODUCT_FAMILY
:
cost
=
DATA
[
'gcp_price_list'
][
product
][
region
]
for
os
in
GCE_OS
:
if
os
==
'linux'
:
add
=
0
else
:
billing_cores
=
DATA
[
'gcp_price_list'
][
'CP-COMPUTEENGINE-OS'
][
os
][
"cores"
]
billing_cpu
=
cpu
if
billing_cores
==
'shared'
:
billing_cores
=
1
if
billing_cpu
==
'shared'
:
billing_cpu
=
1
#TODO: Make this logic elegant (use cores/shared logic)
if
'win'
in
os
:
if
'f1-micro'
in
name
or
'g1-small'
in
name
:
add
=
float
(
DATA
[
'gcp_price_list'
][
'CP-COMPUTEENGINE-OS'
][
os
][
"low"
])
else
:
add
=
float
(
DATA
[
'gcp_price_list'
][
'CP-COMPUTEENGINE-OS'
][
os
][
"high"
])
*
float
(
billing_cpu
)
elif
'rhel'
in
os
:
if
float
(
billing_cpu
)
<=
4
:
add
=
float
(
DATA
[
'gcp_price_list'
][
'CP-COMPUTEENGINE-OS'
][
os
][
"low"
])
else
:
if
float
(
cost
)
!=
0
:
for
os
in
GCE_OS
:
if
os
==
'linux'
:
add
=
0
else
:
billing_cores
=
DATA
[
'gcp_price_list'
][
'CP-COMPUTEENGINE-OS'
][
os
][
"cores"
]
billing_cpu
=
cpu
if
billing_cores
==
'shared'
:
billing_cores
=
1
if
billing_cpu
==
'shared'
:
billing_cpu
=
1
#TODO: Make this logic elegant (use cores/shared logic)
if
'win'
in
os
:
if
'f1-micro'
in
name
or
'g1-small'
in
name
:
add
=
float
(
DATA
[
'gcp_price_list'
][
'CP-COMPUTEENGINE-OS'
][
os
][
"low"
])
else
:
add
=
float
(
DATA
[
'gcp_price_list'
][
'CP-COMPUTEENGINE-OS'
][
os
][
"high"
])
*
float
(
billing_cpu
)
elif
'rhel'
in
os
:
if
float
(
billing_cpu
)
<=
4
:
add
=
float
(
DATA
[
'gcp_price_list'
][
'CP-COMPUTEENGINE-OS'
][
os
][
"low"
])
else
:
add
=
float
(
DATA
[
'gcp_price_list'
][
'CP-COMPUTEENGINE-OS'
][
os
][
"high"
])
elif
'suse-sap'
in
os
:
add
=
float
(
DATA
[
'gcp_price_list'
][
'CP-COMPUTEENGINE-OS'
][
os
][
"high"
])
elif
'suse-sap'
in
os
:
add
=
float
(
DATA
[
'gcp_price_list'
][
'CP-COMPUTEENGINE-OS'
][
os
][
"high"
])
elif
'suse'
in
os
:
if
'f1-micro'
in
name
or
'g1-small'
in
name
:
add
=
float
(
DATA
[
'gcp_price_list'
][
'CP-COMPUTEENGINE-OS'
][
os
][
"low"
])
else
:
add
=
float
(
DATA
[
'gcp_price_list'
][
'CP-COMPUTEENGINE-OS'
][
os
][
"high"
])
*
float
(
billing_cpu
)
elif
'sql'
in
os
:
if
'f1-micro'
in
name
or
'g1-small'
in
name
:
add
=
float
(
DATA
[
'gcp_price_list'
][
'CP-COMPUTEENGINE-OS'
][
'win'
][
"low"
])
else
:
add
=
float
(
DATA
[
'gcp_price_list'
][
'CP-COMPUTEENGINE-OS'
][
'win'
][
"high"
])
*
float
(
billing_cpu
)
add
=
add
+
float
(
DATA
[
'gcp_price_list'
][
'CP-COMPUTEENGINE-OS'
][
os
][
"high"
])
*
float
(
billing_cpu
)
cost
=
float
(
cost
)
+
add
print
(
'google,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s'
%
(
name
,
cpu
,
memory
,
cost
,
region
,
os
))
elif
'suse'
in
os
:
if
'f1-micro'
in
name
or
'g1-small'
in
name
:
add
=
float
(
DATA
[
'gcp_price_list'
][
'CP-COMPUTEENGINE-OS'
][
os
][
"low"
])
else
:
add
=
float
(
DATA
[
'gcp_price_list'
][
'CP-COMPUTEENGINE-OS'
][
os
][
"high"
])
*
float
(
billing_cpu
)
elif
'sql'
in
os
:
if
'f1-micro'
in
name
or
'g1-small'
in
name
:
add
=
float
(
DATA
[
'gcp_price_list'
][
'CP-COMPUTEENGINE-OS'
][
'win'
][
"low"
])
else
:
add
=
float
(
DATA
[
'gcp_price_list'
][
'CP-COMPUTEENGINE-OS'
][
'win'
][
"high"
])
*
float
(
billing_cpu
)
add
=
add
+
float
(
DATA
[
'gcp_price_list'
][
'CP-COMPUTEENGINE-OS'
][
os
][
"high"
])
*
float
(
billing_cpu
)
cost
=
float
(
cost
)
+
add
print
(
'google,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s'
%
(
name
,
cpu
,
memory
,
cost
,
region
,
os
))
else
:
print
(
'google,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s'
%
(
name
,
cpu
,
memory
,
cost
,
region
,
os
))
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment