Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 26 additions & 3 deletions src/radical/analytics/utils/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import sys
import glob

from collections import defaultdict

import pandas as pd
import numpy as np
import matplotlib as mpl
Expand Down Expand Up @@ -228,6 +230,7 @@ def get_pilot_series(session, pilot, tmap, resrc, percent=True):

td = entity.description
etype = entity.etype
check = defaultdict(list)

transitions = tmap.get(etype)
if not transitions:
Expand Down Expand Up @@ -287,18 +290,38 @@ def get_pilot_series(session, pilot, tmap, resrc, percent=True):

ts = entity.timestamps(event=event)
if not ts:
# print('%s: no event %s for %s' % (uid, event, etype))
# print('%s: no event %s for %s' % (entity.uid, event, etype))
continue

for r in resrc:
amount = t_resrc[r]
if amount == 0:
continue
t = (ts[0] - t_min)
check['%s:%s' % (r, p_from)].append([event, -amount])
check['%s:%s' % (r, p_to )].append([event, +amount])
contribs[r][p_from].append([t, -amount])
contribs[r][p_to ].append([t, +amount])
# print('%6.3f : %-30s : %-25s : %-15s --> %-15s [%s]' %
# (t, uid, event, p_from, p_to, amount))
# print('%6.3f : %-30s : %-25s : %-15s =-> %-15s [%s]' %
# (t, entity.uid, event, p_from, p_to, amount))


for metric in check:

# all contributions to a metric should sum to zero
# if not, pprint them
tot = sum([x[1] for x in check[metric]])
if tot != 0:
print('=== %s: %s' % (entity.uid, etype))
print('WARNING: unbalanced contributions to %s: %s' %
(metric, tot))

for m in check:
print(' %-20s : %8d' % (m, sum([x[1] for x in check[m]])))
# for e in entity.events:
# print(' %6.3f : %-20s : %s' % (e[ru.TIME] - t_min,
# e[ru.EVENT], e[ru.STATE]))
break

# we now have, for all metrics, a list of resource changes, in the form of
#
Expand Down
Loading