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

Fix for small plot changes with freetype 2.10. #3297

Merged
merged 2 commits into from
May 9, 2019

Conversation

pp-mo
Copy link
Member

@pp-mo pp-mo commented Mar 22, 2019

HISTORY NOTE
Used to contain a lot of trial code attempting to make 'test_image_json' work.
I've taken all that out again, as that solution now lies in #3308

So this can now be merged ok.
SciTools/test-iris-imagehash#22 relates, but that is now merged.

@stickler-ci
Copy link

Could not review pull request. It may be too large, or contain no reviewable changes.

@pp-mo
Copy link
Member Author

pp-mo commented Mar 22, 2019

(help!!)

I don't get this.

On my desktop, running lib/iris/tests/tests-image_json.py gives :

$ python lib/iris/tests/test_image_json.py -v
/data/local/itpp/miniconda/envs/iristest_py3/lib/python3.6/site-packages/dask/config.py:168: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
  data = yaml.load(f.read()) or {}
test_resolve (__main__.TestImageFile) ... FAIL

======================================================================
FAIL: test_resolve (__main__.TestImageFile)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "lib/iris/tests/test_image_json.py", line 80, in test_resolve
    self.assertTrue(uris.issubset(known_image_uris), msg=amsg)
AssertionError: False is not true : Images are referenced in imagerepo.json but not published in https://scitools.github.io/test-iris-imagehash/images/v4:
https://scitools.github.io/test-iris-imagehash/images/v4/abf895467a1d9506f811783485437abd85427ab995067ab9f00687f96afe87c8.png
https://scitools.github.io/test-iris-imagehash/images/v4/83ffc9d67e00909624059daef160cf4bd45a4b9184367ae5979f7e3909e6261c.png
https://scitools.github.io/test-iris-imagehash/images/v4/abff817ff8018578fc017a80d4027e00855ec42a81fe7a8185fe7a8f85fe6ab5.png
https://scitools.github.io/test-iris-imagehash/images/v4/8ff8c0567a01b296e4019d2ff10b464bd4da6391943678e5879f7e3903e63f1c.png
https://scitools.github.io/test-iris-imagehash/images/v4/8bfec2577e01b5a5ed013b4ac4521c94817d4e4d91ff63369c6d61991e3278cc.png
https://scitools.github.io/test-iris-imagehash/images/v4/affe805ffc008554f8007e01d0027e808557d5ea815f7ea0817f2eea817f2bff.png
https://scitools.github.io/test-iris-imagehash/images/v4/83ff9d9f7e01e1c2b001c8f8f63e1b1d81cf36e1837e258982c66f215c9a6a6c.png
https://scitools.github.io/test-iris-imagehash/images/v4/8ff8c1fa7a05b4fa6c059d2ef1494e4b90f26304847d78c1872a6cfc938b2e3e.png
https://scitools.github.io/test-iris-imagehash/images/v4/8bff817ffc00857ef0007a81d4027e80815fd56a03ff7a8085ff3aa881ff6aa5.png

----------------------------------------------------------------------
Ran 1 test in 1.691s

FAILED (failures=1)
$ 

Which is what I expect, until the test-iris-imagehash PR is merged

However, when I first made this PR, the travis 8970.3 test (python2, not TEST_MINIMAL) was failing with above message, as expected, but the 8970.4 (python3, not TEST_MINIMAL) was "silently" succeeding.
Then I re-spun them both, and the Py2 test passed, but the Py3 one failed in a different way

[(Python2 ok: https://api.travis-ci.org/v3/job/509968372/log.txt) :
(Python3 fail: https://api.travis-ci.org/v3/job/509968373/log.txt) :

update : sorry links don't work, the uris are the same after re-spin
]

ERROR: test_resolve (iris.tests.test_image_json.TestImageFile)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/miniconda/envs/test-environment/lib/python3.6/site-packages/scitools_iris-2.2.1.dev0-py3.6.egg/iris/tests/test_image_json.py", line 63, in test_resolve
    r.text))
ValueError: Github API get failed: https://api.github.com/repos/scitools/test-iris-imagehash/contents/images/v4
-------------------- >> begin captured logging << --------------------
urllib3.connectionpool: DEBUG: Starting new HTTPS connection (1): api.github.com:443
urllib3.connectionpool: DEBUG: https://api.github.com:443 "GET /rate_limit HTTP/1.1" 200 None
urllib3.connectionpool: DEBUG: Starting new HTTPS connection (1): api.github.com:443
urllib3.connectionpool: DEBUG: https://api.github.com:443 "GET /repos/scitools/test-iris-imagehash/contents/images/v4 HTTP/1.1" 403 None
--------------------- >> end captured logging << ---------------------

