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/.
8 from taskgraph
.util
.taskcluster
import get_task_definition
, purge_cache
10 from .registry
import register_callback_action
12 logger
= logging
.getLogger(__name__
)
15 @register_callback_action(
16 title
="Purge Worker Caches",
20 "Purge any caches associated with this task "
21 "across all workers of the same workertype as the task."
24 context
=[{"worker-implementation": "docker-worker"}],
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"]:
31 task
["provisionerId"], task
["workerType"], cache
, use_proxy
=True
34 logger
.info("Task has no caches. Will not clear anything!")