From dbfcc4082aa20ec7b3661a2dbd9716e91a4a34cc Mon Sep 17 00:00:00 2001 From: Determinant Date: Sun, 28 Dec 2014 00:33:01 +0800 Subject: ... --- assets/js/monitor.js | 3 --- client.py | 53 ++++++++++++++++++++++++++-------------------------- index.html | 45 +------------------------------------------- 3 files changed, 28 insertions(+), 73 deletions(-) diff --git a/assets/js/monitor.js b/assets/js/monitor.js index 2d46355..7ef1df3 100644 --- a/assets/js/monitor.js +++ b/assets/js/monitor.js @@ -170,8 +170,6 @@ LineGraph.prototype.setup = function(elem, d, i, b) { "translate(" + margin.left + "," + margin.top + ")"); var width = 500 - margin.left - margin.right; var height = 250 - margin.top - margin.bottom; - console.log(width); - console.log(height); // Set the ranges this.x = d3.scale.linear().range([0, width]); this.y = d3.scale.linear().range([height, 0]); @@ -330,7 +328,6 @@ function update_jobs(resp, after) { this.handler = new graph_handler[d.metadata.type](); this.handler.setup(this, d, i, b); }); - console.log(jobs.exit()); jobs.exit() .style("height", function(d) { return d3.select(this).style("height"); }) .transition().duration(750) diff --git a/client.py b/client.py index 6af884c..194b927 100644 --- a/client.py +++ b/client.py @@ -20,31 +20,32 @@ def check_id(val): print('invalid mid value') exit(1) -if args.create: - cmd = {'action': 'create'} - if len(args.create) >= 1: - cmd["name"] = args.create - if args.type is None: - print('please specify a type') +if __name__ == '__main__': + if args.create: + cmd = {'action': 'create'} + if len(args.create) >= 1: + cmd["name"] = args.create + if args.type is None: + print('please specify a type') + exit(1) + cmd["metadata"] = {'type' : args.type} + elif args.add: + cmd = {'action': 'add', 'jid': check_id(args.add), 'record' : args.col} + elif args.clear: + cmd = {'action': 'clear', 'jid': check_id(args.clear)} + elif args.drop: + cmd = {'action': 'drop', 'jid': check_id(args.drop)} + elif args.alter: + cmd = {'action': 'alter', 'jid': check_id(args.alter), + 'records' : [l[:-1].split() for l in stdin.readlines()]} + else: + print('please specify an action') exit(1) - cmd["metadata"] = {'type' : args.type} -elif args.add: - cmd = {'action': 'add', 'jid': check_id(args.add), 'record' : args.col} -elif args.clear: - cmd = {'action': 'clear', 'jid': check_id(args.clear)} -elif args.drop: - cmd = {'action': 'drop', 'jid': check_id(args.drop)} -elif args.alter: - cmd = {'action': 'alter', 'jid': check_id(args.alter), - 'records' : [l[:-1].split() for l in stdin.readlines()]} -else: - print('please specify an action') - exit(1) -s = socket(AF_UNIX) -s.connect("./lab_monitor.socket") -mesg = json.dumps(cmd) -mesg = pack(" - - + @@ -69,7 +27,6 @@ path { About
  • -
  • Contact
  • -- cgit v1.2.3-70-g09d2