Project

General

Profile

Actions

Container dispatch » History » Revision 12

« Previous | Revision 12/26 (diff) | Next »
Peter Amstutz, 12/13/2015 04:26 PM


Crunch2 dispatch

Design sketch

sLURm to crunCH = "Lurch"

Flow:

  • Monitor containers table.
    1. When a new container appears, claim it
    2. Put the job into the slurm job queue with sbatch --immediate --share --export=ARVADOS_API_HOST,ARVADOS_API_TOKEN
    3. Possibly request new node from node manager (mechanism TBD, see below)
    4. Job consists of running "arv-container" on the compute node given the API token and container uuid.
    5. arv-container is responsible for actually running the container, see https://dev.arvados.org/issues/8001
    6. arv-container should update the container record unless there is a node failure
  • Monitor slurm job status
    1. Run squeue to get status
    2. Synchronize with containers table: cancel priority 0 jobs, update container status from slurm queue.

Decision points:

Two new components: arv-container and crunch-dispatch-slurm.

What language to write arv-container in?

  • If Python
    **d Will require Python SDK be installed on every compute node.
    • Could integrate FUSE mount directly instead of requiring arv-mount subprocess
  • In Go:
    • Will still require Python SDK for arv-mount
    • However, could integrate with a future Go FUSE mount; would be possible to eventually eliminate python dependencies making arv-container much more lightweight.

What language to write crunch-dispatch-slurm?

  • In Python
    • Could be integrated with node manager?
  • In Go:
    • If using websockets to listen for container events (new containers added, priority changes) will require Go websocket client

How to decide and communicate requests for new cloud nodes?

  • Could use http://slurm.schedmd.com/elastic_computing.html
    • Potentially non-trival amount of work to configure slurm
  • Compute wishlist & send to node manager
    • Need to predict how slurm will allocate jobs to nodes or risk under- or over-allocating nodes.

Retry

  • Slurm can re-queue jobs on node failure automatically *

Notes

Some discussion notes from https://dev.arvados.org/issues/6429 and https://dev.arvados.org/issues/6518

Interaction with node manager

Suggest writing crunch 2 job dispatcher as a new set of actors in node manger.

This would enable us to solve the question of communication between the scheduler and cloud node management (#6520).

Node manager already has a lot of the framework we will want like concurrency (can have one actor per job) and a configuration system.

Different schedulers (slurm, sge, kubernetes) can be implemented as modules similarly to how different cloud providers are supported now.

If we don't actually combine them, we should at least move the logic of deciding how many and what size nodes to run from the node manager to the dispatcher; the dispatcher can then communicate its wishlist to node manager.

Interaction with API

More ideas:

Have a "dispatchers" table. Dispatcher processes are responsible for pinging the API server similar to how it is done for nodes to show they are alive.

A dispatcher claims a container by setting "dispatcher" field to it's UUID. This field can only be set once and that locks the record so that only the dispatcher can update it.

If a dispatcher stops pinging, the containers it has claimed should be marked as TempFail.

Dispatchers should be able to annotate containers (preferably through links) for example "I can't run this because I don't have any nodes with 40 GiB of RAM".

Retry

How do we handle failure? Is the dispatcher required to retry containers that fail, or is the dispatcher a "best effort" service and the API decides to retry by scheduling a new container?

Currently the container_uuid field only holds a single container_uuid at a time. If the API schedules a new container, does that mean any container requests associated with that container get updated with the new container?

If the container_uuid field only holds one container at a time, and container don't link back to the container requests that created, then we don't have a way to record of past attempts to fulfill this request. This means we don't have anything to check against container_count_max. A few possible solutions:

  • Make container_uuid an array of containers created to fulfill a given container request (this introduces complexity)
  • Decrement container_count_max on the request when submitting a new container
  • Compute content address of the container request and discover containers with that content address. This would conflict with "no reuse" or "impure" requests which are supposed to ignore past execution history. Could solve this by salting the content address with a timestamp; "no reuse" containers would never ever be reusable which might be fine.

I think we should distinguish between infrastructure failure and task failure by distinguishing between "TempFail" and "PermFail" in the container state. "TempFail" shouldn't count againt the container_count_max count, or alternately we only honor container_count_max for "TempFail" tasks and don't retry "PermFail".

Ideally, "TempFail" containers should retry forever, but with a backoff. One way to do the backoff is to schedule the container to run at a specific time in the future.

Scheduling

Having a field specifying "wait until time X to run this container" would be generally useful for cron-style tasks.

State changes

Container request:

priority 0 priority > 0
Uncommitted nothing nothing
Committed set container priority to max(all request priority) set container priority to max(all request priority)
Final invalid invalid

When a container request goes to the "committed" state, it is assigned a container.

Container:

priority 0 priority > 0
Queued Desire change state to "Cancelled" Desire to change change state to "Running"
Running Desire change state to "Cancelled" nothing
Complete invalid invalid
Cancelled invalid invalid

When the container goes to either the "complete" or "cancelled" state, any associated container requests go to "final" state.

Claims

Have a field "claimed_by_uuid" on the Container record. A queued container is claimed by a dispatcher process via an atomic "claim" operation. A claim can be released if the container is still in the Queued state.

The container record cannot be updated by anyone except the owner of the claim.

Updated by Peter Amstutz over 8 years ago · 12 revisions