Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/taskgraph/util/taskcluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ def _get_deps(task_ids, use_proxy):
continue
raise e

upstream_tasks[task_def["metadata"]["name"]] = task_id
upstream_tasks[task_id] = task_def["metadata"]["name"]

upstream_tasks.update(_get_deps(tuple(task_def["dependencies"]), use_proxy))

Expand All @@ -479,14 +479,14 @@ def _get_deps(task_ids, use_proxy):
def get_ancestors(
task_ids: Union[List[str], str], use_proxy: bool = False
) -> Dict[str, str]:
"""Gets the ancestor tasks of the given task_ids as a dictionary of label -> taskid.
"""Gets the ancestor tasks of the given task_ids as a dictionary of taskid -> label.

Args:
task_ids (str or [str]): A single task id or a list of task ids to find the ancestors of.
use_proxy (bool): See get_root_url.

Returns:
dict: A dict whose keys are task labels and values are task ids.
dict: A dict whose keys are task ids and values are task labels.
"""
upstream_tasks: Dict[str, str] = {}

Expand Down
22 changes: 11 additions & 11 deletions test/test_util_taskcluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,10 +448,10 @@ def test_get_ancestors(responses, root_url):

got = tc.get_ancestors(["bbb", "fff"])
expected = {
"task-aaa": "aaa",
"task-ccc": "ccc",
"task-ddd": "ddd",
"task-eee": "eee",
"aaa": "task-aaa",
"ccc": "task-ccc",
"ddd": "task-ddd",
"eee": "task-eee",
}
assert got == expected, f"got: {got}, expected: {expected}"

Expand Down Expand Up @@ -505,8 +505,8 @@ def test_get_ancestors_404(responses, root_url):

got = tc.get_ancestors(["bbb", "fff"])
expected = {
"task-ddd": "ddd",
"task-eee": "eee",
"ddd": "task-ddd",
"eee": "task-eee",
}
assert got == expected, f"got: {got}, expected: {expected}"

Expand Down Expand Up @@ -578,10 +578,10 @@ def test_get_ancestors_string(responses, root_url):

got = tc.get_ancestors("fff")
expected = {
"task-aaa": "aaa",
"task-bbb": "bbb",
"task-ccc": "ccc",
"task-ddd": "ddd",
"task-eee": "eee",
"aaa": "task-aaa",
"bbb": "task-bbb",
"ccc": "task-ccc",
"ddd": "task-ddd",
"eee": "task-eee",
}
assert got == expected, f"got: {got}, expected: {expected}"
Loading