Skip to content

Commit

Permalink
Fix dumpPython() for Task and ConditionalTask when they contain > 255…
Browse files Browse the repository at this point in the history
… elements
  • Loading branch information
makortel authored and fwyzard committed May 17, 2022
1 parent 242576c commit 0bf12a4
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion FWCore/ParameterSet/python/SequenceTypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1551,7 +1551,7 @@ def dumpPythonNoNewline(self, options=PrintOptions()):
iFirst = False
s += item
if len(taskContents) > 255:
return "cms.{}(*[" + s + "])".format(self._taskType())
s = "*[" + s + "]"
return "cms.{}({})".format(self._taskType(),s)

def directDependencies(self,sortByType=True):
Expand Down Expand Up @@ -1972,6 +1972,19 @@ def testDumpPython(self):
p16 = Path(a+b+s+c,ct1)
self.assertEqual(p16.dumpPython(),"cms.Path(process.a+process.b+cms.Sequence(process.e, cms.ConditionalTask(process.d, process.f))+process.c, cms.ConditionalTask(process.a))\n")

n = 260
mods = []
labels = []
for i in range(0, n):
l = "a{}".format(i)
labels.append("process."+l)
mods.append(DummyModule(l))
labels.sort()
task = Task(*mods)
self.assertEqual(task.dumpPython(), "cms.Task(*[" + ", ".join(labels) + "])\n")
conditionalTask = ConditionalTask(*mods)
self.assertEqual(conditionalTask.dumpPython(), "cms.ConditionalTask(*[" + ", ".join(labels) + "])\n")

l = list()
namesVisitor = DecoratedNodeNameVisitor(l)
p.visit(namesVisitor)
Expand Down

0 comments on commit 0bf12a4

Please sign in to comment.