Skip to content

Commit

Permalink
new bokeh function signatures adhered to in views.py
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Aug 13, 2019
1 parent 13f926a commit 06c0308
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 19 deletions.
6 changes: 3 additions & 3 deletions tacc_stats.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
# server = database and rmq server hostname
# data_dir = where data is stored
[DEFAULT]
machine = stampede2
data_dir = /tacc_stats_site/%(machine)s
server = stats.stampede2.tacc.utexas.edu
machine = frontera
data_dir = /scratch1/projects/tacc_stats/%(machine)s
server = stats.frontera.tacc.utexas.edu

## RabbitMQ Configuration
# RMQ_SERVER = RMQ server
Expand Down
17 changes: 12 additions & 5 deletions tacc_stats/listend.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,22 @@
from fcntl import flock, LOCK_EX, LOCK_NB

def on_message(channel, method_frame, header_frame, body):
if body[0] == '$': host = body.split('\n')[1].split()[1]
else: host = body.split()[2]

try:
message = body.decode()
except:
print("Unexpected error at decode:", sys.exc_info()[0])
return

if message[0] == '$': host = message.split('\n')[1].split()[1]
else: host = message.split()[2]

host_dir = os.path.join(cfg.archive_dir, host)
if not os.path.exists(host_dir):
os.makedirs(host_dir)

current_path = os.path.join(host_dir, "current")
if body[0] == '$':
if message[0] == '$':
if os.path.exists(current_path):
os.unlink(current_path)

Expand All @@ -25,7 +32,7 @@ def on_message(channel, method_frame, header_frame, body):
os.link(current_path, link_path)

with open(current_path, 'a') as fd:
fd.write(body)
fd.write(message)

channel.basic_ack(delivery_tag=method_frame.delivery_tag)

Expand All @@ -39,7 +46,7 @@ def on_message(channel, method_frame, header_frame, body):
parameters = pika.ConnectionParameters(cfg.rmq_server)
connection = pika.BlockingConnection(parameters)
channel = connection.channel()
channel.basic_consume(on_message, cfg.rmq_queue)
channel.basic_consume(cfg.rmq_queue, on_message)
try:
channel.start_consuming()
except KeyboardInterrupt:
Expand Down
19 changes: 9 additions & 10 deletions tacc_stats/site/machine/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,14 @@ def index(request, **kwargs):
fields['nj'] = job_list.count()

job_list = job_list.annotate(queue_wait = F("start_epoch") - F("queue_time"))
fields["script"], fields["div"] = components(gridplot(job_hist(job_list, "run_time", "Hours",
scale = 3600),
job_hist(job_list, "nodes", "# Nodes"),
job_hist(job_list, "queue_wait", "Hours",
scale = 3600),
job_hist(job_list, "avg_openclose", "iops"),
ncols = 2, toolbar_options = {"logo" : None},
plot_width = 400, plot_height = 200)
)
fields["script"], fields["div"] = components(gridplot([job_hist(job_list, "run_time", "Hours",
scale = 3600),
job_hist(job_list, "nodes", "# Nodes"),
job_hist(job_list, "queue_wait", "Hours",
scale = 3600),
job_hist(job_list, "avg_openclose", "iops")],
ncols = 2,
plot_width = 400, plot_height = 200))
# Computed Metrics
job_list = job_list.filter(run_time__gt = 600).exclude(queue__in = ["development", "skx-dev"])
fields['cat_job_list'] = job_list.filter(Q(time_imbalance__lte = 0.001) | \
Expand Down Expand Up @@ -242,7 +241,7 @@ def list_to_dict(job_list, metric):
def job_hist(job_list, value, units, scale = 1.0):
hover = HoverTool(tooltips = [ ("jobs", "@top"), ("bin", "[@left, @right]") ], point_policy = "snap_to_data")
TOOLS = ["pan,wheel_zoom,box_zoom,reset,save,box_select", hover]
p1 = figure(title = value, logo = None,
p1 = figure(title = value,
toolbar_location = None, plot_height = 400, plot_width = 600, y_axis_type = "log", tools = TOOLS)
p1.xaxis.axis_label = units
p1.yaxis.axis_label = "# Jobs"
Expand Down
2 changes: 1 addition & 1 deletion tacc_stats/site/tacc_stats_site/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import tacc_stats.site.tacc_stats_site as tacc_stats_site
DIR = os.path.dirname(os.path.abspath(__file__))

DEBUG = False
DEBUG = True

ADMINS = (
('Richard Todd Evans', '[email protected]'),
Expand Down

0 comments on commit 06c0308

Please sign in to comment.