Skip to content

Add the price model#286

Merged
Jinyu-W merged 39 commits into
microsoft:v0.2from
MicrosoftHam:v0.2_add_price_model
Mar 21, 2021
Merged

Add the price model#286
Jinyu-W merged 39 commits into
microsoft:v0.2from
MicrosoftHam:v0.2_add_price_model

Conversation

@MicrosoftHam
Copy link
Copy Markdown
Contributor

Description

  • Add the price model
  • Modify the energy curve

Linked issue(s)/Pull request(s)

Type of Change

  • Non-breaking bug fix
  • Breaking bug fix
  • New feature
  • Test
  • Doc update
  • Docker update

Related Component

  • Simulation toolkit
  • RL toolkit
  • Distributed toolkit

Has Been Tested

  • OS:
    • Windows
    • Mac OS
    • Linux
  • Python version:
    • 3.6
    • 3.7
  • Key information snapshot(s):

Needs Follow Up Actions

  • New release package
  • New docker image

Checklist

  • Add/update the related comments
  • Add/update the related tests
  • Add/update the related documentations
  • Update the dependent downstream modules usage

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 2, 2021

Codecov Report

Merging #286 (7fd3bb7) into v0.2 (e0f3c56) will increase coverage by 2.82%.
The diff coverage is 91.17%.

Impacted file tree graph

@@            Coverage Diff             @@
##             v0.2     #286      +/-   ##
==========================================
+ Coverage   65.92%   68.75%   +2.82%     
==========================================
  Files         115      115              
  Lines        6098     6128      +30     
==========================================
+ Hits         4020     4213     +193     
+ Misses       2078     1915     -163     
Flag Coverage Δ
unittests 68.75% <91.17%> (+2.82%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...mulator/scenarios/vm_scheduling/virtual_machine.py 88.57% <66.66%> (+54.19%) ⬆️
...mulator/scenarios/vm_scheduling/business_engine.py 78.66% <92.59%> (+29.34%) ⬆️
maro/simulator/scenarios/vm_scheduling/common.py 89.18% <100.00%> (+32.04%) ⬆️
...ulator/scenarios/vm_scheduling/physical_machine.py 98.68% <100.00%> (+12.01%) ⬆️
maro/simulator/core.py 80.88% <0.00%> (+0.73%) ⬆️
maro/simulator/scenarios/helpers.py 76.66% <0.00%> (+3.33%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e0f3c56...7fd3bb7. Read the comment docs.

@Jinyu-W Jinyu-W self-requested a review March 2, 2021 07:58
@Jinyu-W Jinyu-W added the vm scheduling data center scenario. label Mar 2, 2021
Comment thread maro/simulator/scenarios/vm_scheduling/business_engine.py Outdated
Comment thread maro/simulator/scenarios/vm_scheduling/business_engine.py Outdated
Comment thread maro/simulator/scenarios/vm_scheduling/business_engine.py Outdated
Comment thread maro/simulator/scenarios/vm_scheduling/business_engine.py Outdated
Comment thread maro/simulator/scenarios/vm_scheduling/business_engine.py Outdated
Comment thread maro/simulator/scenarios/vm_scheduling/virtual_machine.py Outdated
Comment thread maro/simulator/scenarios/vm_scheduling/virtual_machine.py Outdated
Comment thread maro/simulator/scenarios/vm_scheduling/virtual_machine.py Outdated
Comment thread maro/simulator/scenarios/vm_scheduling/virtual_machine.py Outdated
Comment thread maro/simulator/scenarios/vm_scheduling/business_engine.py Outdated
Comment thread maro/simulator/scenarios/vm_scheduling/business_engine.py Outdated
Comment thread maro/simulator/scenarios/vm_scheduling/business_engine.py Outdated
Comment thread maro/simulator/scenarios/vm_scheduling/business_engine.py Outdated
Comment thread maro/simulator/scenarios/vm_scheduling/business_engine.py Outdated
Comment thread maro/simulator/scenarios/vm_scheduling/business_engine.py Outdated

def _update_energy_consumption_cost(self):
for pm in self._machines:
pm_cost = pm.energy_consumption * (self._unit_energy_price / 1000.0) * self._power_usage_efficiency
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you need to divide a constant in code, why not directly modify the factor in config?

Comment thread maro/simulator/scenarios/vm_scheduling/virtual_machine.py Outdated
PRICE_PER_MEMORY: 0.0078
# The parameters refer to https://www.microsoft.com/en-us/research/wp-content/uploads/2009/01/p68-v39n1o-greenberg.pdf
# Unit price of Energy
UNIT_ENERGY_PRICE: 0.07
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

energy_price per what ?

Comment thread maro/simulator/scenarios/vm_scheduling/business_engine.py Outdated

if self._kill_all_vms_if_overload:
for vm_id in vm_ids:
self._total_incomes -= self._live_vms[vm_id].get_income_till_now(tick)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since overload is called before be._update_income; and the vm.get_income_till_now will take the income of current tick into account. one more unit_price is decreased?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you solve it? You didn't reply me.

Comment thread tests/vm_scheduling/env_config.yml Outdated
@@ -0,0 +1,8 @@
env:
scenario: vm_scheduling
topology: azure.2019.10k
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use a toy topology instead. It's better to "debug". and better to be used for UnitTest here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reminder

vm_id=decision_event.vm_id,
pm_id=decision_event.valid_pms[0]
)
self.metrics, decision_event, is_done = env.step(action)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image that you are designing the test cases. If I told your final metrics are wrong, the thing you need to do is using a toy case (so that you can know the output of every step), and compare the output of the program to the correct output.

Not run the whole program to check if it is aligned with your current output. You never know whether your current output is correct or not.

Comment thread maro/simulator/scenarios/vm_scheduling/business_engine.py

if self._kill_all_vms_if_overload:
for vm_id in vm_ids:
self._total_incomes -= self._live_vms[vm_id].get_income_till_now(tick)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you solve it? You didn't reply me.

Comment thread maro/simulator/scenarios/vm_scheduling/virtual_machine.py
Comment thread tests/vm_scheduling/env_config.yml Outdated
@@ -0,0 +1,8 @@
env:
scenario: vm_scheduling
topology: azure.2019.10k
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reminder

Comment thread tests/vm_scheduling/env_config.yml Outdated
topology: azure.2019.10k
start_tick: 1
durations: 8638
resolution: 1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, besides the topology problem. Since it is also for a specific test, the configs in this file can also be written down in the code directly.

@@ -511,7 +510,6 @@ def post_step(self, tick: int):
# Update the energy consumption cost.
pm_cost = (
pm.energy_consumption
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if the unit of energy_consumption should be kwh or not?

@@ -0,0 +1,69 @@
# Initial buffer time budget.
BUFFER_TIME_BUDGET: 0
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refer to tests/citi_bike/test_bike_scenario.py
and tests/data/citi_bike/case_1

move the test data and config to under test/ folder

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reminder

@Jinyu-W Jinyu-W merged commit 49771cf into microsoft:v0.2 Mar 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

vm scheduling data center scenario.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants