Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F62086216
runselector.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, May 10, 20:02
Size
1 KB
Mime Type
text/x-python
Expires
Sun, May 12, 20:02 (2 d)
Engine
blob
Format
Raw Data
Handle
17600979
Attached To
R3127 blackdynamite
runselector.py
View Options
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -*- py-which-shell: "python"; -*-
__all__
=
[
"RunSelector"
]
import
copy
import
run
import
job
import
selector
import
constraints
as
BDcons
################################################################
class
RunSelector
(
selector
.
Selector
):
"""
"""
def
selectRuns
(
self
,
constraints
,
sort_by
=
None
,
quiet
=
False
):
run_list
=
self
.
select
([
run
.
Run
,
job
.
Job
],
constraints
=
[
'runs.job_id = jobs.id'
,
constraints
],
sort_by
=
sort_by
)
if
quiet
is
False
:
if
not
run_list
:
print
(
"no runs found"
)
print
(
"Selected runs are: "
+
str
([
r
[
0
]
.
id
for
r
in
run_list
]))
print
(
"Selected jobs are: "
+
str
([
r
[
0
][
"job_id"
]
for
r
in
run_list
]))
# run_list = self.buildJoinedList(myjob, myrun, curs)
return
run_list
def
buildJoinedList
(
self
,
job_object
,
run_object
,
curs
):
coljob_info
=
self
.
base
.
getColumnProperties
(
job_object
)
colrun_info
=
self
.
base
.
getColumnProperties
(
run_object
)
run_list
=
[]
for
entries
in
curs
:
jobj
=
copy
.
deepcopy
(
job_object
)
robj
=
copy
.
deepcopy
(
run_object
)
ncoljob
=
len
(
coljob_info
)
ncolrun
=
len
(
colrun_info
)
for
i
in
range
(
0
,
ncoljob
):
col_name
=
coljob_info
[
i
][
0
]
jobj
[
col_name
]
=
entries
[
i
]
jobj
.
id
=
jobj
[
"id"
]
for
i
in
range
(
0
,
ncolrun
):
col_name
=
colrun_info
[
i
][
0
]
robj
[
col_name
]
=
entries
[
i
+
ncoljob
]
robj
.
id
=
robj
[
"id"
]
run_list
.
append
([
robj
,
jobj
])
return
run_list
def
__init__
(
self
,
base
):
selector
.
Selector
.
__init__
(
self
,
base
)
Event Timeline
Log In to Comment