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

Assumption of having a .zip file for an artifact could be "wrong" #92

Closed
yarikoptic opened this issue Jun 10, 2021 · 3 comments · Fixed by #132
Closed

Assumption of having a .zip file for an artifact could be "wrong" #92

yarikoptic opened this issue Jun 10, 2021 · 3 comments · Fixed by #132
Assignees

Comments

@yarikoptic
Copy link
Member

yarikoptic commented Jun 10, 2021

2021-06-10T14:47:13-0400 [INFO    ] tinuous Downloading logs for build-windows.yaml (Build git-annex on Windows) #247 to builds/2021/05/cron-20210514/build-windows.yaml-247-44196064-success
2021-06-10T14:47:16-0400 [INFO    ] tinuous Downloading asset git-annex-windows-installer_8.20210428+git137-g5004eed27_x64 for build-windows.yaml (Build git-annex on Windows) #247 to builds/2021/05/cron-20210514/build-windows.yaml-247-44196064-success
Traceback (most recent call last):
  File "/home/datalad/miniconda3/envs/tinuous-dev/bin/tinuous", line 33, in <module>
    sys.exit(load_entry_point('tinuous', 'console_scripts', 'tinuous')())
  File "/home/datalad/miniconda3/envs/tinuous-dev/lib/python3.9/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/datalad/miniconda3/envs/tinuous-dev/lib/python3.9/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/datalad/miniconda3/envs/tinuous-dev/lib/python3.9/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/datalad/miniconda3/envs/tinuous-dev/lib/python3.9/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/datalad/miniconda3/envs/tinuous-dev/lib/python3.9/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/datalad/miniconda3/envs/tinuous-dev/lib/python3.9/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context().obj, *args, **kwargs)
  File "/mnt/datasets/datalad/ci/tinuous/src/tinuous/__main__.py", line 126, in fetch
    paths = obj.download(Path(path))
  File "/mnt/datasets/datalad/ci/tinuous/src/tinuous/github.py", line 341, in download
    with ZipFile(zippath) as zf:
  File "/home/datalad/miniconda3/envs/tinuous-dev/lib/python3.9/zipfile.py", line 1257, in __init__
    self._RealGetContents()
  File "/home/datalad/miniconda3/envs/tinuous-dev/lib/python3.9/zipfile.py", line 1324, in _RealGetContents
    raise BadZipFile("File is not a zip file")
zipfile.BadZipFile: File is not a zip file

I wonder if it was some json or HTML telling us something about anything? I have not looked at the code if we guard there for return codes (may be was one of the timeouts or smth). If there is no guard -- should be added along with a retry

Seems to not happen frequently, but also the removal of the file (I guess it was removed) forbids any introspection - may be some information could be provided there about the file (e.g. file size and may be even content if file e.g. < 10k in size?) before it gets purged?

edit: upon rerun tinuous happily fetched it:

(tinuous-dev) datalad@smaug:/mnt/datasets/datalad/ci/git-annex$ ls builds/2021/05/cron-20210514/build-windows.yaml-247-44196064-success/git-annex-windows-installer_8.20210428+git137-g5004eed27_x64/
dist  git-annex-installer_8.20210428+git137-g5004eed27_x64.exe

tinuous 0.2.0+54.g0f13cf6

@jwodder
Copy link
Member

jwodder commented Jun 11, 2021

@yarikoptic The documentation all but explicitly states that artifacts are downloaded as zips. I think this was just a temporary fluke on GitHub's part.

@yarikoptic
Copy link
Member Author

not too long after the gateway error out, got another errorred out run

2021-08-05T12:40:05-0400 [INFO    ] tinuous Found run 1933                                                                                                                           
2021-08-05T12:40:05-0400 [INFO    ] tinuous Logs for test_crippled.yml (CrippledFS) #1933 already downloaded to 2021/08/05/pr/5708/047c1cf/github-CrippledFS-1933-success; skipping  
2021-08-05T12:40:05-0400 [INFO    ] tinuous Fetching runs for workflow .github/workflows/update-contributors.yml (allcontributors-auto-detect)                                       
2021-08-05T12:40:06-0400 [INFO    ] tinuous Fetching runs for workflow .github/workflows/test_macos.yml (Test on macOS)                                                              
2021-08-05T12:40:06-0400 [INFO    ] tinuous Found run 1696                                                                                                                           
2021-08-05T12:40:06-0400 [INFO    ] tinuous Downloading logs for test_macos.yml (Test on macOS) #1696 to 2021/08/05/pr/5708/047c1cf/github-Test on macOS-1696-success                
2021-08-05T12:40:16-0400 [WARNING ] tinuous Request to https://api.github.com/repos/datalad/datalad/actions/runs/1102006275/logs returned 502; waiting & retrying                    
Traceback (most recent call last):                                                                                                                                                   
  File "/home/datalad/miniconda3/envs/tinuous-dev/bin/tinuous", line 33, in <module>                                                                                                 
    sys.exit(load_entry_point('tinuous', 'console_scripts', 'tinuous')())                                                                                                            
  File "/home/datalad/miniconda3/envs/tinuous-dev/lib/python3.9/site-packages/click/core.py", line 829, in __call__                                                                  
    return self.main(*args, **kwargs)                                                                                                                                                
  File "/home/datalad/miniconda3/envs/tinuous-dev/lib/python3.9/site-packages/click/core.py", line 782, in main                                                                      
    rv = self.invoke(ctx)                                                                                                                                                            
  File "/home/datalad/miniconda3/envs/tinuous-dev/lib/python3.9/site-packages/click/core.py", line 1259, in invoke                                                                   
    return _process_result(sub_ctx.command.invoke(sub_ctx))                                                                                                                          
  File "/home/datalad/miniconda3/envs/tinuous-dev/lib/python3.9/site-packages/click/core.py", line 1066, in invoke                                                                   
    return ctx.invoke(self.callback, **ctx.params)                                                                                                                                   
  File "/home/datalad/miniconda3/envs/tinuous-dev/lib/python3.9/site-packages/click/core.py", line 610, in invoke                                                                    
    return callback(*args, **kwargs)                                                                                                                                                 
  File "/home/datalad/miniconda3/envs/tinuous-dev/lib/python3.9/site-packages/click/decorators.py", line 33, in new_func                                                             
    return f(get_current_context().obj, *args, **kwargs)                                                                                                                             
  File "/mnt/datasets/datalad/ci/tinuous/src/tinuous/__main__.py", line 126, in fetch                                                                                                
    paths = obj.download(Path(path))                                                                                                                                                 
  File "/mnt/datasets/datalad/ci/tinuous/src/tinuous/github.py", line 330, in download                                                                                               
    with BytesIO(r.content) as blob, ZipFile(blob) as zf:                                                                                                                            
  File "/home/datalad/miniconda3/envs/tinuous-dev/lib/python3.9/zipfile.py", line 1257, in __init__                                                                                  
    self._RealGetContents()                                                                                                                                                          
  File "/home/datalad/miniconda3/envs/tinuous-dev/lib/python3.9/zipfile.py", line 1324, in _RealGetContents                                                                          
    raise BadZipFile("File is not a zip file")                                                                                                                                       
zipfile.BadZipFile: File is not a zip file    

so even if doc says one thing, clearly something else might be happening and we should figure out what leads to it (may be some html with error returned) and might just need to retry

@yarikoptic
Copy link
Member Author

I think this was just a temporary fluke on GitHub's part.

Let's handle that fluke programmatically -- sleep some and retry. I don't have a good clue on how long/many -- probably up to 5 stretching to a few minutes

yarikoptic added a commit that referenced this issue Aug 11, 2021
Retry downloads of invalid zipfiles
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 a pull request may close this issue.

2 participants