So, even if the latter is a spurious / occasional failure, it seems that the expected *failure of this test is not reliable : Sometimes this test randomly + unexpectedly fails to fail ???

@pp-mo
Copy link
Member Author

pp-mo commented Mar 22, 2019

Now re-spinning those tests again ...

... and now they both simply pass
something is wrong

lib/iris/tests/test_image_json.py Outdated Show resolved Hide resolved
lib/iris/tests/test_image_json.py Outdated Show resolved Hide resolved
lib/iris/tests/test_image_json.py Outdated Show resolved Hide resolved
@pp-mo
Copy link
Member Author

pp-mo commented Mar 25, 2019

Re-checking with the warning messages for debug, running locally, I had hit the rate-limit for unauthenticated github api requests.
The test then executes unittest.skip("Less than {} anonymous calls to GH API left!"....)
But this effectively exits early, with success and no message.
Possibly this is what was happening on Friday.
I intend to change this to ensure an error in this case ...

@pp-mo
Copy link
Member Author

pp-mo commented Mar 25, 2019

Just observed : Python2 test reports 13 requests remaining (??per hour??), and Python3 reports 0 left, and aborts.
Now, a few (~5-10) minutes later, I will re-spin and see what happens ...

@pp-mo
Copy link
Member Author

pp-mo commented Mar 25, 2019

Further investigation confirms that the "unittest.skip" causes a successful test completion without any message.
The current rate-limit seems to be limit=60 every 15 minutes.

I will re-draft the test to report the rate-limit "skip" as an error.

@pp-mo
Copy link
Member Author

pp-mo commented Mar 27, 2019

Latest : whereas Monday afternoon (25th Mar) I could not get this to behave, yesterday (Tuesday 24th) it did work.
The common failure mechanism seems to be an initial failure to connect to the rate-limit enquiry url, where it is getting a 403 error on the initial get.
This currently falls through with a ghapi_remaining = 0, which is not helpful the error looks like it is a actual lack of available requests.

This is quite distinct from a "real" lack of requests, which looks like this :

======================================================================
ERROR: test_resolve (iris.tests.test_image_json.TestImageFile)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/miniconda/envs/test-environment/lib/python2.7/site-packages/scitools_iris-2.2.1.dev0-py2.7.egg/iris/tests/test_image_json.py", line 61, in test_resolve
    raise ValueError(msg.format(ghapi_remaining, amin))
ValueError: This test failed because it hit a GitHub web API request rate-limit, 
for anonymous requests by "User-Agent: scitools-bot".
N-calls-left is 2, less than margin allowance of 3.
Please retry.
-------------------- >> begin captured logging << --------------------
urllib3.connectionpool: DEBUG: Starting new HTTPS connection (1): api.github.com:443
urllib3.connectionpool: DEBUG: https://api.github.com:443 "GET /rate_limit HTTP/1.1" 200 None
--------------------- >> end captured logging << ---------------------

However, the difference can be seen in the "captured logging" section where the 403 return is visible.
Unfortunately, I have lost the output from these cases.

While this happened consistently on Monday afternoon, it seems to have resolved yesterday.
Possibly it is a consequence of a real out-of-requests failure, or some other independent "throttling" measure.

NEXT STEPS:
I will next amend the code to get a difference message from the "initial contact failure 403" mode.
I will respin a few times, and see if I can stimulate the same continuous-failure problem we had Tuesday afternoon (and if so same capture output this time).

I'll re-propose this PR when I'm confident that it probably won't cause ongoing repeated problems like we saw Monday afternoon !

@pp-mo
Copy link
Member Author

pp-mo commented Mar 27, 2019

Similar problems emerging, including 403 error.
Not clear if this is what actually happened before Mon but I don't think so (I could have got it wrong).

Most recently, getting ...
Python2.7

======================================================================
ERROR: test_resolve (iris.tests.test_image_json.TestImageFile)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/miniconda/envs/test-environment/lib/python2.7/site-packages/scitools_iris-2.2.1.dev0-py2.7.egg/iris/tests/test_image_json.py", line 77, in test_resolve
    r.text))
