- 
                Notifications
    You must be signed in to change notification settings 
- Fork 7
          feat(reliability) Add /live and /ready probes
          #90
        
          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
          
     Merged
      
      
    
  
     Merged
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            10 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      201c4a8
              
                feat(reliability) Add /live and /ready probes
              
              
                bplatak 825f80e
              
                review fixes
              
              
                bplatak b0e38d2
              
                fix precommit
              
              
                bplatak d3734d2
              
                fix poetry
              
              
                bplatak 8b80069
              
                fix poetry?
              
              
                bplatak 0bd7f31
              
                maybe fix pre-commit too?
              
              
                bplatak 4141f2a
              
                maybe fix pre-commit again?
              
              
                bplatak 0424a3c
              
                upgrade pythin to 3.11 and add export plugin for poetry
              
              
                bplatak ac4ef35
              
                pls work
              
              
                bplatak e5a2bb4
              
                update README
              
              
                bplatak File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,10 +1,12 @@ | ||
| __pycache__/ | ||
| *.py[cod] | ||
| *$py.class | ||
| poetry.toml | ||
|  | ||
| .DS_Store | ||
| .envrc | ||
| .coverage | ||
|  | ||
| .env | ||
| .vscode/ | ||
| .vscode/ | ||
| .idea/ | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1 +1 @@ | ||
| 3.10 | ||
| 3.11 | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              Large diffs are not rendered by default.
      
      Oops, something went wrong.
      
    
  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,10 +1,10 @@ | ||
| [tool.mypy] | ||
| python_version = "3.10" | ||
| python_version = "3.11" | ||
| ignore_missing_imports = true | ||
|  | ||
| [tool.poetry] | ||
| name = "pyth-observer" | ||
| version = "0.3.5" | ||
| version = "2.1.4" | ||
| description = "Alerts and stuff" | ||
| authors = [] | ||
| readme = "README.md" | ||
|  | @@ -28,6 +28,7 @@ types-pyyaml = "^6.0.12" | |
| types-pytz = "^2022.4.0.0" | ||
| python-dotenv = "^1.0.1" | ||
| numpy = "^2.1.3" | ||
| cffi = "^1.17" | ||
|  | ||
|  | ||
| [tool.poetry.group.dev.dependencies] | ||
|  | @@ -47,3 +48,6 @@ pyth-observer = "pyth_observer.cli:run" | |
| [build-system] | ||
| requires = ["poetry-core"] | ||
| build-backend = "poetry.core.masonry.api" | ||
|  | ||
| [tool.poetry.requires-plugins] | ||
| poetry-plugin-export = ">=1.8" | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. newline | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| import asyncio | ||
|  | ||
| from aiohttp import web | ||
|  | ||
| observer_ready = False | ||
|         
                  bplatak marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
|  | ||
|  | ||
| async def live_handler(request): | ||
| return web.Response(text="OK") | ||
|  | ||
|  | ||
| async def ready_handler(request): | ||
| if observer_ready: | ||
| return web.Response(text="OK") | ||
| else: | ||
| return web.Response(status=503, text="Not Ready") | ||
|  | ||
|  | ||
| async def start_health_server(port=8080): | ||
| app = web.Application() | ||
| app.router.add_get("/live", live_handler) | ||
| app.router.add_get("/ready", ready_handler) | ||
| runner = web.AppRunner(app) | ||
| await runner.setup() | ||
| site = web.TCPSite(runner, "0.0.0.0", port) | ||
| await site.start() | ||
| while True: | ||
| await asyncio.sleep(3600) | ||
|         
                  bplatak marked this conversation as resolved.
              Show resolved
            Hide resolved         
                  bplatak marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.