Exemple #1
0
def _col_duration(res):
    st = dget(res, ["res", "status", "startTime"])
    ct = dget(res, ["res", "status", "completionTime"])
    if st and ct:
        return age(st, ct, ts1_type="iso", ts2_type="iso")
    else:
        return ""
Exemple #2
0
def _col_since(res):
    conds = dget(res, ["res", "status", "conditions"])
    if conds:
        ltt = [
            c["lastTransitionTime"] for c in conds if c["type"] == "Available"
        ]
        if ltt:
            yfile_ts = dget(res, ["yfile_ts"])
            return age(ltt[0], yfile_ts)
    return "Unknown"
Exemple #3
0
def _col_updated(res):
    creation_ts = []
    tags = dget(res, ["res", "status", "tags"], [])
    if tags:
        for tag in tags:
            items = dget(tag, ["items"], [])
            if items:
                for item in items:
                    created = dget(item, ["created"])
                    if created:
                        creation_ts.append(created)
    latest = None
    if creation_ts:
        for cts in creation_ts:
            if isinstance(cts, datetime):
                cts = cts.isoformat()
            p_cts = parse(cts)
            if (latest is None or p_cts > latest):
                latest = p_cts
    if latest:
        return age(latest.isoformat(), dget(res, ["yfile_ts"]))
Exemple #4
0
def _col_last_schedule(res):
    last_sched = dget(res, ["res", "status", "lastScheduleTime"])
    if last_sched:
        return age(last_sched, dget(res, ["yfile_ts"]))
    return ""
Exemple #5
0
def _col_age(res):
    pod_ct = dget(res, ["res", "metadata", "creationTimestamp"])
    yfile_ts = dget(res, ["yfile_ts"])
    return age(pod_ct, yfile_ts)
Exemple #6
0
def _col_last_seen(res):
    return age(dget(res, ["res", "lastTimestamp"]), dget(res, ["yfile_ts"]))
Exemple #7
0
def _col_started(res):
    stt = dget(res, ["res", "status", "startTimestamp"])
    if stt:
        yfile_ts = dget(res, ["yfile_ts"])
        return age(stt, yfile_ts)