Page MenuHomec4science

runselector.py
No OneTemporary

File Metadata

Created
Fri, May 10, 20:02

runselector.py

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