[galaxyproject/galaxy] 1a43ef: Work around (temporarily) wrong getsize() output
Branch: refs/heads/dev Home: https://github.com/galaxyproject/galaxy Commit: 1a43ef5b83d7378faa653451ebc38a54725a7481 https://github.com/galaxyproject/galaxy/commit/1a43ef5b83d7378faa653451ebc38... Author: mvdbeek <m.vandenbeek@gmail.com> Date: 2018-01-19 (Fri, 19 Jan 2018) Changed paths: M lib/galaxy/objectstore/__init__.py Log Message: ----------- Work around (temporarily) wrong getsize() output I'm not sure how/why this happens, but this can be reproduced by copying a file to a location in one process, while checking the size in another process: Run this to copy a file indefinitely: ``` import os import shutil open('test').write("foo") while True: shutil.copy('test', 'test.file') os.remove('test.file') ``` In the same directory run this ``` import os count = 0 wrong_size = False while True: try: size = os.path.getsize('test.file') if size == 0: wrong_size = True wrong_count = count elif wrong_size and os.path.getsize('test.file') != 0: # We have seen the wrong size being reported, but now it's correct again print("Got wrong file size at %dnd try, was fixed in %dnd try" % (wrong_count, count)) break except Exception: pass count += 1 ``` It'll (probably) fail like this: ``` Got wrong file size at 0nd try, was fixed in 1nd try ``` or more often: ``` Got wrong file size at 31nd try, was fixed in 32nd try ``` This seems to be fixed when running os.path.getsize() another time, so we simply do that here. Commit: 16344a62d3a8f30f4c468b552ce49ca989a1f0b7 https://github.com/galaxyproject/galaxy/commit/16344a62d3a8f30f4c468b552ce49... Author: mvdbeek <m.vandenbeek@gmail.com> Date: 2018-01-19 (Fri, 19 Jan 2018) Changed paths: M lib/galaxy/jobs/__init__.py Log Message: ----------- Alternative fix for missing metadata on datasets that report output size 0 Commit: 161467513b3f911cde15b890c404ed373f4571f4 https://github.com/galaxyproject/galaxy/commit/161467513b3f911cde15b890c404e... Author: mvdbeek <m.vandenbeek@gmail.com> Date: 2018-01-19 (Fri, 19 Jan 2018) Changed paths: M lib/galaxy/objectstore/__init__.py Log Message: ----------- Use a for loop when checking size in object store and adjust `empty()` to use the new code. Thanks @nsoranzo. Commit: c8a7b7b07cad174b0d8ed142be9fa3ec4a6ed997 https://github.com/galaxyproject/galaxy/commit/c8a7b7b07cad174b0d8ed142be9fa... Author: Nicola Soranzo <nsoranzo@tiscali.it> Date: 2018-01-19 (Fri, 19 Jan 2018) Changed paths: M lib/galaxy/jobs/__init__.py M lib/galaxy/objectstore/__init__.py Log Message: ----------- Merge pull request #5335 from mvdbeek/no_check_data Work around (temporarily) wrong getsize() output Compare: https://github.com/galaxyproject/galaxy/compare/4993249ab6b9...c8a7b7b07cad
participants (1)
-
GitHub