prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Figure out what to do with http_service on CI
  We have two options:
  - build the http_service with fake models and don't push it on CI. Build it with real models and push it after training;
  - build the http_service without models and let it download models at runtime.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `http_service/check_models.py`
  Content:
  ```
  1 # -*- coding: utf-8 -*-
  2 # This Source Code Form is subject to the terms of the Mozilla Public
  3 # License, v. 2.0. If a copy of the MPL was not distributed with this file,
  4 # You can obtain one at http://mozilla.org/MPL/2.0/.
  5 
  6 import logging
  7 import os
  8 import sys
  9 
  10 from bugbug.models.component import ComponentModel
  11 from bugbug.models.defect_enhancement_task import DefectEnhancementTaskModel
  12 from bugbug.models.regression import RegressionModel
  13 
  14 logging.basicConfig(level=logging.INFO)
  15 LOGGER = logging.getLogger()
  16 
  17 MODELS = {
  18     "defectenhancementtask": DefectEnhancementTaskModel,
  19     "component": ComponentModel,
  20     "regression": RegressionModel,
  21 }
  22 MODELS_DIR = os.path.join(os.path.dirname(__file__), "models")
  23 
  24 
  25 def load_model(model):
  26     model_file_path = os.path.join(MODELS_DIR, f"{model}model")
  27     LOGGER.info(f"Lookup model in {model_file_path}")
  28     model = MODELS[model].load(model_file_path)
  29     return model
  30 
  31 
  32 def check_models():
  33     for model_name in MODELS.keys():
  34         # Try loading the model
  35         load_model(model_name)
  36 
  37 
  38 if __name__ == "__main__":
  39     try:
  40         check_models()
  41     except Exception:
  42         LOGGER.warning(
  43             "Failed to validate the models, please run `python models.py download`",
  44             exc_info=True,
  45         )
  46         sys.exit(1)
  47
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/http_service/check_models.py b/http_service/check_models.py
  --- a/http_service/check_models.py
  +++ b/http_service/check_models.py
  @@ -36,6 +36,13 @@
   
   
   if __name__ == "__main__":
  +
  +    should_check_models = os.environ.get("CHECK_MODELS", "1")
  +
  +    if should_check_models == "0":
  +        print("Skipping checking models as instructed by env var $CHECK_MODELS")
  +        sys.exit(0)
  +
       try:
           check_models()
       except Exception:
  
verification_info: {"golden_diff": "diff --git a/http_service/check_models.py b/http_service/check_models.py\n--- a/http_service/check_models.py\n+++ b/http_service/check_models.py\n@@ -36,6 +36,13 @@\n \n \n if __name__ == \"__main__\":\n+\n+    should_check_models = os.environ.get(\"CHECK_MODELS\", \"1\")\n+\n+    if should_check_models == \"0\":\n+        print(\"Skipping checking models as instructed by env var $CHECK_MODELS\")\n+        sys.exit(0)\n+\n     try:\n         check_models()\n     except Exception:\n", "issue": "Figure out what to do with http_service on CI\nWe have two options:\r\n- build the http_service with fake models and don't push it on CI. Build it with real models and push it after training;\r\n- build the http_service without models and let it download models at runtime.\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n# This Source Code Form is subject to the terms of the Mozilla Public\n# License, v. 2.0. If a copy of the MPL was not distributed with this file,\n# You can obtain one at http://mozilla.org/MPL/2.0/.\n\nimport logging\nimport os\nimport sys\n\nfrom bugbug.models.component import ComponentModel\nfrom bugbug.models.defect_enhancement_task import DefectEnhancementTaskModel\nfrom bugbug.models.regression import RegressionModel\n\nlogging.basicConfig(level=logging.INFO)\nLOGGER = logging.getLogger()\n\nMODELS = {\n    \"defectenhancementtask\": DefectEnhancementTaskModel,\n    \"component\": ComponentModel,\n    \"regression\": RegressionModel,\n}\nMODELS_DIR = os.path.join(os.path.dirname(__file__), \"models\")\n\n\ndef load_model(model):\n    model_file_path = os.path.join(MODELS_DIR, f\"{model}model\")\n    LOGGER.info(f\"Lookup model in {model_file_path}\")\n    model = MODELS[model].load(model_file_path)\n    return model\n\n\ndef check_models():\n    for model_name in MODELS.keys():\n        # Try loading the model\n        load_model(model_name)\n\n\nif __name__ == \"__main__\":\n    try:\n        check_models()\n    except Exception:\n        LOGGER.warning(\n            \"Failed to validate the models, please run `python models.py download`\",\n            exc_info=True,\n        )\n        sys.exit(1)\n", "path": "http_service/check_models.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n# This Source Code Form is subject to the terms of the Mozilla Public\n# License, v. 2.0. If a copy of the MPL was not distributed with this file,\n# You can obtain one at http://mozilla.org/MPL/2.0/.\n\nimport logging\nimport os\nimport sys\n\nfrom bugbug.models.component import ComponentModel\nfrom bugbug.models.defect_enhancement_task import DefectEnhancementTaskModel\nfrom bugbug.models.regression import RegressionModel\n\nlogging.basicConfig(level=logging.INFO)\nLOGGER = logging.getLogger()\n\nMODELS = {\n    \"defectenhancementtask\": DefectEnhancementTaskModel,\n    \"component\": ComponentModel,\n    \"regression\": RegressionModel,\n}\nMODELS_DIR = os.path.join(os.path.dirname(__file__), \"models\")\n\n\ndef load_model(model):\n    model_file_path = os.path.join(MODELS_DIR, f\"{model}model\")\n    LOGGER.info(f\"Lookup model in {model_file_path}\")\n    model = MODELS[model].load(model_file_path)\n    return model\n\n\ndef check_models():\n    for model_name in MODELS.keys():\n        # Try loading the model\n        load_model(model_name)\n\n\nif __name__ == \"__main__\":\n\n    should_check_models = os.environ.get(\"CHECK_MODELS\", \"1\")\n\n    if should_check_models == \"0\":\n        print(\"Skipping checking models as instructed by env var $CHECK_MODELS\")\n        sys.exit(0)\n\n    try:\n        check_models()\n    except Exception:\n        LOGGER.warning(\n            \"Failed to validate the models, please run `python models.py download`\",\n            exc_info=True,\n        )\n        sys.exit(1)\n", "path": "http_service/check_models.py"}]}