tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

purge_caches.py (1064B)


      1 # This Source Code Form is subject to the terms of the Mozilla Public
      2 # License, v. 2.0. If a copy of the MPL was not distributed with this
      3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
      4 
      5 
      6 import logging
      7 
      8 from taskgraph.util.taskcluster import get_task_definition, purge_cache
      9 
     10 from .registry import register_callback_action
     11 
     12 logger = logging.getLogger(__name__)
     13 
     14 
     15 @register_callback_action(
     16    title="Purge Worker Caches",
     17    name="purge-cache",
     18    symbol="purge-cache",
     19    description=(
     20        "Purge any caches associated with this task "
     21        "across all workers of the same workertype as the task."
     22    ),
     23    order=450,
     24    context=[{"worker-implementation": "docker-worker"}],
     25 )
     26 def purge_caches_action(parameters, graph_config, input, task_group_id, task_id):
     27    task = get_task_definition(task_id)
     28    if task["payload"].get("cache"):
     29        for cache in task["payload"]["cache"]:
     30            purge_cache(task["provisionerId"], task["workerType"], cache)
     31    else:
     32        logger.info("Task has no caches. Will not clear anything!")