Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91893233
jobselector.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, Nov 15, 12:58
Size
1019 B
Mime Type
text/x-python
Expires
Sun, Nov 17, 12:58 (2 d)
Engine
blob
Format
Raw Data
Handle
22342917
Attached To
R3127 blackdynamite
jobselector.py
View Options
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -*- py-which-shell: "python"; -*-
__all__
=
[
"JobSelector"
]
import
job
import
sys
class
JobSelector
(
object
):
"""
"""
def
selectJobs
(
self
,
job_constraints
=
None
,
sort_job_by
=
None
):
if
job_constraints
is
None
:
job_constraints
=
[]
if
(
type
(
job_constraints
)
==
dict
):
if
(
"job_constraints"
in
job_constraints
):
job_constraints
=
job_constraints
[
"job_constraints"
]
else
:
job_constraints
=
[]
myjob
=
job
.
Job
(
self
.
base
)
myjob
.
prepare
()
myjob
.
setConstraint
(
job_constraints
)
order_condition
=
""
if
(
sort_job_by
):
order_condition
=
" ORDER BY "
+
sort_job_by
job_list
=
myjob
.
getMatchedObjectList
(
order_condition
)
if
(
not
job_list
):
print
(
"no jobs found"
)
print
(
"Selected jobs are: "
+
str
([
j
.
id
for
j
in
job_list
]))
return
job_list
def
__init__
(
self
,
base
):
self
.
base
=
base
Event Timeline
Log In to Comment