Project

General

Profile

Actions

Idea #9623

closed

[Crunch2] [API] Reuses Containers to satisfy ContainerRequests

Added by Brett Smith almost 8 years ago. Updated over 7 years ago.

Status:
Resolved
Priority:
Normal
Assigned To:
Category:
API
Target version:
Start date:
09/09/2016
Due date:
Story points:
2.0
Release:
Release relationship:
Auto

Description

In ContainerRequest#resolve, before creating a new Container, find out whether a Container already exists with
  • Exactly the same [command, cwd, environment, output_path, container_image, mounts, runtime_constraints] as the Container we're about to create
  • state in [Queued, Locked, Running, Complete]
  • (if state=Complete) exit_code==0
If multiple matching containers are found, take the first of:
  • The most recent container with state=Complete
  • The best Running container (order by progress desc, started_at asc -- IOW, most likely to finish soonest)
  • The best Locked container (order by priority desc, created_at asc -- IOW, most likely to start soonest)
  • The best Queued container (order by priority desc, created_at asc -- IOW, most likely to start soonest)
In order to efficiently compare equality of serialized fields like mounts, runtime_constraints, and environment, we must:
  • Recursively sort hash keys before putting them in the database. This can be done in a Container before_save hook.
  • Recursively sort hash keys before using them in a query like "where mounts=?". This must be done during ContainerRequest#resolve. (The keys do not need to be sorted in the ContainerRequest's serialized attrs.)
For now, we will not implement:
  • A mechanism allowing a client to skip re-use and force creation of a new container

Subtasks 2 (0 open2 closed)

Task #9999: Update Containers related documentation to explain how container reuse works.ResolvedRadhika Chippada09/09/2016Actions
Task #9906: Review 9623-reuse-containersResolvedRadhika Chippada09/13/2016Actions
Actions

Also available in: Atom PDF