Feature #9968

[Crunch2] [API] Support container request expiry (expires_at)

Added by Tom Clegg over 2 years ago. Updated about 1 year ago.

Status:
New
Priority:
Normal
Assigned To:
-
Category:
Crunch
Target version:
Start date:
09/07/2016
Due date:
% Done:

0%

Estimated time:
Story points:
-

Description

See Containers API

Implementation has two parts:

Check for past expiry when creating/updating container requests

Filter CRs on expires_at is null or expires_at>now

This will stop a container when its requesting CR is updated to expires_at=now, for example.

Check expiry periodically

This can be implemented as a Rails script that runs as a cron job (or systemd timer).

A single postgres query should be able to return the containers whose priority has gone out of sync due to expired requests. Something like this:

select c.uuid from containers c
 join container_requests cr on (cr.container_uuid=c.uuid and cr.expires_at is null or cr.expires_at>now)
 where c.priority > 0 and c.state in ('Queued', 'Locked', 'Running')
 having cr.container_uuid is null or max(cr.priority)<c.priority

Run c.update_priority! on the selected containers.

History

#1 Updated by Tom Morris over 1 year ago

  • Target version set to Arvados Future Sprints

#2 Updated by Tom Morris about 1 year ago

  • Release deleted (11)

Also available in: Atom PDF