From f3285bef066fb603cbb2939dce1e90e539a84433 Mon Sep 17 00:00:00 2001 From: Komal Thareja Date: Wed, 30 Oct 2024 12:08:56 -0400 Subject: [PATCH] max default duration --- fabric_cf/orchestrator/core/orchestrator_handler.py | 4 ++-- .../orchestrator/swagger_server/response/slices_controller.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fabric_cf/orchestrator/core/orchestrator_handler.py b/fabric_cf/orchestrator/core/orchestrator_handler.py index 8a9cc3c2..c7cc8299 100644 --- a/fabric_cf/orchestrator/core/orchestrator_handler.py +++ b/fabric_cf/orchestrator/core/orchestrator_handler.py @@ -863,9 +863,9 @@ def __compute_lease_end_time(self, lease_end_time: datetime = None, allow_long_l raise ValueError("Requested lease end time is in the past.") default_max_duration = (Constants.LONG_LIVED_SLICE_TIME_WEEKS - if allow_long_lived else Constants.DEFAULT_MAX_DURATION_IN_WEEKS) + if allow_long_lived else Constants.DEFAULT_MAX_DURATION_IN_WEEKS).total_seconds() # Convert weeks to hours - default_max_duration *= 168 + default_max_duration /= 3600 # Calculate lifetime if not directly provided if lifetime is None: diff --git a/fabric_cf/orchestrator/swagger_server/response/slices_controller.py b/fabric_cf/orchestrator/swagger_server/response/slices_controller.py index f0ab8e98..084e1bd2 100644 --- a/fabric_cf/orchestrator/swagger_server/response/slices_controller.py +++ b/fabric_cf/orchestrator/swagger_server/response/slices_controller.py @@ -92,7 +92,7 @@ def slices_creates_post(body: SlicesPost, name, lifetime=None, lease_start_time= message="The requested lease duration must be at least 60 minutes." ) - max_duration_hours = Constants.DEFAULT_MAX_DURATION_IN_WEEKS * 168 # Convert weeks to hours + max_duration_hours = Constants.DEFAULT_MAX_DURATION_IN_WEEKS.total_seconds() / 3600 # Convert weeks to hours if diff > timedelta(hours=max_duration_hours): raise OrchestratorException( http_error_code=BAD_REQUEST,