-
Notifications
You must be signed in to change notification settings - Fork 26
[RFC] Integrate gem-plotting-tools with Travis CI #27
Conversation
This is required for the scripts to run on Debian-based machines (Travis CI uses Ubuntu). /usr/bin/env is also valid on cosmicstandtif.
This will fix bug 24 and should turn Travis green again
This PR isn't ready yet, but I'd like to get comments on the architecture before more tests get added to it. |
Can you confirm this is:
Can you confirm these are:
As these are the defaults on
Please use One question. How does Travis CI update? e.g. if there is an update to Also I think we need to expand this unit testing:
Let's expand this to include:
Also can the input files that we use as the "test data" be stored in the same file structure that |
before_script: | ||
- .travis/install_cmsgemos.sh | ||
# Copy Travis chamber info | ||
- cp .travis/chamberInfo.py mapping/chamberInfo.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the file below this will work for testing. But as a counter question how do you intend to use this to test potential changes to chamberInfo.py
itself?
For example what happens if someone adds a dictionary to this file or changes the default behavior. Seems like we'd then have to change .travis/chamberInfo.py
as well to test this.
I think we should rely on using the default mapping/chamberInfo.py
or at least one of the other links (e.g. chamberInfo_904.py
or chamberInfo_qc8.py
with a preference for the first).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your PR for chamberInfo.py
isn't merged yet, so mine isn't built on top of it :-) The current default is for P5, meaning 12x more data in the repo, which I don't want. My plan is to move this file to mapping/chamberInfo_Travis.py
when merging your changes.
Also, the default for 904 includes detector names, which could change at some point. I don't want the build to break just because we switched detectors, which is why I used a custom version. We can in principle mix data from different detectors in the repo (as long as they don't have different vfatmask
s, which currently limits the number of available options).
IMHO updates to the data files should be limited to file format changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see your points. Let's not build off unnerved PR's your right. And let's not rely on potentially transient setups.
However the detectors in P5 will not changed (even post LS2 there will be a GEMINIm27L1). And it is for the production level machines that we should be concerned with. I think ensuring the integrity tests are valid for the real system is the primary goal so let's at least have the P5 system and the /current directory for each. This would be the most representative case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using P5 data would also mean that PRs that depend on file format changes would have to be tested on P5 data (or fake P5 data 👎, or we'd have to merge with tests failing 👎). Generating this data would slow down development a lot (it could even deadlock in case of circular dependencies).
.travis.yml
Outdated
- source .travis/setupenv.sh | ||
|
||
script: | ||
- ana_scans.py --scandate=current --anaType=scurve |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned we should expand to test the full range of scripts. This here only tests anaUltraScurve.py
and one piece of ana_scans.py
.
.travis/data/travis/.gitignore
Outdated
# Don't ignore data files | ||
!scurve | ||
!scurve/current | ||
!scurve/current/SCurveData.root |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is a duplicate .gitignore
file needed at this location: .travis/data/travis/
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't want to add many long paths to the main .gitignore
. I chose to move all data-related ignore directives into another file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will be harder to maintain in the long run...now developers have to check 2 files instead of one. And a new developer may not even know that a second .gitignore
exists. Let's revert this and use only one file.
# Travis script to install cmsgemos | ||
|
||
cd $TRAVIS_BUILD_DIR/.. | ||
git clone --depth 1 https://github.com/cms-gem-daq-project/cmsgemos.git |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see...so everytime someone makes a PR this is going to clone cmsgemos
. So bugs in cmsgemos
might cause a unit test to this repo to fail? One needs to then keep this in mind when interpreting results.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. We could specify a specific revision (or tag?), but would have to update it manually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No let's keep it this way and rely the HEAD of cmsgemos being correct
.travis/setupenv.sh
Outdated
# Script to setup data paths | ||
|
||
# For Ubuntu 14.04: add pyroot to PYTHON_PATH | ||
export PYTHONPATH="/usr/share/python-support/root:/usr/lib/python2.7/dist-packages/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's test on python 2.6.6
for now.
Also what will $ROOTSYS
be? I think this might be important no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no distribution of pyroot
built against Python 2.6 in Debian, but it seems binary compatible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again check @jsturdy's implementation to see if this sort of issue is resolved
@@ -1,4 +1,4 @@ | |||
#!/bin/env python | |||
#! /usr/bin/env python |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the rationale for this change (and in subsequent files: anaUltraScurve.py
, anaUltraThreshold.py
, anaXDAQLatency.py
, ana_scans.py
, and anautilities.py
)?
Are you sure this change, while possibly motivated for making Travis CI
work, will not impact performance on production machines? Specifically the P5 machines?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debian/Ubuntu don't have /bin/env
in any supported version. Performance won't be affected at all, env
is just a tool that searches $PATH
and standard locations for an executable and launches it. The only possible problem would be SL
to remove /usr/bin/env
in a future version, but IIRC there is some standard for Linux distros that says /usr/bin
should be the default for executables.
returncode = runCommand(cmd) | ||
if returncode != 0: | ||
print "Error: command exited with non-zero code %d" % returncode | ||
return returncode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason behind this? This block is already inside a try:
block so any error results in the code executing the except
portion and issues an error message already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-zero return values and exceptions aren't the same thing. I'd prefer runCommand
to throw an exception on non-zero return status, but such a change is out of the scope of this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure but I think this should be a separate PR. Could you revert here and open a new issue that is related to this? That would allow us to be a bit more organized and focused in our PR's
for returncode in res.get(): | ||
if returncode != 0: | ||
sys.exit(returncode) | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again could you describe the rationale here? We're inside a try
block already?
Also what are the possible returncode
values?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
returncode
is the return value from the called command, and will be non-zero if it fails (Python returns non-zero on exceptions, SIGSEGV, SIGKILL, ...). For this to work, we should ensure that our tools also return non-zero on "soft" failures (i.e. no crash), but that's a different issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above let's do this in a separate PR with a new issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good start to implementing this feature but changes and clarifications needed.
Also I think additional reviews beyond myself are needed due to the importance of some of these changes.
Same architecture, major and minor version. Patch number is different, though. I don't know of a simple way to install a specific ROOT version on Debian (and I don't want to compile it).
Python 2.6.13 and 2.7.13 (more recent patch versions, no behavior change expected). I can look into specifying patch numbers, but I'm not sure whether Travis still supports 2.6.6 (since even 2.6.13 is deprecated as it's not supported by the Python team anymore).
Checked, it uses the default branch, which is generic-amc-release-v3 for now. Should I specify the branch explicitly?
The latest |
Compiled sources are available, for example for
No let's rely on the correct setup of the
Yeah I saw after looking at the code. |
Sorry to not jump on this earlier, but it would be better if you can set it up to work with the docker container I set up for
Other things to probably keep in mind moving forward:
|
In today's update:
I considered using @jsturdy's Docker image, but I couldn't even run I considered using Still not addressed:
|
I tracked down a couple of issues with the docker container that was being used, and have managed to get things looking pretty much as expected from within the
One other thing that would be optimal would be to separate the unit testing from the CI/CD setup, such that the unit tests can be run independently of the CI/CD, and will then easily plug into a functional CI/CD framework (there will be two, by virtue of the fact that the While moving along these lines, the best way forward will be for you to regularly do a |
closing as "On Hold" |
Travis CI is an online platform for continuous integration, free-to-use for open source projects. It is deeply integrated with Github and can block merge just like landscape can. This PR adds support for Travis CI for gem-plotting-tools.
Description
Travis is very generic and can be told to run arbitrary commands. The "build" fails if any of the commands fails, which is the ideal behavior for unit tests. Travis uses Ubuntu 14.04 as their default environment, and I don't change this.
This PR adds a
.travis.yml
file to enable Travis. This file and the scripts in.travis
setup the following testing environment:gem-plotting-tools
' dependencies (as perrequirements.txt
)cmsgemos
from the default branch [edited: wasmaster
]cmsgemos
' dependencies (as perrequirements.txt
) [edited: new]In addition, this PR adds a test of
ana_scans.py --runType=scurve
. The test will catch syntax errors and fatal exceptions inana_scans.py
andanaUltraScurve.py
, as well as any file they import. The test will not catch other problems. Some changes toana_scans.py
were required in order to make it fail when the subcommands fail.If this PR gets merged, an administrator can subscribe to Travis and enable it within minutes.
Types of changes
Motivation and Context
See #26 for context. Having Travis run every tool for every commit would catch code typos early.
How Has This Been Tested?
The changes were continuously tested on Travis itself (and only there). See here for an example of the test running without error, here for the output of Travis catching bug #24.
Screenshots
This is the current Travis result for my branch
travis
...Checklist: