Skip to content

Commit

Permalink
max default duration
Browse files Browse the repository at this point in the history
  • Loading branch information
kthare10 committed Oct 30, 2024
1 parent 49cfc44 commit f3285be
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions fabric_cf/orchestrator/core/orchestrator_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit f3285be

Please sign in to comment.