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

Ordering issue in Task.replace() affecting dumpPython() #28703

Closed
makortel opened this issue Jan 2, 2020 · 3 comments · Fixed by #34493
Closed

Ordering issue in Task.replace() affecting dumpPython() #28703

makortel opened this issue Jan 2, 2020 · 3 comments · Fixed by #34493

Comments

@makortel
Copy link
Contributor

makortel commented Jan 2, 2020

The python 3 unit test failure

Traceback (most recent call last):
  File "/cvmfs/cms-ib.cern.ch/nweek-02609/slc7_amd64_gcc820/cms/cmssw-patch/CMSSW_11_1_PY3_X_2019-12-31-2300/python/FWCore/ParameterSet/Config.py", line 2425, in testTask
    self.assertTrue(process.path21.dumpPython(PrintOptions()) == 'cms.Path(process.mproducer10+process.mproducer8+process.mproducer8+(process.mproducer8+process.mproducer9)+process.sequence3, cms.Task(), cms.Task(process.None, process.mproducer10), cms.Task(process.d, process.mesproducer, process.messource, process.mfilter, process.mproducer10, process.mproducer2, process.myTask6), process.myTask100, process.myTask5)\n')
AssertionError: False is not true

seems to be caused by a different order of Tasks whose replace() functions are called by this line

process.myTask5 = Task()

Essentially the nested task structure before the call is

process.myTask5 = cms.Task(process.d) # d is Service
process.myTask8 = cms.Task(process.myTask5, process.mproducer8)
process.myTask7 = cms.Task(process.myTask8)
process.myTask6 = cms.Task(process.myTask7)
process.myTask1 = cms.Task(process.myTask6, ...)

In the py2 build, this loop

def _replaceInTasks(self, label, new):
old = getattr(self,label)
for task in six.itervalues(self.tasks):
task.replace(old, new)

operates first on process.myTask8 and sets its value to be cms.Task(process.mproducer8). Then the loop operates on process.myTask1, and nothing needs to be done.

In py3 build the loop operates first on process.myTask1. The visitor proceeds up to myTask8, removes the myTask5, and, because values were changed, recreates the nested task structure with anonymous Tasks

elif isinstance(visitee, Task):
nonNull = []
for c in contents:
if c[0] is not None:
nonNull.append(c[0])
self.__stack[-2][-1] = [Task(*nonNull), True, None]

i.e. to

process.myTask1 = cms.Task(cms.Task(cms.Task(cms.Task(process.mproducer8, cms.Task()))), ...)

The anonymous Tasks lead to the failure of the test that expects to see process.myTask6 in the dumpPython() output. As far as I can tell, the issue affects only the dumpPython(), the module/component contents of the tasks are still correct.

@cmsbuild
Copy link
Contributor

cmsbuild commented Jan 2, 2020

A new Issue was created by @makortel Matti Kortelainen.

@Dr15Jones, @smuzaffar, @silviodonato, @kpedro88, @davidlange6, @fabiocos can you please review it and eventually sign/assign? Thanks.

cms-bot commands are listed here

@Dr15Jones
Copy link
Contributor

assign core

@cmsbuild
Copy link
Contributor

cmsbuild commented Jan 2, 2020

New categories assigned: core

@Dr15Jones,@smuzaffar you have been requested to review this Pull request/Issue and eventually sign? Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants