Skip to content

[TREE] Utility to enter a range of entries in TEntryList#8740

Merged
vepadulano merged 2 commits intoroot-project:masterfrom
vepadulano:tentrylist-enterrange
Aug 10, 2021
Merged

[TREE] Utility to enter a range of entries in TEntryList#8740
vepadulano merged 2 commits intoroot-project:masterfrom
vepadulano:tentrylist-enterrange

Conversation

@vepadulano
Copy link
Copy Markdown
Member

@vepadulano vepadulano commented Jul 27, 2021

Add a utility function to call TEntryList::Enter with entries in a certain range, instead of having to do the loop manually. Especially useful in PyROOT to avoid doing the same in a Python loop

Initial idea

>>> import ROOT
>>> e = ROOT.TEntryList()
>>> e.GetN()
0
>>> ROOT.ROOT.Detail.EnterRange(e, 0, 10)
>>> e.GetN()
10

Not sure about the namespace and the naming, can be discussed

Final interface

>>> import ROOT
>>> e = ROOT.TEntryList()
>>> e.EnterRange(0,10)
>>> e.GetN()
10

@vepadulano vepadulano requested review from eguiraud and pcanal July 27, 2021 09:50
@vepadulano vepadulano self-assigned this Jul 27, 2021
@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

Copy link
Copy Markdown
Contributor

@eguiraud eguiraud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idea + implementation looks good to me.

Naming/placement: if we are putting the function in TEntryList.h anyway, I guess it can be a method. @pcanal what do you think?

Unrelated, but I hope you don't really need the double ROOT.ROOT to call this from PyROOT, I think that has been fixed years ago 😄

@vepadulano
Copy link
Copy Markdown
Member Author

Unrelated, but I hope you don't really need the double ROOT.ROOT to call this from PyROOT, I think that has been fixed years ago

I thought so too, but currently

>>> ROOT.Detail.EnterRange
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: <namespace cppyy.gbl.Detail at 0x56507072a2f0> has no attribute 'EnterRange'. Full details:
  type object 'Detail' has no attribute 'EnterRange'
  'Detail::EnterRange' is not a known C++ class
  'EnterRange' is not a known C++ template
  'EnterRange' is not a known C++ enum

So maybe it's something that must be "activated" somehow. I'd need to see how it's done with other classes/functions

@eguiraud
Copy link
Copy Markdown
Contributor

eguiraud commented Jul 27, 2021

It could be that it only works for classes and not for functions. Can you please open an issue about that? It's unrelated to the PR but I can't find a jira ticket about this ROOT.ROOT thing and I'm not sure we are happy with it not working sometimes.

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-debian10-i386/cxx14.
Running on pcepsft11.dyndns.cern.ch:/home/sftnight/build/workspace/root-pullrequests-build
See console output.

Failing tests:

@phsft-bot
Copy link
Copy Markdown

Build failed on mac11.0/cxx17.
Running on macphsft23.dyndns.cern.ch:/Users/sftnight/build/workspace/root-pullrequests-build
See console output.

Failing tests:

@vepadulano
Copy link
Copy Markdown
Member Author

Can you please open an issue about that?

See #8745

@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

Copy link
Copy Markdown
Contributor

@eguiraud eguiraud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, looks good to me!

The feature needs a test before merging.

Also maybe I'd put the tree argument before the step argument because I don't expect the step argument to be used much? (but maybe that's also the case for tree?)

@vepadulano
Copy link
Copy Markdown
Member Author

Also maybe I'd put the tree argument before the step argument because I don't expect the step argument to be used much? (but maybe that's also the case for tree?)

I put the step first because I felt it went "logically" after the other two integer arguments. I really wouldn't know what could be used more between that and the tree argument

@vepadulano vepadulano requested a review from bellenot as a code owner August 10, 2021 07:25
@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-performance-centos8-multicore/default.
Running on olbdw-01.cern.ch:/data/sftnight/workspace/root-pullrequests-build
See console output.

Failing tests:

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-debian10-i386/cxx14.
Running on pcepsft11.dyndns.cern.ch:/home/sftnight/build/workspace/root-pullrequests-build
See console output.

Failing tests:

@phsft-bot
Copy link
Copy Markdown

Build failed on mac11.0/cxx17.
Running on macphsft23.dyndns.cern.ch:/Users/sftnight/build/workspace/root-pullrequests-build
See console output.

Failing tests:

@vepadulano
Copy link
Copy Markdown
Member Author

The test failures report the file created during the test does not exist, but this node ran the test fine https://lcgapp-services.cern.ch/root-jenkins/job/root-pullrequests-build/124359/testReport/projectroot.tree.tree/test/gtest_tree_tree_test_entrylist_enterrange/

Probably using the same filename for multiple tests leads to a recreation/deletion of the file that is then not usable by the new test?

@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-debian10-i386/cxx14.
Running on pcepsft10.dyndns.cern.ch:/build/workspace/root-pullrequests-build
See console output.

Errors:

  • [2021-08-10T09:15:42.821Z] stderr: error: could not read '.git/rebase-apply/head-name': No such file or directory

@phsft-bot
Copy link
Copy Markdown

Build failed on windows10/cxx14.
Running on null:C:\build\workspace\root-pullrequests-build
See console output.

Failing tests:

@eguiraud
Copy link
Copy Markdown
Contributor

Using the same file in multiple tests is never good, they might run concurrently

@vepadulano
Copy link
Copy Markdown
Member Author

Using the same file in multiple tests is never good, they might run concurrently

You are right, I changed the filename in the latest commit 👍

Copy link
Copy Markdown
Contributor

@eguiraud eguiraud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

A new method `EnterRange` has been added to TEntryList to allow adding all entries in a certain range in a loop, rather than having to do the loop explicitly in the user application. This is especially helpful in PyROOT to avoid having to do the loop in Python.
@vepadulano vepadulano force-pushed the tentrylist-enterrange branch from 30b7f94 to 9839af2 Compare August 10, 2021 13:35
@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

@vepadulano
Copy link
Copy Markdown
Member Author

Added commit message and rebased. Will merge if tests pass

@vepadulano vepadulano merged commit 293a52b into root-project:master Aug 10, 2021
@vepadulano vepadulano deleted the tentrylist-enterrange branch October 25, 2021 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants