prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Store pipeline tasks in the index, and update Taskcluster URLs in scripts
  The scripts are still using the old URLs from releng-services.
  Store pipeline tasks in the index, and update Taskcluster URLs in scripts
  The scripts are still using the old URLs from releng-services.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `scripts/trainer.py`
  Content:
  ```
  1 # -*- coding: utf-8 -*-
  2 
  3 import argparse
  4 import lzma
  5 import os
  6 import shutil
  7 from logging import INFO, basicConfig, getLogger
  8 from urllib.request import urlretrieve
  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 from bugbug.models.tracking import TrackingModel
  14 
  15 basicConfig(level=INFO)
  16 logger = getLogger(__name__)
  17 
  18 BASE_URL = "https://index.taskcluster.net/v1/task/project.releng.services.project.testing.bugbug_data.latest/artifacts/public"
  19 
  20 
  21 class Trainer(object):
  22     def decompress_file(self, path):
  23         with lzma.open(f"{path}.xz", "rb") as input_f:
  24             with open(path, "wb") as output_f:
  25                 shutil.copyfileobj(input_f, output_f)
  26 
  27     def compress_file(self, path):
  28         with open(path, "rb") as input_f:
  29             with lzma.open(f"{path}.xz", "wb") as output_f:
  30                 shutil.copyfileobj(input_f, output_f)
  31 
  32     def train_defect_enhancement_task(self):
  33         logger.info("Training *defect vs enhancement vs task* model")
  34         model = DefectEnhancementTaskModel()
  35         model.train()
  36         self.compress_file("defectenhancementtaskmodel")
  37 
  38     def train_component(self):
  39         logger.info("Training *component* model")
  40         model = ComponentModel()
  41         model.train()
  42         self.compress_file("componentmodel")
  43 
  44     def train_regression(self):
  45         logger.info("Training *regression vs non-regression* model")
  46         model = RegressionModel()
  47         model.train()
  48         self.compress_file("regressionmodel")
  49 
  50     def train_tracking(self):
  51         logger.info("Training *tracking* model")
  52         model = TrackingModel()
  53         model.train()
  54         self.compress_file("trackingmodel")
  55 
  56     def go(self, model):
  57         # TODO: Stop hard-coding them
  58         valid_models = ["defect", "component", "regression", "tracking"]
  59 
  60         if model not in valid_models:
  61             exception = (
  62                 f"Invalid model {model!r} name, use one of {valid_models!r} instead"
  63             )
  64             raise ValueError(exception)
  65 
  66         # Download datasets that were built by bugbug_data.
  67         os.makedirs("data", exist_ok=True)
  68 
  69         # Bugs.json
  70         logger.info("Downloading bugs database")
  71         urlretrieve(f"{BASE_URL}/bugs.json.xz", "data/bugs.json.xz")
  72         logger.info("Decompressing bugs database")
  73         self.decompress_file("data/bugs.json")
  74 
  75         # Commits.json
  76         logger.info("Downloading commits database")
  77         urlretrieve(f"{BASE_URL}/commits.json.xz", "data/commits.json.xz")
  78         logger.info("Decompressing commits database")
  79         self.decompress_file("data/commits.json")
  80 
  81         if model == "defect":
  82             # Train classifier for defect-vs-enhancement-vs-task.
  83             self.train_defect_enhancement_task()
  84         elif model == "component":
  85             # Train classifier for the component of a bug.
  86             self.train_component()
  87         elif model == "regression":
  88             # Train classifier for regression-vs-nonregression.
  89             self.train_regression()
  90         elif model == "tracking":
  91             # Train classifier for tracking bugs.
  92             self.train_tracking()
  93         else:
  94             # We shouldn't be here
  95             raise Exception("valid_models is likely not up-to-date anymore")
  96 
  97 
  98 def main():
  99     description = "Train the models"
  100     parser = argparse.ArgumentParser(description=description)
  101 
  102     parser.add_argument("model", help="Which model to train.")
  103 
  104     args = parser.parse_args()
  105 
  106     retriever = Trainer()
  107     retriever.go(args.model)
  108
  ```
  
  Path: `http_service/download_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 lzma
  8 import os
  9 import shutil
  10 from urllib.request import urlretrieve
  11 
  12 import requests
  13 
  14 logging.basicConfig(level=logging.INFO)
  15 LOGGER = logging.getLogger()
  16 
  17 BASE_URL = "https://index.taskcluster.net/v1/task/project.releng.services.project.testing.bugbug_train.latest/artifacts/public"
  18 
  19 MODELS_NAMES = ("defectenhancementtask", "component", "regression")
  20 MODELS_DIR = os.path.join(os.path.dirname(__file__), "models")
  21 
  22 
  23 def retrieve_model(name):
  24     os.makedirs(MODELS_DIR, exist_ok=True)
  25 
  26     file_name = f"{name}model"
  27     file_path = os.path.join(MODELS_DIR, file_name)
  28 
  29     model_url = f"{BASE_URL}/{file_name}.xz"
  30     LOGGER.info(f"Checking ETAG of {model_url}")
  31     r = requests.head(model_url, allow_redirects=True)
  32     r.raise_for_status()
  33     new_etag = r.headers["ETag"]
  34 
  35     try:
  36         with open(f"{file_path}.etag", "r") as f:
  37             old_etag = f.read()
  38     except IOError:
  39         old_etag = None
  40 
  41     if old_etag != new_etag:
  42         LOGGER.info(f"Downloading the model from {model_url}")
  43         urlretrieve(model_url, f"{file_path}.xz")
  44 
  45         with lzma.open(f"{file_path}.xz", "rb") as input_f:
  46             with open(file_path, "wb") as output_f:
  47                 shutil.copyfileobj(input_f, output_f)
  48                 LOGGER.info(f"Written model in {file_path}")
  49 
  50         with open(f"{file_path}.etag", "w") as f:
  51             f.write(new_etag)
  52     else:
  53         LOGGER.info(f"ETAG for {model_url} is ok")
  54 
  55     return file_path
  56 
  57 
  58 def preload_models():
  59     for model_name in MODELS_NAMES:
  60         retrieve_model(model_name)
  61 
  62 
  63 if __name__ == "__main__":
  64     preload_models()
  65
  ```
  --- 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/download_models.py b/http_service/download_models.py
  --- a/http_service/download_models.py
  +++ b/http_service/download_models.py
  @@ -14,7 +14,7 @@
   logging.basicConfig(level=logging.INFO)
   LOGGER = logging.getLogger()
   
  -BASE_URL = "https://index.taskcluster.net/v1/task/project.releng.services.project.testing.bugbug_train.latest/artifacts/public"
  +BASE_URL = "https://index.taskcluster.net/v1/task/project.relman.bugbug.train_{}.latest/artifacts/public"
   
   MODELS_NAMES = ("defectenhancementtask", "component", "regression")
   MODELS_DIR = os.path.join(os.path.dirname(__file__), "models")
  @@ -26,7 +26,8 @@
       file_name = f"{name}model"
       file_path = os.path.join(MODELS_DIR, file_name)
   
  -    model_url = f"{BASE_URL}/{file_name}.xz"
  +    base_model_url = BASE_URL.format(name)
  +    model_url = f"{base_model_url}/{file_name}.xz"
       LOGGER.info(f"Checking ETAG of {model_url}")
       r = requests.head(model_url, allow_redirects=True)
       r.raise_for_status()
  diff --git a/scripts/trainer.py b/scripts/trainer.py
  --- a/scripts/trainer.py
  +++ b/scripts/trainer.py
  @@ -15,7 +15,7 @@
   basicConfig(level=INFO)
   logger = getLogger(__name__)
   
  -BASE_URL = "https://index.taskcluster.net/v1/task/project.releng.services.project.testing.bugbug_data.latest/artifacts/public"
  +BASE_URL = "https://index.taskcluster.net/v1/task/project.relman.bugbug.data_{}.latest/artifacts/public"
   
   
   class Trainer(object):
  @@ -68,13 +68,15 @@
   
           # Bugs.json
           logger.info("Downloading bugs database")
  -        urlretrieve(f"{BASE_URL}/bugs.json.xz", "data/bugs.json.xz")
  +        bugs_url = BASE_URL.format("bugs")
  +        urlretrieve(f"{bugs_url}/bugs.json.xz", "data/bugs.json.xz")
           logger.info("Decompressing bugs database")
           self.decompress_file("data/bugs.json")
   
           # Commits.json
           logger.info("Downloading commits database")
  -        urlretrieve(f"{BASE_URL}/commits.json.xz", "data/commits.json.xz")
  +        commits_url = BASE_URL.format("commits")
  +        urlretrieve(f"{commits_url}/commits.json.xz", "data/commits.json.xz")
           logger.info("Decompressing commits database")
           self.decompress_file("data/commits.json")
  
verification_info: {"golden_diff": "diff --git a/http_service/download_models.py b/http_service/download_models.py\n--- a/http_service/download_models.py\n+++ b/http_service/download_models.py\n@@ -14,7 +14,7 @@\n logging.basicConfig(level=logging.INFO)\n LOGGER = logging.getLogger()\n \n-BASE_URL = \"https://index.taskcluster.net/v1/task/project.releng.services.project.testing.bugbug_train.latest/artifacts/public\"\n+BASE_URL = \"https://index.taskcluster.net/v1/task/project.relman.bugbug.train_{}.latest/artifacts/public\"\n \n MODELS_NAMES = (\"defectenhancementtask\", \"component\", \"regression\")\n MODELS_DIR = os.path.join(os.path.dirname(__file__), \"models\")\n@@ -26,7 +26,8 @@\n     file_name = f\"{name}model\"\n     file_path = os.path.join(MODELS_DIR, file_name)\n \n-    model_url = f\"{BASE_URL}/{file_name}.xz\"\n+    base_model_url = BASE_URL.format(name)\n+    model_url = f\"{base_model_url}/{file_name}.xz\"\n     LOGGER.info(f\"Checking ETAG of {model_url}\")\n     r = requests.head(model_url, allow_redirects=True)\n     r.raise_for_status()\ndiff --git a/scripts/trainer.py b/scripts/trainer.py\n--- a/scripts/trainer.py\n+++ b/scripts/trainer.py\n@@ -15,7 +15,7 @@\n basicConfig(level=INFO)\n logger = getLogger(__name__)\n \n-BASE_URL = \"https://index.taskcluster.net/v1/task/project.releng.services.project.testing.bugbug_data.latest/artifacts/public\"\n+BASE_URL = \"https://index.taskcluster.net/v1/task/project.relman.bugbug.data_{}.latest/artifacts/public\"\n \n \n class Trainer(object):\n@@ -68,13 +68,15 @@\n \n         # Bugs.json\n         logger.info(\"Downloading bugs database\")\n-        urlretrieve(f\"{BASE_URL}/bugs.json.xz\", \"data/bugs.json.xz\")\n+        bugs_url = BASE_URL.format(\"bugs\")\n+        urlretrieve(f\"{bugs_url}/bugs.json.xz\", \"data/bugs.json.xz\")\n         logger.info(\"Decompressing bugs database\")\n         self.decompress_file(\"data/bugs.json\")\n \n         # Commits.json\n         logger.info(\"Downloading commits database\")\n-        urlretrieve(f\"{BASE_URL}/commits.json.xz\", \"data/commits.json.xz\")\n+        commits_url = BASE_URL.format(\"commits\")\n+        urlretrieve(f\"{commits_url}/commits.json.xz\", \"data/commits.json.xz\")\n         logger.info(\"Decompressing commits database\")\n         self.decompress_file(\"data/commits.json\")\n", "issue": "Store pipeline tasks in the index, and update Taskcluster URLs in scripts\nThe scripts are still using the old URLs from releng-services.\nStore pipeline tasks in the index, and update Taskcluster URLs in scripts\nThe scripts are still using the old URLs from releng-services.\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\nimport argparse\nimport lzma\nimport os\nimport shutil\nfrom logging import INFO, basicConfig, getLogger\nfrom urllib.request import urlretrieve\n\nfrom bugbug.models.component import ComponentModel\nfrom bugbug.models.defect_enhancement_task import DefectEnhancementTaskModel\nfrom bugbug.models.regression import RegressionModel\nfrom bugbug.models.tracking import TrackingModel\n\nbasicConfig(level=INFO)\nlogger = getLogger(__name__)\n\nBASE_URL = \"https://index.taskcluster.net/v1/task/project.releng.services.project.testing.bugbug_data.latest/artifacts/public\"\n\n\nclass Trainer(object):\n    def decompress_file(self, path):\n        with lzma.open(f\"{path}.xz\", \"rb\") as input_f:\n            with open(path, \"wb\") as output_f:\n                shutil.copyfileobj(input_f, output_f)\n\n    def compress_file(self, path):\n        with open(path, \"rb\") as input_f:\n            with lzma.open(f\"{path}.xz\", \"wb\") as output_f:\n                shutil.copyfileobj(input_f, output_f)\n\n    def train_defect_enhancement_task(self):\n        logger.info(\"Training *defect vs enhancement vs task* model\")\n        model = DefectEnhancementTaskModel()\n        model.train()\n        self.compress_file(\"defectenhancementtaskmodel\")\n\n    def train_component(self):\n        logger.info(\"Training *component* model\")\n        model = ComponentModel()\n        model.train()\n        self.compress_file(\"componentmodel\")\n\n    def train_regression(self):\n        logger.info(\"Training *regression vs non-regression* model\")\n        model = RegressionModel()\n        model.train()\n        self.compress_file(\"regressionmodel\")\n\n    def train_tracking(self):\n        logger.info(\"Training *tracking* model\")\n        model = TrackingModel()\n        model.train()\n        self.compress_file(\"trackingmodel\")\n\n    def go(self, model):\n        # TODO: Stop hard-coding them\n        valid_models = [\"defect\", \"component\", \"regression\", \"tracking\"]\n\n        if model not in valid_models:\n            exception = (\n                f\"Invalid model {model!r} name, use one of {valid_models!r} instead\"\n            )\n            raise ValueError(exception)\n\n        # Download datasets that were built by bugbug_data.\n        os.makedirs(\"data\", exist_ok=True)\n\n        # Bugs.json\n        logger.info(\"Downloading bugs database\")\n        urlretrieve(f\"{BASE_URL}/bugs.json.xz\", \"data/bugs.json.xz\")\n        logger.info(\"Decompressing bugs database\")\n        self.decompress_file(\"data/bugs.json\")\n\n        # Commits.json\n        logger.info(\"Downloading commits database\")\n        urlretrieve(f\"{BASE_URL}/commits.json.xz\", \"data/commits.json.xz\")\n        logger.info(\"Decompressing commits database\")\n        self.decompress_file(\"data/commits.json\")\n\n        if model == \"defect\":\n            # Train classifier for defect-vs-enhancement-vs-task.\n            self.train_defect_enhancement_task()\n        elif model == \"component\":\n            # Train classifier for the component of a bug.\n            self.train_component()\n        elif model == \"regression\":\n            # Train classifier for regression-vs-nonregression.\n            self.train_regression()\n        elif model == \"tracking\":\n            # Train classifier for tracking bugs.\n            self.train_tracking()\n        else:\n            # We shouldn't be here\n            raise Exception(\"valid_models is likely not up-to-date anymore\")\n\n\ndef main():\n    description = \"Train the models\"\n    parser = argparse.ArgumentParser(description=description)\n\n    parser.add_argument(\"model\", help=\"Which model to train.\")\n\n    args = parser.parse_args()\n\n    retriever = Trainer()\n    retriever.go(args.model)\n", "path": "scripts/trainer.py"}, {"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 lzma\nimport os\nimport shutil\nfrom urllib.request import urlretrieve\n\nimport requests\n\nlogging.basicConfig(level=logging.INFO)\nLOGGER = logging.getLogger()\n\nBASE_URL = \"https://index.taskcluster.net/v1/task/project.releng.services.project.testing.bugbug_train.latest/artifacts/public\"\n\nMODELS_NAMES = (\"defectenhancementtask\", \"component\", \"regression\")\nMODELS_DIR = os.path.join(os.path.dirname(__file__), \"models\")\n\n\ndef retrieve_model(name):\n    os.makedirs(MODELS_DIR, exist_ok=True)\n\n    file_name = f\"{name}model\"\n    file_path = os.path.join(MODELS_DIR, file_name)\n\n    model_url = f\"{BASE_URL}/{file_name}.xz\"\n    LOGGER.info(f\"Checking ETAG of {model_url}\")\n    r = requests.head(model_url, allow_redirects=True)\n    r.raise_for_status()\n    new_etag = r.headers[\"ETag\"]\n\n    try:\n        with open(f\"{file_path}.etag\", \"r\") as f:\n            old_etag = f.read()\n    except IOError:\n        old_etag = None\n\n    if old_etag != new_etag:\n        LOGGER.info(f\"Downloading the model from {model_url}\")\n        urlretrieve(model_url, f\"{file_path}.xz\")\n\n        with lzma.open(f\"{file_path}.xz\", \"rb\") as input_f:\n            with open(file_path, \"wb\") as output_f:\n                shutil.copyfileobj(input_f, output_f)\n                LOGGER.info(f\"Written model in {file_path}\")\n\n        with open(f\"{file_path}.etag\", \"w\") as f:\n            f.write(new_etag)\n    else:\n        LOGGER.info(f\"ETAG for {model_url} is ok\")\n\n    return file_path\n\n\ndef preload_models():\n    for model_name in MODELS_NAMES:\n        retrieve_model(model_name)\n\n\nif __name__ == \"__main__\":\n    preload_models()\n", "path": "http_service/download_models.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n\nimport argparse\nimport lzma\nimport os\nimport shutil\nfrom logging import INFO, basicConfig, getLogger\nfrom urllib.request import urlretrieve\n\nfrom bugbug.models.component import ComponentModel\nfrom bugbug.models.defect_enhancement_task import DefectEnhancementTaskModel\nfrom bugbug.models.regression import RegressionModel\nfrom bugbug.models.tracking import TrackingModel\n\nbasicConfig(level=INFO)\nlogger = getLogger(__name__)\n\nBASE_URL = \"https://index.taskcluster.net/v1/task/project.relman.bugbug.data_{}.latest/artifacts/public\"\n\n\nclass Trainer(object):\n    def decompress_file(self, path):\n        with lzma.open(f\"{path}.xz\", \"rb\") as input_f:\n            with open(path, \"wb\") as output_f:\n                shutil.copyfileobj(input_f, output_f)\n\n    def compress_file(self, path):\n        with open(path, \"rb\") as input_f:\n            with lzma.open(f\"{path}.xz\", \"wb\") as output_f:\n                shutil.copyfileobj(input_f, output_f)\n\n    def train_defect_enhancement_task(self):\n        logger.info(\"Training *defect vs enhancement vs task* model\")\n        model = DefectEnhancementTaskModel()\n        model.train()\n        self.compress_file(\"defectenhancementtaskmodel\")\n\n    def train_component(self):\n        logger.info(\"Training *component* model\")\n        model = ComponentModel()\n        model.train()\n        self.compress_file(\"componentmodel\")\n\n    def train_regression(self):\n        logger.info(\"Training *regression vs non-regression* model\")\n        model = RegressionModel()\n        model.train()\n        self.compress_file(\"regressionmodel\")\n\n    def train_tracking(self):\n        logger.info(\"Training *tracking* model\")\n        model = TrackingModel()\n        model.train()\n        self.compress_file(\"trackingmodel\")\n\n    def go(self, model):\n        # TODO: Stop hard-coding them\n        valid_models = [\"defect\", \"component\", \"regression\", \"tracking\"]\n\n        if model not in valid_models:\n            exception = (\n                f\"Invalid model {model!r} name, use one of {valid_models!r} instead\"\n            )\n            raise ValueError(exception)\n\n        # Download datasets that were built by bugbug_data.\n        os.makedirs(\"data\", exist_ok=True)\n\n        # Bugs.json\n        logger.info(\"Downloading bugs database\")\n        bugs_url = BASE_URL.format(\"bugs\")\n        urlretrieve(f\"{bugs_url}/bugs.json.xz\", \"data/bugs.json.xz\")\n        logger.info(\"Decompressing bugs database\")\n        self.decompress_file(\"data/bugs.json\")\n\n        # Commits.json\n        logger.info(\"Downloading commits database\")\n        commits_url = BASE_URL.format(\"commits\")\n        urlretrieve(f\"{commits_url}/commits.json.xz\", \"data/commits.json.xz\")\n        logger.info(\"Decompressing commits database\")\n        self.decompress_file(\"data/commits.json\")\n\n        if model == \"defect\":\n            # Train classifier for defect-vs-enhancement-vs-task.\n            self.train_defect_enhancement_task()\n        elif model == \"component\":\n            # Train classifier for the component of a bug.\n            self.train_component()\n        elif model == \"regression\":\n            # Train classifier for regression-vs-nonregression.\n            self.train_regression()\n        elif model == \"tracking\":\n            # Train classifier for tracking bugs.\n            self.train_tracking()\n        else:\n            # We shouldn't be here\n            raise Exception(\"valid_models is likely not up-to-date anymore\")\n\n\ndef main():\n    description = \"Train the models\"\n    parser = argparse.ArgumentParser(description=description)\n\n    parser.add_argument(\"model\", help=\"Which model to train.\")\n\n    args = parser.parse_args()\n\n    retriever = Trainer()\n    retriever.go(args.model)\n", "path": "scripts/trainer.py"}, {"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 lzma\nimport os\nimport shutil\nfrom urllib.request import urlretrieve\n\nimport requests\n\nlogging.basicConfig(level=logging.INFO)\nLOGGER = logging.getLogger()\n\nBASE_URL = \"https://index.taskcluster.net/v1/task/project.relman.bugbug.train_{}.latest/artifacts/public\"\n\nMODELS_NAMES = (\"defectenhancementtask\", \"component\", \"regression\")\nMODELS_DIR = os.path.join(os.path.dirname(__file__), \"models\")\n\n\ndef retrieve_model(name):\n    os.makedirs(MODELS_DIR, exist_ok=True)\n\n    file_name = f\"{name}model\"\n    file_path = os.path.join(MODELS_DIR, file_name)\n\n    base_model_url = BASE_URL.format(name)\n    model_url = f\"{base_model_url}/{file_name}.xz\"\n    LOGGER.info(f\"Checking ETAG of {model_url}\")\n    r = requests.head(model_url, allow_redirects=True)\n    r.raise_for_status()\n    new_etag = r.headers[\"ETag\"]\n\n    try:\n        with open(f\"{file_path}.etag\", \"r\") as f:\n            old_etag = f.read()\n    except IOError:\n        old_etag = None\n\n    if old_etag != new_etag:\n        LOGGER.info(f\"Downloading the model from {model_url}\")\n        urlretrieve(model_url, f\"{file_path}.xz\")\n\n        with lzma.open(f\"{file_path}.xz\", \"rb\") as input_f:\n            with open(file_path, \"wb\") as output_f:\n                shutil.copyfileobj(input_f, output_f)\n                LOGGER.info(f\"Written model in {file_path}\")\n\n        with open(f\"{file_path}.etag\", \"w\") as f:\n            f.write(new_etag)\n    else:\n        LOGGER.info(f\"ETAG for {model_url} is ok\")\n\n    return file_path\n\n\ndef preload_models():\n    for model_name in MODELS_NAMES:\n        retrieve_model(model_name)\n\n\nif __name__ == \"__main__\":\n    preload_models()\n", "path": "http_service/download_models.py"}]}