ValueError: Github API get failed: https://api.github.com/repos/scitools/test-iris-imagehash/contents/images/v4
-------------------- >> begin captured logging << --------------------
urllib3.connectionpool: DEBUG: Starting new HTTPS connection (1): api.github.com:443
urllib3.connectionpool: DEBUG: https://api.github.com:443 "GET /rate_limit HTTP/1.1" 200 None
urllib3.connectionpool: DEBUG: Starting new HTTPS connection (1): api.github.com:443
urllib3.connectionpool: DEBUG: https://api.github.com:443 "GET /repos/scitools/test-iris-imagehash/contents/images/v4 HTTP/1.1" 403 None
--------------------- >> end captured logging << ---------------------

This seems to imply that the results of the rate-limit enquiry were ok, but then the access failed.

Python 3.6

======================================================================
ERROR: test_resolve (iris.tests.test_image_json.TestImageFile)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/miniconda/envs/test-environment/lib/python3.6/site-packages/scitools_iris-2.2.1.dev0-py3.6.egg/iris/tests/test_image_json.py", line 70, in test_resolve
    reset_level, reset_date))
ValueError: This test failed because it hit a GitHub web API request rate-limit, 
for anonymous requests by "User-Agent: scitools-bot".
N-calls-left is 0, less than margin allowance of 3.
Next reset due : 60 requests at 2019-03-27 10:50:16
.Please retry after that time.
-------------------- >> begin captured logging << --------------------
urllib3.connectionpool: DEBUG: Starting new HTTPS connection (1): api.github.com:443
urllib3.connectionpool: DEBUG: https://api.github.com:443 "GET /rate_limit HTTP/1.1" 200 None
--------------------- >> end captured logging << ---------------------

Seems to say that the rate-limit says no remaining requests.
Not sure if I really believe it though.

@pp-mo
Copy link
Member Author

pp-mo commented Mar 27, 2019

Some hours later, re-spin again...

@pp-mo
Copy link
Member Author

pp-mo commented Mar 28, 2019

Results:

  • py2 min : reqs = 0
  • py3 min : reqs = 0
  • py2 full : reqs = 0
  • py3 full : listing failed : https://api.github.com:443 "GET /repos/scitools/test-iris-imagehash/contents/images/v4 HTTP/1.1" 403 None

Respin again for this morning : Thu 28 ...

@pp-mo
Copy link
Member Author

pp-mo commented Mar 28, 2019

... Respin again for this morning : Thu 28 ...

  • py2 min : reqs=0 ; reset=10:40
  • py3 min : reqs=0 ; reset=10:43
  • py2 full : success
  • py3 full : reqs=0 (after timeout + further respin)

@stickler-ci
Copy link

Could not review pull request. It may be too large, or contain no reviewable changes.

@pp-mo pp-mo requested a review from lbdreyer May 8, 2019 15:02
@pp-mo
Copy link
Member Author

pp-mo commented May 9, 2019

Removed text formatting changes in imagerepo.json.
Should be good to go now, @lbdreyer @bjlittle

TL;DR for the below...
>> not sure why we keep getting these format changes ...
I have simplified the diff appearing here : Let's worry about the "correct" format some other time.


I'm still not sure why we keep getting these format changes, but we have added + removed all the trailing spaces several times in the history of the imagerepo.json file.

I suspect that the extra spaces are added by the use of idiff, especially combined with manual editing by contributors who can't remember / work out how to use idiff. Many editors would remove trailing spaces in python mode.
We have outstanding work to document the use of idiff, especially in the unfinished developer docs section on this. Still more unfinished work 😢

So I thought the spaces might come where idiff uses a json.dump to recreate the file.
However, I tried outputting it like that + it didn't seem to have trailing spaces, so I still don't know where they came from.

@lbdreyer lbdreyer merged commit f3d1152 into SciTools:v2.2.x May 9, 2019
lbdreyer pushed a commit to lbdreyer/iris that referenced this pull request May 28, 2019
* Fix for small plot changes with freetype 2.10.

* Remove spurious end-of-line spaces in imagerepo.json.
lbdreyer pushed a commit to lbdreyer/iris that referenced this pull request Jun 3, 2019
* Fix for small plot changes with freetype 2.10.

* Remove spurious end-of-line spaces in imagerepo.json.
lbdreyer pushed a commit to lbdreyer/iris that referenced this pull request Jun 3, 2019
* Fix for small plot changes with freetype 2.10.

* Remove spurious end-of-line spaces in imagerepo.json.
@pp-mo pp-mo deleted the image_fixes branch October 6, 2021 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants