Skip to content

Commit

Permalink
Fix an issue where fallback HTTP doesn't get told it should notify wh…
Browse files Browse the repository at this point in the history
…en done (#66)

* Fix an issue where fallback HTTP doesn't get told it should notify when done

* Timeout-with-fallback-then-continue is the same as no-timout, given that all operations are guaranteed to end with a notification.
  • Loading branch information
jpivarski authored Aug 10, 2020
1 parent 4261d55 commit aa3f403
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
build:
strategy:
matrix:
platform: ["ubuntu-latest", "macos-latest", "windows-latest"]
platform: ["windows-latest", "macos-latest", "ubuntu-latest"]
python-version: ["3.5", "3.6", "3.7", "3.8"]
exclude:
- platform: "macos-latest"
Expand Down
15 changes: 15 additions & 0 deletions tests/test_0066-fix-http-fallback-freeze.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# BSD 3-Clause License; see https://github.com/scikit-hep/uproot4/blob/master/LICENSE

from __future__ import absolute_import

import numpy
import pytest

import uproot4


@pytest.mark.network
def test():
with uproot4.open("http://scikit-hep.org/uproot/examples/HZZ.root:events") as t:
t["MET_px"].array()
t["MET_py"].array()
5 changes: 1 addition & 4 deletions uproot4/behaviors/TBranch.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,10 +500,7 @@ def basket_to_array(basket):
notifications.put(None)

while len(arrays) < len(branchid_interpretation):
try:
obj = notifications.get(timeout=0.001)
except queue.Empty:
continue
obj = notifications.get()

if isinstance(obj, uproot4.source.chunk.Chunk):
chunk = obj
Expand Down
1 change: 1 addition & 0 deletions uproot4/source/futures.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ def run(self):
future._result = future._task(self._resource)
except Exception:
future._excinfo = sys.exc_info()

future._set_finished()


Expand Down
4 changes: 3 additions & 1 deletion uproot4/source/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,9 @@ def chunks(self, ranges, exact=True, notifications=None):
self._num_requested_bytes += sum(stop - start for start, stop in ranges)

if self._worker.fallback is not None:
return self._worker.fallback.chunks(ranges)
return self._worker.fallback.chunks(
ranges, exact=exact, notifications=notifications
)

else:
range_strings = []
Expand Down

0 comments on commit aa3f403

Please sign in to comment.