freezer/doc/source/contributor/sessions.rst
Andreas Jaeger e63a2fc853 Move non-install guide docs around
These documents are not part of an install guide, move them to
contributor docs.

Change-Id: Icd420a651b930f8ee8a52f39c88b2dc1961ec12e
2017-09-22 07:12:11 +02:00

2.6 KiB

Sessions

A session is a group of jobs which share the same scheduling time. A session is identified by its session_id and has a numeric tag (session_tag) which is incremented each time that a new session is started. The purpose of the session_tag is that of identifying a group of jobs which have been executed together and which therefore represent a snapshot of a distributed system.

When a job is added to a session, the scheduling time of the session is copied into the job data structure, so that any job belonging to the same session will start at the same time.

Session Data Structure

session =
{
  "session_id": string,
  "session_tag": int,
  "description": string,
  "hold_off": int (seconds),
  "schedule": { scheduling information, same as jobs },
  "jobs": { 'job_id_1': {
              "client_id": string,
              "status": string,
              "result": string
              "time_started": int  (timestamp),
              "time_ended":   int  (timestamp),
            },
            'job_id_2': {
              "client_id": string,
              "status": string,
              "result": string
              "time_started": int  (timestamp),
              "time_ended":   int  (timestamp),
            }
          }
  "time_start": int timestamp,
  "time_end": int timestamp,
  "time_started": int  (timestamp),
  "time_ended":   int  (timestamp),
  "status": string "completed" "running",
  "result": string "success" "fail",
  "user_id": string
}

Session actions

When the freezer scheduler running on a node wants to start a session, it sends a POST request to the following endpoint:

POST   /v1/sessions/{sessions_id}/action

The body of the request bears the action and parameters

Session START action

{
    "start": {
        "job_id": "JOB_ID_HERE",
        "current_tag": 22
    }
}

Example of a successful response

{
    'result': 'success',
    'session_tag': 23
}

Session STOP action

{
    "end": {
        "job_id": "JOB_ID_HERE",
        "current_tag": 23,
        "result": "success|fail"
    }
}

Session-Job association

PUT    /v1/sessions/{sessions_id}/jobs/{job_id}    adds the job to the session
DELETE /v1/sessions/{sessions_id}/jobs/{job_id}    adds the job to the session