freezer-api/install-guide/source/sessions.rst
Saad Zaher 977ca7c548 Implemented: Installation documentation and API Ref
integrated freezer-api with openstackdoctheme lib and
os-api-ref lib to build the installation documentation
and api reference for freezer.

Change-Id: Ib5fc5f8227484525a13c3cfff9acb13d2b384e1a
Implements: blueprint implement-install-doc
Implements: blueprint implement-api-ref-doc
2016-09-07 13:20:34 +00: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