Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions bin/radical-analytics-plot.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python


import os
import sys
import time
import optparse
Expand All @@ -11,6 +11,7 @@

from radical.analytics.utils import to_latex

RES = int(os.environ.get('RADICAL_ANALYTICS_RESOLUTION', 252))

# ----------------------------------------------------------------------------
#
Expand All @@ -37,7 +38,7 @@
GRID = False # True, False
FNAME = None
SAVE_AS = 'x11' # 'svg', 'png', 'x11', 'pdf'
WIDTH = 500
WIDTH = RES
HEIGHT = None
STDEV = False

Expand Down
8 changes: 5 additions & 3 deletions bin/rp_inspect/plot_conc.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env python
#!/usr/bin/env python3

__copyright__ = 'Copyright 2013-2016, http://radical.rutgers.edu'
__license__ = 'MIT'


import os
import sys

import matplotlib.pyplot as plt
Expand All @@ -14,6 +14,8 @@

from radical.analytics.utils import to_latex

RES = int(os.environ.get('RADICAL_ANALYTICS_RESOLUTION', 252))


# ----------------------------------------------------------------------------
#
Expand Down Expand Up @@ -75,7 +77,7 @@
for metric in metrics}

# prep figure
fig, ax = plt.subplots(figsize=ra.get_plotsize(500))
fig, ax = plt.subplots(figsize=ra.get_plotsize(RES))

for metric in data:
x = [e[0] for e in data[metric]]
Expand Down
57 changes: 20 additions & 37 deletions bin/rp_inspect/plot_dur.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
__copyright__ = 'Copyright 2013-2016, http://radical.rutgers.edu'
__license__ = 'MIT'


import os
import sys

import matplotlib.pyplot as plt
Expand All @@ -14,6 +14,7 @@

from radical.analytics.utils import to_latex

RES = int(os.environ.get('RADICAL_ANALYTICS_RESOLUTION', 252))

# ----------------------------------------------------------------------------
#
Expand All @@ -24,32 +25,18 @@
# The event list below will describe the whole duration (first to last event),
# and the durations between subsequential events are considered contributing
# sub-durations. For each entity, we plot the times derived that way.
#

s = ru.STATE
e = ru.EVENT
event_entities = ['task', 'master', 'worker']
event_list = [
# {ru.STATE: 'NEW' , ru.EVENT: 'state' },
# {ru.STATE: 'TMGR_SCHEDULING_PENDING' , ru.EVENT: 'state' },
# {ru.STATE: 'TMGR_SCHEDULING' , ru.EVENT: 'state' },
# {ru.STATE: 'TMGR_STAGING_INPUT_PENDING' , ru.EVENT: 'state' },
# {ru.STATE: 'TMGR_STAGING_INPUT' , ru.EVENT: 'state' },
# {ru.STATE: 'AGENT_STAGING_INPUT_PENDING' , ru.EVENT: 'state' },
# {ru.STATE: None , ru.EVENT: 'get' },
# {ru.STATE: 'AGENT_STAGING_INPUT' , ru.EVENT: 'state' },
# {ru.STATE: 'AGENT_SCHEDULING_PENDING' , ru.EVENT: 'state' },
{ru.STATE: 'AGENT_SCHEDULING' , ru.EVENT: 'state' },
# {ru.STATE: None , ru.EVENT: 'schedule_ok' },
{ru.STATE: 'AGENT_EXECUTING_PENDING' , ru.EVENT: 'state' },
{ru.STATE: 'AGENT_EXECUTING' , ru.EVENT: 'state' },
{ru.STATE: None , ru.EVENT: 'exec_start' },
# {ru.STATE: None , ru.EVENT: 'exec_ok' },
{ru.STATE: None , ru.EVENT: 'exec_stop' },
# {ru.STATE: None , ru.EVENT: 'unschedule_start'},
{ru.STATE: None , ru.EVENT: 'unschedule_stop' },
# {ru.STATE: 'AGENT_STAGING_OUTPUT_PENDING' , ru.EVENT: 'state' },
# {ru.STATE: 'TMGR_STAGING_OUTPUT_PENDING' , ru.EVENT: 'state' },
# {ru.STATE: 'TMGR_STAGING_OUTPUT' , ru.EVENT: 'state' },
# {ru.STATE: 'AGENT_STAGING_OUTPUT' , ru.EVENT: 'state' },
# {ru.STATE: 'DONE' , ru.EVENT: 'state' },
[{s: 'AGENT_SCHEDULING' , e: 'state' }, 'total'],
[{s: 'AGENT_EXECUTING_PENDING' , e: 'state' }, 'sched'],
[{s: 'AGENT_EXECUTING' , e: 'state' }, 'comm'],
[{s: None , e: 'launch_start' }, 'rp exec'],
[{s: None , e: 'exec_start' }, 'launch'],
[{s: None , e: 'exec_stop' }, 'app exec'],
[{s: None , e: 'unschedule_stop' }, 'unsched'],
]

