Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Add an option to auto-cancel a pending session after specified timeout #527

Conversation

vesselofgod
Copy link
Contributor

resolves: lablup/backend.ai#337
Related to: lablup/backend.ai#343

Add an option to auto cancel a pending session after specified timeout

  • Get pending_timeout option value to the 'scheduler_opt' and if it's not zero, compare pending_timeout with duration in Pending
  • Get created_at value to the 'PendingSession' and calculate status duration in Pending

pending_timeout PR

  • Add a pending_timeout option in scheduler_opt using trafaret
    structured

@codecov
Copy link

codecov bot commented Jan 28, 2022

Codecov Report

Merging #527 (70b78f5) into main (c48a51b) will decrease coverage by 0.47%.
The diff coverage is 72.50%.

@@            Coverage Diff             @@
##             main     #527      +/-   ##
==========================================
- Coverage   49.28%   48.81%   -0.48%     
==========================================
  Files          55       55              
  Lines        9079     9342     +263     
==========================================
+ Hits         4475     4560      +85     
- Misses       4604     4782     +178     
Impacted Files Coverage Δ
src/ai/backend/manager/scheduler/fifo.py 95.52% <ø> (-0.13%) ⬇️
src/ai/backend/manager/scheduler/mof.py 93.33% <ø> (-0.79%) ⬇️
src/ai/backend/manager/scheduler/dispatcher.py 26.73% <48.48%> (+1.99%) ⬆️
src/ai/backend/manager/models/base.py 55.03% <72.22%> (+1.22%) ⬆️
src/ai/backend/manager/models/scaling_group.py 68.23% <100.00%> (+1.98%) ⬆️
src/ai/backend/manager/scheduler/drf.py 92.53% <100.00%> (+0.11%) ⬆️
src/ai/backend/manager/scheduler/predicates.py 50.00% <100.00%> (ø)
src/ai/backend/manager/scheduler/types.py 78.72% <100.00%> (+2.34%) ⬆️
src/ai/backend/manager/models/utils.py 78.01% <0.00%> (-5.68%) ⬇️
... and 3 more

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 c48a51b...70b78f5. Read the comment docs.

@vesselofgod vesselofgod changed the title Feature/add an option to auto cancel a pending session after specified timeout feat: add an option to auto cancel a pending session after specified timeout Jan 28, 2022
@vesselofgod vesselofgod self-assigned this Jan 28, 2022
@achimnol
Copy link
Member

Please merge the main branch to resolve a conflict with addition of StructuredJSONBColumn in both #523 and here.

Copy link
Member

@achimnol achimnol left a comment

Choose a reason for hiding this comment

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

Could you write a test case by setting created_at to a time in the past?

@vesselofgod
Copy link
Contributor Author

you write a test case by setting created_at to a time in

ok! I got it!

@achimnol
Copy link
Member

achimnol commented Feb 28, 2022

you write a test case by setting created_at to a time in

ok! I got it!

What I meant is to create a new test case with a specific created_at time set in the past (maybe by subtracting from the current timestamp) and test actual status transition, not just changing the values of timestamps in the test fixtures...

@vesselofgod
Copy link
Contributor Author

you write a test case by setting created_at to a time in

ok! I got it!

What I meant is to create a new test case with a specific created_at time set in the past (maybe by subtracting from the current timestamp) and test actual status transition, not just changing the values of timestamps in the test fixtures...

I'll add a new test case within this week :)

@vesselofgod
Copy link
Contributor Author

vesselofgod commented Mar 6, 2022

I tried to add a test cases and commit, but error occurred....
I think it's a branch related problem, so I'll solve it and commit.
b

vesselofgod and others added 12 commits March 9, 2022 17:48
* Temporarily remove "timeout" example session as it interfers with
  the DRF/LIFO scheduler test cases.  We should use a separate example
  session list.
* timedelta.seconds is 0 to 86399 as it has a separate field for days.
* We need to use total_seconds() to get the int representation or
  convert all operands to timedelta objects when comparing their absolute values.
@achimnol achimnol added this to the 22.03 milestone Mar 30, 2022
* Scheduler configs are now part of it as the "config" field.
* etcd's scheduler plugin config format is NOT changed.
* Fix merging of global scheduler config and local scheduler config.
@achimnol achimnol changed the title feat: add an option to auto cancel a pending session after specified timeout Add an option to auto-cancel a pending session after specified timeout Mar 30, 2022
@achimnol
Copy link
Member

Now need to perform an integratino test.

@achimnol achimnol merged commit c62ae65 into main Mar 30, 2022
@achimnol achimnol deleted the feature/add-an-option-to-auto-cancel-a-pending-session-after-specified-timeout branch March 30, 2022 12:50
achimnol added a commit that referenced this pull request Apr 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add an option to auto-cancel a pending session after specified timeout
2 participants