quads icon indicating copy to clipboard operation
quads copied to clipboard

Modification of --shrink for future schedules

Open QuantumPosix opened this issue 9 months ago • 2 comments

  • QUADS version (rpm -qa | grep quads and/or quads --version): "QUADS version 2.1.6 bowie"
  • Python version: Python 3.12.7
  • Operating System: Fedora release 40 (Forty)

Describe the bug Went to shrink the with no active schedule but a future schedule to start on the next cycle. Gave following traceback:

To Reproduce

  1. quads --ls-schedule --host <host> Default cloud: cloud01 Current cloud: cloud01 753| start=2025-02-16T22:00, end=2025-03-23T22:00, cloud=cloud14 838| start=2025-03-30T22:00, end=2025-05-04T22:00, cloud=cloud50

  2. quads --shrink --host <host> --now Would you like to shrink a future allocation of <host> ? (y/N): Traceback (most recent call last): File "/usr/bin/quads", line 33, in <module> sys.exit(load_entry_point('quads==2.0', 'console_scripts', 'quads')()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/site-packages/quads/cli/main.py", line 64, in main _exit_code = qcli.run( ^^^^^^^^^ File "/usr/lib/python3.12/site-packages/quads/cli/cli.py", line 65, in run exit_code = action_meth() ^^^^^^^^^^^^^ File "/usr/lib/python3.12/site-packages/quads/cli/cli.py", line 755, in action_shrink if end_date < schedule.start or end_date > schedule.end or (not now and end_date < threshold): ^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: '<' not supported between instances of 'datetime.datetime' and 'str'

Additional context add in a exception to display a message for this side case where if the host is not currently active and has a future schedule for the host (was scheduled to go into a decom cloud assignment) shrinking that future schedule(s) to cloud01 will display an error message over attempting to perform the shrink.

QuantumPosix avatar Mar 27 '25 15:03 QuantumPosix