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
Docker-in-Docker (DinD) capabilities of public runners deactivated.
More info
Open sidebar
pipelet
Pipelet
Commits
f66d2320
Commit
f66d2320
authored
Feb 11, 2011
by
Maude Le Jeune
Browse files
Merge branch 'v1.0' into v1.1
parents
fb3216f7
68dd4db7
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
37 additions
and
22 deletions
+37
-22
pipelet/auth.py
pipelet/auth.py
+7
-2
pipelet/repository.py
pipelet/repository.py
+2
-2
pipelet/scheduler.py
pipelet/scheduler.py
+10
-7
pipelet/web.py
pipelet/web.py
+13
-6
pipelet/worker.py
pipelet/worker.py
+2
-2
test/cmb/cmb.py
test/cmb/cmb.py
+2
-1
test/cmb/noise.py
test/cmb/noise.py
+1
-2
No files found.
pipelet/auth.py
View file @
f66d2320
...
...
@@ -30,6 +30,8 @@ def check_access(auth_type, access_level):
raise
cherrypy
.
HTTPError
(
400
,
'Bad Request'
)
dic
=
get_credentials
(
access_level
)
if
len
(
dic
)
==
0
:
return
False
if
auth_type
==
'ACL'
:
#Check that otherwise authenticated user has the required
...
...
@@ -71,8 +73,11 @@ def get_credentials(access_level=1):
else
:
conn
.
text_factory
=
str
with
conn
:
l
=
conn
.
execute
(
'select user, passwd from users where access_level >= ?'
,(
access_level
,)).
fetchall
()
dic
=
dict
(
l
)
try
:
l
=
conn
.
execute
(
'select user, passwd from users where access_level >= ?'
,(
access_level
,)).
fetchall
()
dic
=
dict
(
l
)
except
:
dic
=
dict
([])
conn
.
close
()
return
dic
...
...
pipelet/repository.py
View file @
f66d2320
...
...
@@ -94,7 +94,7 @@ class Repository:
## code
fn
=
self
.
_match_fn
(
fns
,
s
)
source
=
self
.
get_code_source
(
fn
)
self
.
_code
[
s
]
=
compile
(
source
,
fn
,
"exec"
)
self
.
_code
[
s
]
=
(
source
,
fn
)
#
compile(source, fn, "exec")
self
.
_all_string
[
s
]
=
source
## hooks
...
...
@@ -108,7 +108,7 @@ class Repository:
logger
.
warning
(
repr
(
e
))
source
=
""
fn
=
""
self
.
_hook
[
s
][
h
]
=
compile
(
source
,
fn
,
"exec"
)
self
.
_hook
[
s
][
h
]
=
(
source
,
fn
)
#
compile(source, fn, "exec")
self
.
_all_string
[
s
]
+=
source
## deps
...
...
pipelet/scheduler.py
View file @
f66d2320
...
...
@@ -213,17 +213,20 @@ class Scheduler():
if
not
path
.
exists
(
d
):
os
.
mkdir
(
d
)
r
=
self
.
pipe
.
repository
f
=
r
.
get_code_string
(
seg
)
.
co_filename
f
=
r
.
get_code_string
(
seg
)
if
f
:
dest
=
d
+
'/'
+
os
.
path
.
basename
(
f
)
os
.
system
(
"cp %s %s"
%
(
f
,
dest
))
dest
=
d
+
'/'
+
os
.
path
.
basename
(
f
[
1
])
fid
=
open
(
dest
,
"w"
)
fid
.
write
(
f
[
0
])
fid
.
close
()
lst_hook
=
r
.
get_hook_list
(
seg
)
for
h
in
lst_hook
:
f
=
r
.
get_hook_string
(
seg
,
h
)
.
co_filename
f
=
r
.
get_hook_string
(
seg
,
h
)
if
f
:
dest
=
d
+
'/'
+
os
.
path
.
basename
(
f
)
os
.
system
(
"cp %s %s"
%
(
f
,
dest
))
dest
=
d
+
'/'
+
os
.
path
.
basename
(
f
[
1
])
fid
=
open
(
dest
,
"w"
)
fid
.
write
(
f
[
0
])
fid
.
close
()
parents
=
self
.
pipe
.
get_parents
(
seg
)
## parents segments
d
=
self
.
tracker
.
get_done
(
seg
)
## done tasks
...
...
pipelet/web.py
View file @
f66d2320
...
...
@@ -237,17 +237,23 @@ class Web:
"""
conn
=
sqlite3
.
connect
(
self
.
db_file
,
check_same_thread
=
True
)
conn
.
text_factory
=
str
html
=
html_tmp
html
+=
'<a class="icon home" href="/%s/"><small>Home</small></a>'
%
(
self
.
name
)
html
+=
'<h1>Pipelines in %s </h1>'
%
self
.
name
# get all instances
with
conn
:
l
=
conn
.
execute
(
'select seg, curr_dir, seg_id, param from segments order by curr_dir'
).
fetchall
()
tcounts
=
conn
.
execute
(
'select seg_id, status, count() from tasks group by seg_id, status order by seg_id'
).
fetchall
()
sindex
=
[
e
[
0
]
for
e
in
tcounts
]
index
=
[[]
for
i
in
range
(
max
(
sindex
)
+
1
)]
for
i
,
s
in
enumerate
(
sindex
):
index
[
s
].
append
(
i
)
html
=
html_tmp
html
+=
'<a class="icon home" href="/%s/"><small>Home</small></a>'
%
(
self
.
name
)
html
+=
'<h1>Pipelines in %s </h1>'
%
self
.
name
try
:
sindex
=
[
e
[
0
]
for
e
in
tcounts
]
index
=
[[]
for
i
in
range
(
max
(
sindex
)
+
1
)]
for
i
,
s
in
enumerate
(
sindex
):
index
[
s
].
append
(
i
)
except
ValueError
:
html
+=
'No computed pipeline !</div></body></html>'
return
html
## Filter fieldset
html
+=
'<fieldset id="filters"><legend><span class="text">Filters</span></legend>'
...
...
@@ -286,6 +292,7 @@ class Web:
log_dir
=
l
[
0
][
1
].
split
(
"_"
)[
0
]
seg_1
=
log_dir
.
split
(
"/"
)[
-
1
]
log_dir
=
log_dir
[
0
:
len
(
log_dir
)
-
len
(
seg_1
)]
+
"log"
## Buttons
html
+=
'<tr></tr>'
...
...
pipelet/worker.py
View file @
f66d2320
...
...
@@ -163,7 +163,7 @@ class Worker(object):
env: environment object.
"""
try
:
exec
(
co
de
,
glo
)
exec
(
co
mpile
(
code
[
0
],
code
[
1
],
"exec"
)
,
glo
)
# We do not want to prevent Abortion
except
AbortError
,
e
:
raise
e
...
...
@@ -249,7 +249,7 @@ class InteractiveWorker(Worker):
Main difference is that exception occuring in the segment code
are not caught.
"""
exec
(
co
de
,
glo
)
exec
(
co
mpile
(
code
[
0
],
code
[
1
],
"exec"
)
,
glo
)
self
.
task
.
status
=
"done"
def
terminate
(
self
):
...
...
test/cmb/cmb.py
View file @
f66d2320
...
...
@@ -3,8 +3,9 @@
Generate a cmb map from lambda-CDM power spectrum.
"""
import
healpy
as
hp
import
pylab
as
pl
import
healpy
as
hp
### Define some global parameters
lst_par
=
[
'lmax'
,
'nside'
,
'cmb_unit'
,
'sim_id'
,
'input_cl'
]
...
...
test/cmb/noise.py
View file @
f66d2320
...
...
@@ -3,9 +3,8 @@
Compute coupling matrix from hitcount map.
Compute noise power.
"""
import
healpy
as
hp
import
pylab
as
pl
import
healpy
as
hp
import
numpy
as
npy
import
spherelib
as
sp
...
...
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