Bug 1890689 accumulate input in LargerReceiverBlockSizeThanDesiredBuffering GTest...
[gecko.git] / taskcluster / scripts / are_dependencies_completed.py
blob79a0bb30c3cda34175b849c42e7dae10bf3c19dd
1 #!/usr/bin/env python3
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 import argparse
8 import os
10 import taskcluster
12 queue = taskcluster.Queue(
14 "rootUrl": os.environ.get("TASKCLUSTER_PROXY_URL", "https://taskcluster.net"),
19 def check_all_dependencies_are_completed(current_task_id):
20 print(f"Fetching task definition of {current_task_id}...")
21 task = queue.task(current_task_id)
22 dependencies_task_ids = task["dependencies"]
24 print(f"Fetching status of {len(dependencies_task_ids)} dependencies...")
25 # TODO Make this dict-comprehension async once we go Python 3
26 state_per_task_ids = {
27 task_id: queue.status(task_id)["status"]["state"]
28 for task_id in dependencies_task_ids
30 print("Statuses fetched.")
31 non_completed_tasks = {
32 task_id: state
33 for task_id, state in state_per_task_ids.items()
34 if state != "completed"
37 if non_completed_tasks:
38 raise ValueError(f"Some tasks are not completed: {non_completed_tasks}")
41 def main():
42 parser = argparse.ArgumentParser(
43 description='Errors out if one of the DEPENDENCY_TASK_ID does not have the Taskcluster status "completed"'
46 parser.add_argument(
47 "current_task_id",
48 metavar="CURRENT_TASK_ID",
49 help="The task ID of the current running task",
52 result = parser.parse_args()
53 check_all_dependencies_are_completed(result.current_task_id)
54 print("All dependencies are completed. Reporting a green task!")
55 exit(0)
58 if __name__ == "__main__":
59 main()