A simple python client script may be used to watch over a suite:
python ecflow_client.py localhost 31415 /compo/main/12
This simple example may be extended to generate a html page.
It clearly needs to be refined to provide the expected output.
Next step may be to introduce javaScript and jQuery:
JQUERY = HOME + "jquery-1.10.2.min.js" SIMPLE_CSS = """ <style type="text/css"> body {background: #ffffff; color: #000000 } A:link {color: blue} A:visited {color: purple} A:active {color: blue} A:link, A:visited, A:active {text-decoration: underline; } li.unknown { background: #bfbfbf } li.complete { background: yellow } li.queued { background: #add9e7 } li.submitted { background: #04e1d1 } li.active { background: #00ff00 } li.suspended { background: #ffa600 } li.aborted { background: #ff0000 } li.shutdown { background: #ffc1cc } li.halted { background: #ef83ef } li.set { background: #bbbbff } li.clear { background: #bbbbbb } /* ul li { list-style: disc; } ul ul li { list-style: circle; } ul ul ul li { list-style: square; } */ </style> """ # NODES: def, suite, family, task # ATTRIBUTES: autocancel, clock, complete, cron, date, day, defstatus, edit # event, inlimit, label, late, limit, meter, repeat, time, today, trigger class ObserverJS(Observer): """ simple ecflow watchdog class + html output """ def __init__(self, defs, node, port, path, fname="ecflow.html"): super(ObserverJS, self).__init__(defs, node, port, path) self.fname = fname self.status_mask = ("queued", "complete", "unknown") def process_node(self, node, fp): if node is None: return elif isinstance(node, ec.Alias): return elif isinstance(node, ec.Defs): status = "%s" % node.get_server_state() status = status.lower() name = "%s@%s" % (self.node, self.port) else: status = "%s" % node.get_state() name = node.name() if status in self.status_mask: return print >>fp, "<ul>" print >>fp, "<li class='%s fold'>%s" % (status, name) if isinstance(node, ec.Defs): for kid in node.suites: self.process_node(kid, fp) else: for kid in node.nodes: self.process_node(kid, fp) print >>fp, "</li></ul>" def gen_html(self, fp, node): print >>fp, HEADER.format(node_full_name= self.path, hostname= self.node, css= "", # CSS, hostport= self.port) print >>fp,""" <h2>Status tree of {node_full_name} in {hostname}-{hostport} </h2>""".format(node_full_name= self.path, hostname= self.node, hostport= self.port) print >>fp, """<!-- wget http://code.jquery.com/jquery-1.10.2.min.js python ecflow_client.py localhost 31415 /verify example.html firefox example.html wget https://github.com/mbostock/d3/archive/master.zip # http://d3js.org/ # http://www.randelshofer.ch/treeviz/ --> <script src="{jquery}"></script>""".format(jquery= JQUERY) print >>fp, SIMPLE_CSS if isinstance(node, ec.Defs): status = "%s" % node.get_server_state() d = [ { "name": "%s-%s" % (self.node, self.port), "status": status.lower(), "kids": [ self.get_dict(kids) for kid in node.suites ] } ] elif (isinstance(node, ec.Suite) or isinstance(node, ec.Family) or isinstance(node, ec.Task)): d = [ self.get_dict(node) ] else: d = {}; print type(node); return import json print d print >>fp, """<script type="text/javascript"> var html = []; var tree= """, json.dumps(d), """; function createList(arr) { html.push('<ul>'); $.each(arr, function(index, item) { if (item==null) { return; } html.push("<li class='" + item.status + " fold'>"+item.name); if (item.kids) { createList(item.kids); } html.push("</li>"); }); html.push('</ul>'); } createList(tree); $('body').append(html.join('')); </script> """ self.process_node(node, fp) print >>fp, FOOTER def get_dict(self, node): status = "%s" % node.get_state() if status in self.status_mask: return # reduce output return { "name": node.name(), "status": status.lower(), "kids": [ self.get_dict(kid) for kid in node.nodes ]} def run(self): client = ec.Client(self.node, self.port) while 1: client.sync_local() # get changes, if self.path == "/": node = client.get_defs() else: node = client.get_defs().find_abs_node(self.path) if 0: assert node is not None fp = open(self.fname, "w") self.gen_html(fp, node) fp.close() time.sleep(90)
Or even to use one of these nice libraries for fancy rendering (d3 as Treemap or SunBurst):