diff --git a/scripts/plot-single-job.py b/scripts/plot-single-job.py index 7388374..426f59e 100755 --- a/scripts/plot-single-job.py +++ b/scripts/plot-single-job.py @@ -28,6 +28,10 @@ def plot(prefix, header, row): timeseries = [ [k, x, s] for (s,x) in zip(timeseries, range(1, len(timeseries))) ] result.extend(timeseries) + if len(result) == 0: + print("Empty job! Cannot plot!") + return + data = DataFrame(result, columns=["metrics", "segment", "value"]) groups = data.groupby(["metrics"]) metrics = DataFrame() @@ -36,14 +40,16 @@ def plot(prefix, header, row): metrics[name] = [x[2] for x in group.values] labels.append(name) - ax = metrics.plot(subplots=True, legend=False, sharex=True, grid = True, sharey=True, colormap='jet', marker='.', markersize=10) + ax = metrics.plot(subplots=True, legend=False, sharex=True, grid = True, sharey=True, colormap='jet', marker='.', markersize=10, figsize=(8, 2 + 2 * len(labels))) for (i, l) in zip(range(0, len(labels)), labels): ax[i].set_ylabel(l) pyplot.xlabel("Segment number") pyplot.savefig(prefix + "timeseries" + jobid + ".png") - # Plot first 30 minutes + # Plot first 30 segments + if len(timeseries) <= 50: + return ax = metrics.plot(subplots=True, legend=False, sharex=True, grid = True, sharey=True, colormap='jet', marker='.', markersize=10, xlim=(0,30)) for (i, l) in zip(range(0, len(labels)), labels): diff --git a/scripts/plot.R b/scripts/plot.R index 7aea26b..fc79b76 100755 --- a/scripts/plot.R +++ b/scripts/plot.R @@ -54,7 +54,7 @@ plotJobs = function(jobs){ # print the job timeline r = e[ordered, ] for (row in 1:length(jobs)) { - prefix = sprintf("%s-%f-%.0f", level, r[row, "similarity"], row) + prefix = sprintf("%s-%f-%.0f-", level, r[row, "similarity"], row) job = r[row, "jobid"] system(sprintf("scripts/plot-single-job.py %s %s", job, prefix)) }