1 from Ganga.Utility.logging import getLogger
2
3 logger = getLogger(modulename=1)
4
5 from Base import JobRepository
6
9 self.j = job
10 self.commit = 0
11 self.checkout = 0
12 self.register = 0
13
14 for k in kwds:
15 setattr(self,k,kwds[k])
16
18 - def __init__(self,schema,role,streamer,root_dir,**kwds):
26
28
29 for j in jobs:
30 self.id_counter += 1
31 j.id = self.id_counter
32 self.jobs[j.id] = JobInfo(j,register=1)
33 logger.debug('registerJobs %s',str([j.id for j in jobs]))
34
36 """commitJobs(self, jobs) --> None
37 throws RepositoryError
38 jobs -- list of jobs to commit
39 jobs must already be registered
40 """
41 logger.debug('commitJobs %s',str([j.id for j in jobs]))
42
43 for j in jobs:
44 if not self.jobs.has_key(j.id):
45 raise ValueError('attempt to commit job is not registered',j.id)
46
47 self.jobs[j.id].commit += 1
48 logger.debug("commited job %d (%d)",j.id,self.jobs[j.id].commit)
49
51 """checkoutJobs(self, ids_or_attributes) --> list of jobs
52 throws RepositoryError
53 ids_or_attributes -- list of job ids
54 or dictionary of job attributes saved
55 in the DB as metadata. Example of attributes:
56 attributes = {'status':'submitted', 'application':'DaVinci'}
57 """
58 logger.debug('checkoutJobs %s',str(ids_or_attributes))
59 return []
60
62 """deleteJob(self, ids) --> None
63 throws RepositoryError
64 ids -- list of job ids
65 """
66 logger.debug('deleteJobs %s',str(ids))
67 for id in ids:
68 if not self.jobs.has_key(id):
69 raise ValueError('attempt to delet job which does not exist %d',id)
70 self.trash[id] = self.jobs[id]
71 del self.jobs[id]
72 logger.debug('deleted job %d',id)
73 return
74
76 """getJobIds(self, ids_or_attributes) --> list of ids for the jobs having
77 specified attributes.
78 throws RepositoryError
79 ids_or_attributes -- list of job ids
80 or dictionary of job attributes saved
81 in the DB as metadata. Example of attributes:
82 attributes = {'status':'submitted', 'application':'DaVinci'}
83 """
84 logger.debug('getJobIds %s',str(ids_or_attributes))
85 return []
86
88 """getJobAttributes(self, ids_or_attributes) --> list of dictionaries with
89 job metadata stored in the registry.
90 throws RepositoryError
91 ids_or_attributes -- list of job ids
92 or dictionary of job attributes saved
93 in the DB as metadata. Example of attributes:
94 attributes = {'status':'submitted', 'application':'DaVinci'}
95 """
96 logger.debug('getJobAttributes %s',str(ids_or_attributes))
97 return []
98
100 """setJobsStatus(self, statusList) --> None
101 throws RepositoryError
102 statusList -- list of tuples (<jobId>, <status>)
103 Supposed to be used by JobManager
104 """
105 logger.debug('setJobsStatus %s',str(statusList))
106 return
107
109 """getJobsStatus(self, ids_or_attributes) --> list of tuples, indicating
110 jobid and job status: (id, status).
111 throws RepositoryError
112 ids_or_attributes -- list of job ids
113 or dictionary of job attributes saved
114 in the DB as metadata. Example of attributes:
115 attributes = {'application':'DaVinci'}
116 """
117 logger.debug('getJobStatus %s',str(ids_or_attributes))
118 return []
119