Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt edmConfigEditor for unscheduled mode #4353

Merged
merged 1 commit into from Jun 26, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -252,6 +252,10 @@ def setProcess(self,process):
self.readConnections(self.allChildren(folders["modules"]))
self._scheduleRecursive(folders["paths"])
self._scheduledObjects.reverse()
names = [l for t,l,p,pr in self.applyCommands(self.outputEventContent(),self.outputCommands())]
for obj in self.allChildren(folders["modules"]):
if str(obj) in names:
self._scheduledObjects+=[obj]
scheduled_folder = ConfigFolder("scheduled", folders["paths"])
self._allObjects += [scheduled_folder]
folders["paths"]._configChildren.remove(scheduled_folder)
Expand Down Expand Up @@ -681,3 +685,38 @@ def outputCommands(self):
return outputModules[0].outputCommands
else:
return []

def applyCommands(self, content, outputCommands):
keep = {}
if len(outputCommands)>0 and outputCommands[0]!="keep *":
for object in content:
keep[object] = False
else:
for object in content:
keep[object] = True
for o in outputCommands:
command, filter = o.split(" ")
if len(filter.split("_")) > 1:
module = filter.split("_")[1]
product = filter.split("_")[2]
process = filter.split("_")[3]
else:
module = filter
product = "*"
process = "*"
for object in content:
if "*" in module:
match = module.strip("*") in object[1]
else:
match = module == object[1]
if "*" in product:
match = match and product.strip("*") in object[2]
else:
match = match and product == object[2]
if "*" in process:
match = match and process.strip("*") in object[3]
else:
match = match and process == object[3]
if match:
keep[object] = command == "keep"
return [object for object in content if keep[object]]