Commit ef1e071c authored by Maude Le Jeune's avatar Maude Le Jeune
Browse files

pbview ongoing

parent 2fc1ddec
......@@ -32,6 +32,7 @@ class PBView(TreeView):
def __init__ (self,db_file, name):
TreeView.__init__(self, db_file, name)
self.js_file += ["../static/pb.js"]
self.lst_mjd,self.lst_patch,self.lst_obs = self.get_mjd()
self.lst_obj = ['DataFolder', 'GainFolder', 'MapFolder', 'CoaddedMap', 'JKFolder']
......@@ -79,7 +80,7 @@ class PBView(TreeView):
html += '</select></td>'
## Input chkbox
dd = dict({"mjd":(self.lst_mjd,"MJD"), "patchname":(self.lst_patch,"Patch name"), "obstype":(self.lst_obs, "Obs type")})
dd = dict({"mjd":(self.lst_mjd,"MJD"), "patch":(self.lst_patch,"Patch name"), "obs":(self.lst_obs, "Obs type")})
for k,v in dd.iteritems():
html += '<tr valign="top" id="tr_id" class="filter"> <td style="width:150px;"><input id="cb_%s" type="checkbox"/><label>%s</label></td>'%(k,v[1])
html += '<td style="width:50px;"><select id="se_%s_id">'%k
......@@ -99,6 +100,32 @@ class PBView(TreeView):
@auth.pipeauth.read_access()
def search(self , mjd=None, obs=None, patch=None,obj=None):
"""
"""
html = ""
dd = dict({'DataFolder':"first", 'GainFolder':"second", 'MapFolder':"third", 'CoaddedMap':"fourth", 'JKFolder':"first"})
html = self.get_html_refresh() + '<a class="icon home" href="../%s/"><small>Home</small></a>'%(self.name)
html += '<h1> Data products in segment %s (%s) </h1>' % (dd[obj], obj)
conn = sqlite3.connect(self.db_file,check_same_thread=True)
conn.text_factory=str
ll = []
with conn:
l = conn.execute('select seg_id,curr_dir from segments where seg=?',(dd[obj],)).fetchall()
for s in l:
currdir = s[1]
html += '<div class="list"><p>Directory : %s</p> <br><br> '%( currdir)
ll = conn.execute('select str_input from tasks where seg_id=?',(s[0],)).fetchall()
r = os.path.relpath(ll[0][0], currdir)
currdir=ll[0][0].replace(r,'')
sss = ''.join(['<li><a href="pipedir?segid=%s&directory=%s"> %s </a></li>'%(s[0],e[0].replace(currdir,''),e[0]) for e in ll])
html += sss + '</ul></div>'
conn.close()
html += '</body></html>'
##html = self.pipedir(segid=None, directory=None)
return html
......@@ -125,7 +125,3 @@ function filter(){
self.location.href=url;
}
function search(){
url="search?mjd=None&obs=None&patch=None&obj=None"
self.location.href=url;
}
\ No newline at end of file
......@@ -30,25 +30,6 @@ import pickle
from cherrypy.lib import profiler
from db_utils import get_lst_tag, get_lst_date, add_tag,del_tag, _delseg, _deltask, _get_children, _get_fathers, _get_children_task, get_lst_seg
html_tmp = """
<html>
<head>
<SCRIPT SRC="../static/mktree.js" LANGUAGE="JavaScript"></SCRIPT>
<SCRIPT SRC="../static/cook.js" LANGUAGE="JavaScript"></SCRIPT>
<SCRIPT SRC="../static/tag.js" LANGUAGE="JavaScript"></SCRIPT>
<LINK REL="stylesheet" HREF="../static/mktree.css">
</head><body>
"""
html_refresh="""
<html>
<head>
<SCRIPT SRC="../static/mktree.js" LANGUAGE="JavaScript"></SCRIPT>
<SCRIPT SRC="../static/cook.js" LANGUAGE="JavaScript"></SCRIPT>
<SCRIPT SRC="../static/tag.js" LANGUAGE="JavaScript"></SCRIPT>
<LINK REL="stylesheet" HREF="../static/mktree.css">
<meta http-equiv="refresh" content="35" >
</head><body>
"""
class TreeView:
""" A minimalist pipeline Web interface.
......@@ -72,6 +53,32 @@ class TreeView:
self.name = name
## string, pipeline data base file.
self.db_file = db_file
self.js_file = ['../static/mktree.js', '../static/cook.js', '../static/tag.js']
def get_html_refresh (self, refresh=True):
"""
"""
html="""
<html>
<head>
"""
for l in self.js_file:
html += """
<SCRIPT SRC="%s" LANGUAGE="JavaScript"></SCRIPT>
"""%l
html += """
<LINK REL="stylesheet" HREF="../static/mktree.css">
"""
if refresh:
html += """
<meta http-equiv="refresh" content="35" >
"""
html+= """
</head><body>
"""
return html
@cherrypy.expose
@auth.pipeauth.write_access()
......@@ -308,7 +315,7 @@ class TreeView:
conn = sqlite3.connect(self.db_file,check_same_thread=True)
conn.text_factory=str
html = html_refresh
html = self.get_html_refresh ()
html += '<a class="icon home" href="../%s/"><small>Home</small></a>'%(self.name)
html += '<h1>Pipelines in %s </h1>'%self.name
......@@ -356,7 +363,7 @@ class TreeView:
,(segid,)).fetchone()
l = conn.execute('select str_input, task_id from tasks where seg_id=? and status=?',(segid, status)).fetchall()
conn.close()
html = html_refresh + '<a class="icon home" href="../%s/"><small>Home</small></a>'%(self.name)
html = self.get_html_refresh() + '<a class="icon home" href="../%s/"><small>Home</small></a>'%(self.name)
html += '<h1> Data products for %s tasks in segment %s </h1>' % (status, seg)
html += '<div class="list"><p>Directory : %s</p> %d <span class="%s">%s</span> tasks<br><br> '%( currdir,len(l), status, status)
html += '<a class="icon delete" href="javascript:del_prod(%d);"><small>Delete</small></a>'%(int(segid))
......@@ -460,7 +467,7 @@ class TreeView:
directory: string pipeline directory path.
"""
directory = self.check_path (segid, directory)
html = html_refresh + '<a class="icon home" href="../%s/"><small>Home</small></a>'%(self.name)
html = self.reg_html_refresh() + '<a class="icon home" href="../%s/"><small>Home</small></a>'%(self.name)
html += '<h1> Content of %s </h1> <div class="list"><ul>'%directory
lstfile = (glob(os.path.join(directory,'*')))
imglist = []
......@@ -505,7 +512,7 @@ class TreeView:
""" Print the content of the log directory.
"""
directory = logdir
html = html_tmp + '<a class="icon home" href="../%s/"><small>Home</small></a>'%(self.name)
html = get_html_refresh(refresh=False) + '<a class="icon home" href="../%s/"><small>Home</small></a>'%(self.name)
html += '<h1> Content of %s </h1> <div class="list"><a class="icon delete" href="delete_log?logdir=%s"><small>Delete logs</small></a><ul>'%(directory,logdir)
for filename in sorted(glob(os.path.join(directory,'*')), reverse=True):
absPath = os.path.abspath(filename)
......
import os
set_output(['Lancelot', 'Galahad', 'Robin', 'Arthur'])
number_of_knights = len(seg_output)
expose(['number_of_knights'])
......@@ -5,3 +6,6 @@ tf = get_data_fn('test.txt')
f = file(tf,'w')
f.write('This segment launch %d seg_second' % number_of_knights)
f.close
os.mkdir(os.path.join(get_data_fn(""), "elnod"))
os.mkdir(os.path.join(get_data_fn(""), "ces"))
mmm=1
......@@ -8,5 +8,6 @@ third -> fourth;
"""
P = pipeline.Pipeline(pipedot, code_dir='./', prefix='./')
P.push(first=[("2012-05-05","3x3"), ("2012-05-06","3x3"), ("2012-05-07","3x3")])
w, t = launch_interactive(P)
w.run()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment