from Ganga.GPIDev.Lib.Tasks.TaskApplication import task_map # Must take care of "taskifying" all possible apps #from GangaLHCb.Lib.Applications.AppsBase import * #from GangaLHCb.Lib.Applications.AppsBaseUtils import available_apps import os from GangaLHCb.Lib.Applications.AppsBaseUtils import available_apps f = open(os.path.join( os.path.dirname(__file__), '..', 'Applications', 'AppsBase.py'), 'r') cls = f.read() f.close() # for app in available_apps(): # exec(cls.replace('AppName','%s'%app)) for app in available_apps(): exec(cls.replace('AppName', '%s' % app)) exec('%sTask = taskify(%s,"%sTask")' % (app, app, app)) exec('task_map["%s"] = %sTask' % (app, app)) from GangaLHCb.Lib.Applications.GaudiPython import GaudiPython GaudiPythonTask = taskify(GaudiPython, "GaudiPythonTask") task_map["GaudiPython"] = GaudiPythonTask from GangaLHCb.Lib.Applications.Bender import Bender BenderTask = taskify(Bender, "BenderTask") task_map["Bender"] = BenderTask
from Ganga.GPIDev.Lib.Tasks.TaskApplication import taskify from GangaAtlas.Lib.AthenaMC.AthenaMC import AthenaMC, AthenaMCSplitterJob from GangaAtlas.Lib.Athena.Athena import Athena AthenaTask = taskify(Athena, "AthenaTask") AthenaMCTask = taskify(AthenaMC, "AthenaMCTask") AthenaMCTaskSplitterJob = taskify(AthenaMCSplitterJob, "AthenaMCTaskSplitterJob") from Ganga.GPIDev.Base.Proxy import addProxy, stripProxy from Ganga.GPIDev.Schema import * from Ganga.GPIDev.Adapters.ISplitter import ISplitter class AnaTaskSplitterJob(ISplitter): """AnaTask handler for job splitting""" _name = "AnaTaskSplitterJob" _category = "splitters" _schema = Schema( Version(1, 0), { 'subjobs': SimpleItem(defvalue=[], sequence=1, doc="List of subjobs", typelist=["int"]), 'numevtsperjob': SimpleItem(defvalue=0, doc='Number of events per subjob'), 'numevtsperfile': SimpleItem( defvalue=0, doc='Maximum number of events in a file of input dataset') })
cls = f.read() f.close() all_apps = '' for app in AppsBaseUtils.available_apps(): if app in dir(): continue app = str(app) this_class = cls.replace('AppName', app) this_task = '%sTask = taskify(%s,"%sTask")' % (app, app, app) this_map = 'task_map["%s"] = %sTask' % (app, app) this_app = this_class + str('\n\n') + this_task + str('\n\n') + this_map all_apps = all_apps + str('\n\n') + this_app #exec(this_exec, all_global, all_local) logger.debug("Adding %s" % str(app)) logger.debug("Adding apps") modules= compile(all_apps, '<string>', 'exec') exec modules logger.debug("Fin") #/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ GaudiPythonTask = taskify(GaudiPython, "GaudiPythonTask") task_map["GaudiPython"] = GaudiPythonTask #/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ BenderTask = taskify(Bender, "BenderTask") task_map["Bender"] = BenderTask
from Ganga.GPIDev.Lib.Tasks.TaskApplication import taskify from GangaAtlas.Lib.AthenaMC.AthenaMC import AthenaMC, AthenaMCSplitterJob from GangaAtlas.Lib.Athena.Athena import Athena AthenaTask = taskify(Athena,"AthenaTask") AthenaMCTask = taskify(AthenaMC,"AthenaMCTask") AthenaMCTaskSplitterJob = taskify(AthenaMCSplitterJob,"AthenaMCTaskSplitterJob") from Ganga.GPIDev.Base.Proxy import addProxy, stripProxy from Ganga.GPIDev.Schema import * from Ganga.GPIDev.Adapters.ISplitter import ISplitter class AnaTaskSplitterJob(ISplitter): """AnaTask handler for job splitting""" _name = "AnaTaskSplitterJob" _category = "splitters" _schema = Schema(Version(1,0), { 'subjobs' : SimpleItem(defvalue=[],sequence=1, doc="List of subjobs", typelist=["int"]), 'numevtsperjob' : SimpleItem(defvalue=0, doc='Number of events per subjob'), 'numevtsperfile' : SimpleItem(defvalue=0,doc='Maximum number of events in a file of input dataset') } ) def split(self,job): from Ganga.GPIDev.Lib.Job import Job logger.debug("AnaTaskSplitterJob split called") sjl = [] transform = stripProxy(job.application.getTransform()) transform.setAppStatus(job.application, "removed") # Do the splitting for sj in self.subjobs: j = Job() j.inputdata = transform.partitions_data[sj-1] j.outputdata = job.outputdata