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
DM-14806: bring demo to standards #20
Conversation
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.
Minor things need fixing but it looks great. Thank you.
tests/SConscript
Outdated
@@ -0,0 +1,3 @@ | |||
# -*- python -*- | |||
from lsst.sconsUtils import scripts | |||
scripts.BasicSConscript.tests() |
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.
Can you add pyList=[]
argument so auto file detection is turned on? Then add a setup.cfg
so that we can flake8 the python files.
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.
Done, I think.
tests/test_demo.py
Outdated
|
||
import unittest | ||
|
||
from lsst.utils import tests |
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.
The idiom we use is import lsst.utils.tests
and then be explicit below.
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.
Done.
tests/test_demo.py
Outdated
|
||
from lsst.utils import tests | ||
|
||
executable_dir = 'bin' |
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.
Please determine this relative to this test file so that the tests can run from outside the demo 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.
You mean determine the absolute path, right?
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 mean:
executable_dir = os.path.join(os.path.dirname(__file__), os.path.pardir, "bin")
You might need to include os.path.abspath()
and os.path.normpath()
as well.
ups/lsst_dm_stack_demo.build
Outdated
@@ -0,0 +1,2 @@ | |||
@LSST BUILD@ && |
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.
Is this file needed? I don't have one in daf_butler
and everything works.
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.
Cargo culted from ci_lsst.
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.
Drop it. We don't use the build files any more.
@@ -0,0 +1 @@ | |||
setupRequired(obs_sdss) |
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.
You need to add utils
dependency (you use it in the tests) along with python
and sconsUtils
.
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 I did this.
bin/export-results
Outdated
vecs.append(v) | ||
|
||
for vals in zip(*vecs): | ||
print(' '.join([str(el) for el in vals])) | ||
print(' '.join(['{0:.12g}'.format(el) if issubclass(el.dtype.type, np.floating) else str(el) for el in vals])) |
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.
Might be worth adding a comment before this line
SConstruct
Outdated
@@ -0,0 +1,3 @@ | |||
# -*- python -*- | |||
from lsst.sconsUtils import scripts | |||
scripts.BasicSConstruct("lsst_dm_stack_demo") |
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.
Add disableCc
since we don't need a C++ compiler.
5cb6b1e
to
72f3d9c
Compare
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.
This looks good. I have two comments:
check_astrometry
is not being run but we suggest in the README that it should be run. If it is meant to be run we should run it.- Now that we are building with scons we should fix up the shebang and move the python files to
bin.src
. - The python scripts in
bin/
are not picked up by flake8 because they do not have.py
extensions. Moving them tobin.src
requires we put the.py
extensions on so that will solve this problem.
.travis.yaml
Outdated
language: python | ||
matrix: | ||
include: | ||
- python: '2.7' |
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.
Remove the 2.7 and 3.5 stuff.
sudo: false
language: python
matrix:
include:
- python: '3.6'
install:
- pip install flake8
script: flake8
is sufficient.
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.
Done
.travis.yaml
Outdated
- python: '3.6' | ||
install: | ||
- pip install flake8 | ||
script: flake8 |
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.
missing newline.
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.
Done.
addopts = --flake8 | ||
flake8-ignore = E133 E226 E228 N802 N803 N806 | ||
processCcd.py ALL | ||
andConfig.py ALL |
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.
New line needed.
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.
👍
tests/test_demo.py
Outdated
import lsst.utils.tests | ||
from lsst.utils import getPackageDir | ||
|
||
package_root = getPackageDir('obs_test') |
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.
It's open to debate whether it's best to use getPackageDir
or use this test file location as the reference. I tend to prefer the latter but I'm fine with the former if that's the way you want to go.
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 decided to leave it the way it is. If you hate it, let me know.
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.
It had better be asking for lsst_dm_stack_demo
package location though 😉 -- although as you've written it you are making my case for using __file__
.
ups/lsst_dm_stack_demo.build
Outdated
@@ -0,0 +1 @@ | |||
build_lsst @PRODUCT@ @VERSION@ @REPOVERSION@ |
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.
Remove this 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.
Done.
tests/test_demo.py
Outdated
|
||
|
||
if __name__ == "__main__": | ||
lsst.utils.tests.init() |
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.
This is not necessary. We are not doing any tests that leak files or memory (and it's not run by pytest because there is no setup_module
equivalent.
"""Test demo""" | ||
self.assertExecutable("demo.sh", | ||
root_dir=executable_dir, | ||
args=["--small"], |
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.
Is it okay to use --small
here? How do we ever test with large?
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'm going to leave as is for now as I don't know how this will be dealt with down the road.
setup.cfg
Outdated
@@ -0,0 +1,10 @@ | |||
[flake8] | |||
max-line-length = 110 | |||
ignore = E133, E226, E228, N802, N803 |
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.
Add N806.
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.
Done.
Probably should update the REAME as well. |
@@ -0,0 +1,3 @@ | |||
# -*- python -*- | |||
from lsst.sconsUtils import scripts | |||
scripts.BasicSConscript.shebang() |
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.
Add newline
1f3dbf9
to
6961d67
Compare
@SimonKrughoff I rebased this branch and did a test build on Jenkins. It failed the astrometry check:
|
It also looks like |
Plots should all be controlled by lsstDebug (for now), so this sounds like an easy fix.
|
The plots aren't protected by anything. It always seems to make the PNG. The fix is easy in that we just need to run with a command line option |
|
Can you remind me where this policy is described and if there is a snippet of the recommended wrapper code to implement this? I agree with using |
I was lazy and didn't read the commit -- I expected that useful plots would get added to the Task code (using lsstDebug) and enabled by a command line option, rather than being directly added to the demo framework.
|
@wmwv I think your proposal agrees with mine and looks fine. We do need to set exit status if the astrometry test fails, although I'm not sure if anyone has noticed that this test is failing and what the right answer really is (and whether it matters that @SimonKrughoff changed the filter for the astrometry test to make it work with |
Jenkins doesn't really like plotting things.
I've made some tweaks and it now runs fine on Jenkins and fails because 102 > 100. https://ci.lsst.codes/blue/organizations/jenkins/stack-os-matrix/detail/stack-os-matrix/28221/tests It's for someone else to decide that 102 mas is fine. |
If I understand the above (having only just skimmed it), this doesn't represent a regression in the astrometry — we were already hitting 102 mas, it's just that we didn't previously notice because we weren't running the test. Given that, I don't think we should wait for a judgement on whether that's acceptable before merging: set the test threshold so that it passes, and at least that means we'll catch it if gets worse. If you're nervous about the absolute value, make a ticket to request that @TallJimbo or @ebellm take a look. |
This is indeed the first time we've set exit status and would notice a problem. Digging deeper the difference is the change in filter that @SimonKrughoff had to add to the check program to make it work with
and with the
I'll force this to 105mas for this filter so it will pass. |
With these changes the demo runs on Jenkins as a standard eups package and passes tests. It now doesn't work the old way (it could do with some tweaking to the demo script) but it's not clear we need it to since we will be removing the special case running of demo in Jenkins. |
@@ -14,7 +14,7 @@ Usage | |||
To run the example, do:: | |||
|
|||
$ source $LSST_HOME/loadLSST.sh | |||
$ setup obs_sdss | |||
$ setup -r . |
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.
We need to decide whether the instructions then say "run scons" or whether they stay as they are and we make demo.sh
look in ../bin.src/
for the Python code.
This also takes care of: DM-15044