-
Notifications
You must be signed in to change notification settings - Fork 3
/
executeDAO.py
47 lines (37 loc) · 1.48 KB
/
executeDAO.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Script using the same logic as in ErrorHandler to load job
information from the database, using the DAOFactory
"""
from __future__ import print_function, division
import os
import threading
from pprint import pformat
from WMCore.DAOFactory import DAOFactory
from WMCore.WMInit import connectToDB
class DummyClass(object):
def __init__(self):
# Connecting to DB
myThread = threading.currentThread()
connectToDB()
self.dbi = myThread.dbi
# Creating DAO stuff for job discovery
self.daoFactory = DAOFactory(package="WMComponent.RucioInjector.Database",
logger=myThread.logger,
dbinterface=self.dbi)
self.getUnsubscribedDsets = self.daoFactory(classname="GetUnsubscribedDatasets")
return
def loadJobsFromListFull(self):
unsubscribedDatasets = self.getUnsubscribedDsets.execute()
print("Results from DAO:\n{}".format(pformat(unsubscribedDatasets)))
return
if __name__ == '__main__':
if 'WMAGENT_CONFIG' not in os.environ:
os.environ['WMAGENT_CONFIG'] = '/data/srv/wmagent/current/config/wmagent/config.py'
# Job ID summary is:
# First 2 ids: RECO reading unmerged files (KeepOutput=False in the previous task)
# 3rd ID is a merge job:
# 4th ID is a processing job reading merged files
clsObject = DummyClass()
results = clsObject.loadJobsFromListFull()