class Lifecycle(models.Model):
    """The Lifecycle table is the Master for a group of
    Timing detail records. There is one Lifecycle row for
    each instance seen in the event stream. The Timings
    relate to the execution time for each .start/.end event
    pair for this instance. These pairs are over the entire
    lifespan of the instance, even across multiple api requests."""
    instance = models.CharField(max_length=50, null=True,
                                blank=True, db_index=True)
    last_state = models.CharField(max_length=50, null=True,
                             blank=True, db_index=True)
    last_task_state = models.CharField(max_length=50, null=True,
                             blank=True, db_index=True)
    last_raw = models.ForeignKey(RawData, null=True)

class Timing(models.Model):
    """Each Timing record corresponds to a .start/.end event pair
    for an instance. It tracks how long it took this operation
    to execute."""
    name = models.CharField(max_length=50, db_index=True)
    lifecycle = models.ForeignKey(Lifecycle)
    start_raw = models.ForeignKey(RawData, related_name='+', null=True)
    end_raw = models.ForeignKey(RawData, related_name='+', null=True)

start_when = models.DecimalField(null=True, max_digits=20,
                                     decimal_places=6)
    end_when = models.DecimalField(null=True, max_digits=20, decimal_places=6)

diff = models.DecimalField(null=True, max_digits=20, decimal_places=6,
                               db_index=True)

def aggregate_lifecycle(raw):
    """Roll up the raw event into a Lifecycle object
    and a bunch of Timing objects.

We can use this for summarized timing reports.

Stacktack overview的更多相关文章

  1. [原] KVM 虚拟化原理探究(1)— overview

    KVM 虚拟化原理探究- overview 标签(空格分隔): KVM 写在前面的话 本文不介绍kvm和qemu的基本安装操作,希望读者具有一定的KVM实践经验.同时希望借此系列博客,能够对KVM底层 ...

  2. Activity之概览屏幕(Overview Screen)

    概览屏幕 概览屏幕(也称为最新动态屏幕.最近任务列表或最近使用的应用)是一个系统级别 UI,其中列出了最近访问过的 Activity 和任务. 用户可以浏览该列表并选择要恢复的任务,也可以通过滑动清除 ...

  3. Atitit.自然语言处理--摘要算法---圣经章节旧约39卷概览bible overview v2 qa1.docx

    Atitit.自然语言处理--摘要算法---圣经章节旧约39卷概览bible overview v2 qa1.docx 1. 摘要算法的大概流程2 2. 旧约圣经 (39卷)2 2.1. 与古兰经的对 ...

  4. Overview of OpenCascade Library

    Overview of OpenCascade Library eryar@163.com 摘要Abstract:对OpenCascade库的功能及其实现做简要介绍. 关键字Key Words:Ope ...

  5. Apache Sqoop - Overview——Sqoop 概述

    Apache Sqoop - Overview Apache Sqoop 概述 使用Hadoop来分析和处理数据需要将数据加载到集群中并且将它和企业生产数据库中的其他数据进行结合处理.从生产系统加载大 ...

  6. BOOST.Asio——Overview

    =================================版权声明================================= 版权声明:原创文章 谢绝转载  啥说的,鄙视那些无视版权随 ...

  7. Spring overview

    引子 接触Java很多年了,各种framework,却从未系统的去了解过.最近突然想清楚一件事,就是当下的目标——Focus on Java-based RESTful WS & JS.而之于 ...

  8. overview

    [1] Don’t panic! All will become clear in time; [2] You don’t have to know every detail of C++ to wr ...

  9. Atitit 知识图谱解决方案:提供完整知识体系架构的搜索与知识结果overview

    Atitit 知识图谱解决方案:提供完整知识体系架构的搜索与知识结果overview   知识图谱的表示和在搜索中的展1 提升Google搜索效果3 1.找到最想要的信息.3 2.提供最全面的摘要.4 ...

随机推荐

  1. EasyNVR摄像机无插件流媒体服务器对所在操作系统配置的需求

    背景需求 随着EasyNVR使用的用户越来越多,用户在使用过程中的常见问题我们也做出了一定的总结,以及在升级到3.0版本之后,我们的启动方式和配置 功能也有了一些改变.因此在此做出一些总结. 对于Ea ...

  2. django-websocket 安装及配置

    1.安装 dwebsocket (venv) C:\code_object\websocketTest>pip install dwebsocket -i https://pypi.douban ...

  3. shell一则-按文件每行长度排序

    按文件每行长度排序  awk -F: '{print length($0) " "  $0}' /etc/shadow | sort -r -n | awk '{print $2} ...

  4. 介绍一下Python中webbrowser的用法?

    webbrowser模块提供了一个高级接口来显示基于Web的文档,大部分情况下只需要简单的调用open()方法.webbrowser定义了如下的异常:exception webbrowser.Erro ...

  5. bzoj3007 解救小云公主

    3007: 解救小云公主 Time Limit: 5 Sec  Memory Limit: 512 MB Submit: 159  Solved: 71 [id=3007" style=&q ...

  6. Linux中的欢迎信息

    本地终端欢迎信息 /etc/issue \d     显示当前系统日期 \s     显示操作系统名称 \l      显示终端的终端号,这个比较常用 \m    显示硬件体系结构,如i386.i68 ...

  7. 通过Python操作hbase api

    # coding=utf-8 # Author: ruin """ discrible: """ from thrift.transport ...

  8. 顽石系列:CSS实现垂直居中的五种方法

    顽石系列:CSS实现垂直居中的五种方法 在开发过程中,我们可能沿用或者试探性地去使用某种方法实现元素居中,但是对各种居中方法的以及使用场景很不清晰.参考的内容链接大概如下: 行内元素:https:// ...

  9. SpringMVC:学习笔记(7)——验证器(JSR303)

    JSR 303(Bean Validation ) 说明: 在任何时候,当你要处理一个应用程序的业务逻辑,数据校验是你必须要考虑和面对的事情.应用程序必须通过某种手段来确保输入进来的数据从语义上来讲是 ...

  10. CSS清除浮动使父级元素展开的三个方法

    点评:一个没有设置高度的容器div内如果存在浮动元素(即使用了属性float:left或者float:right),那么该父级元素会无法展开,下面举个例子为大家详细介绍下,希望对大家有所帮助 一个没有 ...