Commit 2fc1ddec authored by Maude Le Jeune's avatar Maude Le Jeune
Browse files

still ongoing

parent 8db50e34
......@@ -59,6 +59,21 @@ def get_lst_tag (db_file):
lst.append(e)
return lst
def get_lst_seg (db_file):
""" Return the list of segment name
Returns
-------
list of string
"""
conn = sqlite3.connect(db_file,check_same_thread=True)
conn.text_factory=str
lst = []
with conn:
l = conn.execute('select distinct seg from segments').fetchall()
lst = [s[0] for s in l]
return lst
def get_lst_date (db_file):
""" Return the list of existing dates
......@@ -73,7 +88,7 @@ def get_lst_date (db_file):
conn.text_factory=str
with conn:
l = conn.execute('select queued_on from tasks group by queued_on').fetchall()
return l
return l[0]
def add_tag (db_file, segid, tag):
......@@ -171,7 +186,7 @@ def _delseg(db_file, lst_seg):
except:
pass
if lst_seg:
_delseg(lst_seg)
_delseg(db_file, lst_seg)
def _deltask(db_file, lst_task):
......@@ -200,7 +215,7 @@ def _deltask(db_file, lst_task):
except:
pass
if lst_task:
_deltask(lst_task)
_deltask(db_file, lst_task)
def _get_fathers(db_file, segid):
""" Append upstream pipeline instance paths to the current path.
......@@ -226,7 +241,7 @@ def _get_fathers(db_file, segid):
conn.close()
if fids:
for l in fids:
lstid += _get_fathers(l[0])
lstid += _get_fathers(db_file,l[0])
return lstid
def _get_children(db_file, segid):
......@@ -252,7 +267,7 @@ def _get_children(db_file, segid):
conn.close()
if fids:
for l in fids:
lstid += _get_children(l[0])
lstid += _get_children(db_file, l[0])
return lstid
......@@ -279,5 +294,5 @@ def _get_children_task(db_file, taskid):
conn.close()
if fids:
for l in fids:
lstid += _get_children_task(l[0])
lstid += _get_children_task(db_file, l[0])
return lstid
## Copyright (C) 2008, 2009, 2010 APC LPNHE CNRS Universite Paris Diderot <lejeune@apc.univ-paris7.fr> <betoule@apc.univ-paris7.fr>
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, see http://www.gnu.org/licenses/gpl.html
try:
import sqlite3
except ImportError:
import pysqlite2 as sqlite3
import pickle
import os
import glob
import cherrypy
import auth
from pipelet.web import TreeView
class PBView(TreeView):
""" A pipeline Web interface dedicated to Polarbear experiment
It extends the minimalist tree view with a search object panel.
"""
def __init__ (self,db_file, name):
TreeView.__init__(self, db_file, name)
self.lst_mjd,self.lst_patch,self.lst_obs = self.get_mjd()
self.lst_obj = ['DataFolder', 'GainFolder', 'MapFolder', 'CoaddedMap', 'JKFolder']
def get_mjd (self):
conn = sqlite3.connect(self.db_file,check_same_thread=True)
conn.text_factory=str
ll = []
with conn:
l = conn.execute('select seg_id from segments where seg=?',("first",)).fetchall()
for s in l:
ll += conn.execute('select input,str_input from tasks where seg_id=?',(s[0],)).fetchall()
conn.close()
lst_mjd = []
lst_patch= []
lst_dir = []
for e in ll:
i = pickle.loads(e[0])
lst_mjd += [k[0] for k in i.values()]
lst_patch+= [k[1] for k in i.values()]
tmplst = os.listdir(e[1])
lst_dir += [f for f in tmplst
if os.path.isdir(os.path.join(e[1],f)) ]
lst_mjd = list(set(lst_mjd))
lst_patch= list(set(lst_patch))
lst_dir = list(set(lst_dir))
return (lst_mjd,lst_patch, lst_dir)
def filter_panel (self, l):
""" Return an html string containing the filter panel
"""
html = TreeView.filter_panel(self, l)
html += '<div id=right><fieldset id="right"><legend><span class="text">Search</span></legend>'
html += '<table width="100%">'
## Object chkbox
html += '<tr valign="top" id="tr_obj_id" class="filter"> <td style="width:150px;"><input id="cb_obj" type="checkbox"/><label>Object type</label></td>'
## Object select
html += '<td style="width:50px;"><select id="se_obj_id">'
for t in self.lst_obj:
html +='<option value="%s">%s</option>'%(t, t)
html += '</select></td>'
## Input chkbox
dd = dict({"mjd":(self.lst_mjd,"MJD"), "patchname":(self.lst_patch,"Patch name"), "obstype":(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
for t in v[0]:
html +='<option value="%s">%s</option>'%(t, t)
html += '</select></td>'
## Buttons
html += '<td class="buttons">'
html += '<a class="icon apply" href="javascript:search();"><small>Apply</small></a>'%()
html += '</td><tr></tr></table>'
html += '</fieldset></div>'
return html
@cherrypy.expose
@auth.pipeauth.read_access()
def search(self , mjd=None, obs=None, patch=None,obj=None):
"""
"""
html = ""
return html
......@@ -87,6 +87,20 @@ a{
}
a:hover { text-decoration: underline; }
#right{
float:left;
width:55%;
}
#left{
float:left;
width:45%;
}
#thumb{
width:95%;
}
#pipelist{
width:60%;
}
......
......@@ -94,23 +94,38 @@ function del_prod(segid) {
// filter pipelines
function filter(){
var cbtag = document.getElementById('cb_tag') ;
var istag = cbtag.checked;
var tag = "None"
if (istag)
var recursive= document.getElementById('cb_rec').checked;
var cbtag = document.getElementById('cb_tag') ;
var istag = cbtag.checked;
var tag = "None"
if (istag)
{
var seltag = document.getElementById('se_tag_id') ;
tag = seltag.options[seltag.selectedIndex].text;
var seltag = document.getElementById('se_tag_id') ;
tag = seltag.options[seltag.selectedIndex].text;
}
var cbdate = document.getElementById('cb_date') ;
var isdate = cbdate.checked;
var date = "None"
if (isdate)
var cbdate = document.getElementById('cb_date') ;
var isdate = cbdate.checked;
var date = "None"
if (isdate)
{
var seldate = document.getElementById('se_date_id') ;
date = seldate.options[seldate.selectedIndex].text;
var seldate = document.getElementById('se_date_id') ;
date = seldate.options[seldate.selectedIndex].text;
}
var url = "filter?tag="+tag+"&date="+date;
self.location.href=url;
var url = "filter?tag="+tag+"&date="+date;
var cbseg = document.getElementById('cb_seg') ;
var isseg = cbseg.checked;
var seg = "None"
if (isseg)
{
var selseg = document.getElementById('se_seg_id') ;
seg = selseg.options[selseg.selectedIndex].text;
url = "filter?seg="+seg;
}
url = url+'&recursive='+recursive;
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
This diff is collapsed.
This diff is collapsed.
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