# ------------------------------------------------------------------------------
Expand All @@ -69,8 +56,8 @@

tstamps = list()

for event in event_list:
times = thing.timestamps(event=event)
for item in event_list:
times = thing.timestamps(event=item[0])
if times: tstamps.append(times[0])
else : tstamps.append(np.nan)

Expand All @@ -96,23 +83,19 @@
# create a numpyarray for plotting
np_data = np.array(sorted_data)

fig, ax = plt.subplots(figsize=ra.get_plotsize(500))
fig, ax = plt.subplots(figsize=ra.get_plotsize(RES))

for e_idx in range(len(event_list)):
if e_idx == 0:
label = 'total'
else:
label = to_latex('%s - %s' % (ru.event_to_label(event_list[e_idx - 1]),
ru.event_to_label(event_list[e_idx])))
ax.plot(np_data[:,0], np_data[:,(1 + e_idx)], label=label)
for idx,item in enumerate(event_list):
label = to_latex(item[1])
ax.plot(np_data[:,0], np_data[:,(1 + idx)], label=label)

plt.yscale('log')

# FIXME: how to do the legend now? With the large font size, I don't see
# a way to fit it anymore... :-/
# plt.legend(fancybox=True, shadow=True)
plt.legend(loc='upper center', bbox_to_anchor=(0.5, 1.15),
ncol=2, fancybox=True, shadow=True)
plt.legend(loc='upper center', bbox_to_anchor=(0.5, 1.20),
ncol=4, fancybox=True, shadow=True)

# FIXME: why is the x-axis label gone?
plt.xlabel(to_latex('task ID'))
Expand Down
8 changes: 5 additions & 3 deletions bin/rp_inspect/plot_rate.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env python
#!/usr/bin/env python3

__copyright__ = 'Copyright 2013-2016, http://radical.rutgers.edu'
__license__ = 'MIT'


import os
import sys

import matplotlib.pyplot as plt
Expand All @@ -14,6 +14,8 @@

from radical.analytics.utils import to_latex

RES = int(os.environ.get('RADICAL_ANALYTICS_RESOLUTION', 252))


# ----------------------------------------------------------------------------
#
Expand Down Expand Up @@ -67,7 +69,7 @@
data = {metric: session.rate(event=metrics[metric], sampling=1.0)
for metric in metrics}

fig, ax = plt.subplots(figsize=ra.get_plotsize(500))
fig, ax = plt.subplots(figsize=ra.get_plotsize(RES))

for metric in data:
x = [e[0] for e in data[metric]]
Expand Down
65 changes: 31 additions & 34 deletions bin/rp_inspect/plot_state.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env python
#!/usr/bin/env python3

__copyright__ = 'Copyright 2013-2016, http://radical.rutgers.edu'
__license__ = 'MIT'


import os
import sys

import radical.utils as ru
Expand All @@ -15,6 +15,8 @@

from radical.analytics.utils import to_latex

RES = int(os.environ.get('RADICAL_ANALYTICS_RESOLUTION', 252))


# ----------------------------------------------------------------------------
#
Expand All @@ -25,33 +27,27 @@
# type `event_entity`.. Before plotting, we sort those entities by the
# timestamp of the first event in the event list

s = ru.STATE
e = ru.EVENT
event_entities = ['task', 'master', 'worker']
event_list = [
# {ru.STATE: rp.NEW , ru.EVENT: 'state' },
# {ru.STATE: rp.TMGR_SCHEDULING_PENDING , ru.EVENT: 'state' },
# {ru.STATE: rp.TMGR_SCHEDULING , ru.EVENT: 'state' },
# {ru.STATE: rp.TMGR_STAGING_INPUT_PENDING , ru.EVENT: 'state' },
# {ru.STATE: rp.TMGR_STAGING_INPUT , ru.EVENT: 'state' },
# {ru.STATE: rp.AGENT_STAGING_INPUT_PENDING , ru.EVENT: 'state' },
# {ru.COMP : 'agent_0' , ru.EVENT: 'get' },
{ru.STATE: rp.AGENT_STAGING_INPUT , ru.EVENT: 'state' },
{ru.STATE: rp.AGENT_SCHEDULING_PENDING , ru.EVENT: 'state' },
{ru.STATE: rp.AGENT_SCHEDULING , ru.EVENT: 'state' },
# {ru.STATE: None , ru.EVENT: 'schedule_ok' },
{ru.STATE: rp.AGENT_EXECUTING_PENDING , ru.EVENT: 'state' },
{ru.STATE: rp.AGENT_EXECUTING , ru.EVENT: 'state' },
# {ru.STATE: None , ru.EVENT: 'exec_mkdir' },
# {ru.STATE: None , ru.EVENT: 'exec_mkdir_done'},
{ru.STATE: None , ru.EVENT: 'exec_start' },
# {ru.STATE: None , ru.EVENT: 'app_start' },
# {ru.STATE: None , ru.EVENT: 'app_stop' },
# {ru.STATE: None , ru.EVENT: 'exec_ok' },
{ru.STATE: None , ru.EVENT: 'exec_stop' },
{ru.STATE: rp.AGENT_STAGING_OUTPUT_PENDING, ru.EVENT: 'state' },
{ru.STATE: rp.AGENT_STAGING_OUTPUT , ru.EVENT: 'state' },
# {ru.STATE: rp.TMGR_STAGING_OUTPUT_PENDING , ru.EVENT: 'state' },
# {ru.STATE: rp.TMGR_STAGING_OUTPUT , ru.EVENT: 'state' },
# {ru.STATE: rp.DONE , ru.EVENT: 'state' },
# [{s: rp.AGENT_STAGING_INPUT_PENDING , e: 'state' }, 'input_wait' ],
# [{s: rp.AGENT_STAGING_INPUT , e: 'state' }, 'input' ],
# [{s: rp.AGENT_SCHEDULING_PENDING , e: 'state' }, 'sched_wait' ],
[{s: rp.AGENT_SCHEDULING , e: 'state' }, 'sched' ],
# [{s: None , e: 'schedule_ok' }, 'sched_ok' ],
[{s: rp.AGENT_EXECUTING_PENDING , e: 'state' }, 'exec_wait' ],
[{s: rp.AGENT_EXECUTING , e: 'state' }, 'exec' ],
# [{s: None , e: 'exec_mkdir' }, 'mkdir' ],
# [{s: None , e: 'exec_mkdir_done'}, 'mkdir_ok' ],
[{s: None , e: 'exec_start' }, 'exec_start' ],
[{s: None , e: 'exec_stop' }, 'exec_stop' ],
# [{s: None , e: 'app_start' }, 'app_start' ],
# [{s: None , e: 'app_stop' }, 'app_stop' ],
# [{s: None , e: 'exec_ok' }, 'exec_ok' ],
[{s: None , e: 'exec_stop' }, 'exec_stop' ],
# [{s: rp.AGENT_STAGING_OUTPUT_PENDING, e: 'state' }, 'output_wait'],
# [{s: rp.AGENT_STAGING_OUTPUT , e: 'state' }, 'output' ],
]


Expand All @@ -74,7 +70,8 @@

tstamps = list()

for event in event_list:
for item in event_list:
event = item[0]
times = thing.timestamps(event=event)
if times: tstamps.append(times[0])
else : tstamps.append(None)
Expand Down Expand Up @@ -113,17 +110,17 @@

np_data = np.array(sorted_data)

fig, ax = plt.subplots(figsize=ra.get_plotsize(500))
fig, ax = plt.subplots(figsize=ra.get_plotsize(RES))

for e_idx in range(len(event_list)):
ax.plot(np_data[:,0], np_data[:,(1 + e_idx)],
label=to_latex(ru.event_to_label(event_list[e_idx])))
for idx,item in enumerate(event_list):
ax.plot(np_data[:,0], np_data[:,(1 + idx)],
label=to_latex(item[1]))

plt.xlabel(to_latex('task (sorted by %s)' % order))
plt.ylabel(to_latex('time [sec]'))

# FIXME: how to do the legend now? With the large font size, I don't see
plt.legend()
plt.legend(loc='upper center', bbox_to_anchor=(0.5, 1.20),
ncol=3, fancybox=True, shadow=True)
plt.savefig('%s_state.png' % session.uid)
# plt.show()

Expand Down
10 changes: 6 additions & 4 deletions bin/rp_inspect/plot_util.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env python
#!/usr/bin/env python3

__copyright__ = 'Copyright 2013-2016, http://radical.rutgers.edu'
__license__ = 'MIT'


import os
import sys

import matplotlib.pyplot as plt
Expand All @@ -13,6 +13,8 @@

from radical.analytics.utils import to_latex

RES = int(os.environ.get('RADICAL_ANALYTICS_RESOLUTION', 252))


# ----------------------------------------------------------------------------
#
Expand Down Expand Up @@ -120,7 +122,7 @@
if len(sys.argv) == 3: stype = sys.argv[2]
else : stype = 'radical.pilot'

fig, axes = plt.subplots(2, figsize=ra.get_plotsize(500))
fig, axes = plt.subplots(2, figsize=ra.get_plotsize(RES))
session = ra.Session(src, stype=stype)

# this script does not really work for many tasks
Expand Down Expand Up @@ -186,7 +188,7 @@

# Add legend for both plots
fig.legend(legend, [m[0] for m in metrics], ncol=3,
loc='upper center', bbox_to_anchor=(0.5, 1.10))
loc='upper center', bbox_to_anchor=(0.5, 1.15))


# plt.xticks(list(range(int(x_min)-1, int(x_max)+1)))
Expand Down
Loading
Loading