Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
kypo-python-commons
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MUNI-KYPO-CRP
backend-python
kypo-python-commons
Commits
ee61ad0c
Commit
ee61ad0c
authored
3 years ago
by
Michal Urban
Browse files
Options
Downloads
Patches
Plain Diff
implemented division between HardwareUsage and Limits objects
parent
5d41b0d1
No related branches found
No related tags found
No related merge requests found
Pipeline
#173571
passed
2 years ago
Stage: build
Changes
1
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
kypo/cloud_commons/cloud_client_elements.py
+14
-7
14 additions, 7 deletions
kypo/cloud_commons/cloud_client_elements.py
with
14 additions
and
7 deletions
kypo/cloud_commons/cloud_client_elements.py
+
14
−
7
View file @
ee61ad0c
...
...
@@ -135,13 +135,13 @@ class HardwareUsage:
Used to wrap HeatStacks hardware usage.
"""
def
__init__
(
self
,
used_
vcpu
,
used_ram
,
used_
instances
,
used_
network
,
used_
subnet
,
used_
port
):
self
.
vcpu
=
used_
vcpu
self
.
ram
=
used_
ram
self
.
instances
=
used_
instances
self
.
network
=
used_
network
self
.
subnet
=
used_
subnet
self
.
port
=
used_
port
def
__init__
(
self
,
vcpu
,
ram
,
instances
,
network
,
subnet
,
port
):
self
.
vcpu
=
vcpu
self
.
ram
=
ram
self
.
instances
=
instances
self
.
network
=
network
self
.
subnet
=
subnet
self
.
port
=
port
def
__mul__
(
self
,
other
):
if
not
isinstance
(
other
,
int
):
...
...
@@ -150,6 +150,13 @@ class HardwareUsage:
return
HardwareUsage
(
self
.
vcpu
*
other
,
self
.
ram
*
other
,
self
.
instances
*
other
,
self
.
network
*
other
,
self
.
subnet
*
other
,
self
.
port
*
other
)
def
__truediv__
(
self
,
other
):
if
not
isinstance
(
other
,
Limits
):
return
NotImplemented
return
HardwareUsage
(
**
{
key
:
round
(
value
/
(
other
.
__dict__
[
key
]),
3
)
for
(
key
,
value
)
in
self
.
__dict__
.
items
()})
def
__eq__
(
self
,
other
:
'
HardwareUsage
'
):
if
not
isinstance
(
other
,
HardwareUsage
):
return
NotImplemented
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment