Page MenuHomec4science

jobselector.py
No OneTemporary

File Metadata

Created
Wed, Nov 6, 04:23

jobselector.py

#!/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