Commit 2fb2ce5f authored by Qarnot computing's avatar Qarnot computing

Don't mix relocate and shift

parent 8439a5c4
......@@ -388,7 +388,7 @@ class EOPlanSourceHttp(EOPlanSource):
end=self.timestamp_ms_to_datetime(plan.endTime), name=plan.type, value=plan.amount,
active=plan.active, sdtwPercentage=plan.movePercentage,
move_from_date=self.timestamp_ms_to_datetime(plan.moveFromDate))
for plan in plan_from_eo if plan.type == 'Shift delay-tolerant workload (KWh)'
for plan in plan_from_eo if plan.type == 'Relocate Load (KWh)'
]
whole_plans = [EOPlan(None, shifting_plan, None) for shifting_plan in shifting_plans_for_relocation]
......
import asyncio
import logging as log
from datetime import datetime, timezone
from datetime import datetime, timedelta, timezone
from typing import List, Tuple
from .db_api import DBApiClient, Server
......@@ -229,12 +229,6 @@ class ITLBClientDaemon:
log.info("Start handling relocate plan")
eo_plan = eo_plan_impl.eo_plan
now = datetime.now(tz=timezone.utc)
if eo_plan.relocate.move_from_date < now:
log.warning("Relocate plan %s requires moving ITL from %s, which is in the past. Ignore.",
eo_plan.aggregate_id, eo_plan.relocate.move_from_date)
return None, "move_from_date is in the past"
available_it_loads = await self._db_api_client.get_it_loads()
available_it_loads = [itl for itl in available_it_loads if not itl.already_gone]
ips_to_offer = []
......@@ -294,7 +288,8 @@ class ITLBClientDaemon:
for ips in to_remove:
ips_to_offer.remove(ips)
migration_request = await self._to_migration_request(eo_plan.relocate.move_from_date, eo_plan.relocate.end,
move_start_time = eo_plan.relocate.start + timedelta(milliseconds=eo_plan.relocate.move_from_date)
migration_request = await self._to_migration_request(move_start_time, eo_plan.relocate.end,
[ips.itl for ips in ips_to_offer])
# Mark ITLs as migrated, so no longer there
for ips in ips_to_offer:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment