Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
pipelet
Pipelet
Commits
ef1e071c
Commit
ef1e071c
authored
Jul 13, 2012
by
Maude Le Jeune
Browse files
pbview ongoing
parent
2fc1ddec
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
64 additions
and
29 deletions
+64
-29
pipelet/pbview.py
pipelet/pbview.py
+29
-2
pipelet/static/tag.js
pipelet/static/tag.js
+0
-4
pipelet/treeview.py
pipelet/treeview.py
+30
-23
test/first_test/first.py
test/first_test/first.py
+4
-0
test/first_test/main.py
test/first_test/main.py
+1
-0
No files found.
pipelet/pbview.py
View file @
ef1e071c
...
...
@@ -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"
),
"patch
name
"
:(
self
.
lst_patch
,
"Patch name"
),
"obs
type
"
:(
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
pipelet/static/tag.js
View file @
ef1e071c
...
...
@@ -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
pipelet/treeview.py
View file @
ef1e071c
...
...
@@ -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
)
...
...
test/first_test/first.py
View file @
ef1e071c
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
test/first_test/main.py
View file @
ef1e071c
...
...
@@ -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
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment