Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed visualization of SVG graph for tasks directly dependent on each… #3287

Merged
merged 1 commit into from
May 19, 2024
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
4 changes: 2 additions & 2 deletions luigi/static/visualiser/js/graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ Graph = (function() {
$.each(n.deps, function(i, dep) {
if (nodeIndex[dep]) {
var next_node = nodes[nodeIndex[dep]]
var depth = (selfDependencies ? depth + 1 : classDepths[next_node.name])
placeNodes(next_node, depth);
var next_depth = (selfDependencies ? depth + 1 : classDepths[next_node.name])
placeNodes(next_node, next_depth);
}
});
}
Expand Down
31 changes: 21 additions & 10 deletions luigi/static/visualiser/js/test/graph_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,27 @@ module("graph.js");

test("nodeFromTask", function() {
var task = {
deps: ["B","C"],
taskId: "A",
status: "DONE"
deps: ["B1","C1"],
taskId: "A1",
status: "DONE",
name: "A",
params: {},
priority: 0,
};
var expected = {
taskId: "A",
taskId: "A1",
status: "DONE",
trackingUrl: "#A",
deps: ["B","C"],
depth: -1
trackingUrl: "#A1",
deps: ["B1","C1"],
depth: -1,
name: "A",
params: {},
priority: 0,
};
deepEqual(Graph.testableMethods.nodeFromTask(task), expected);
let graph = {
hashBase: "#"
}
deepEqual(Graph.testableMethods.nodeFromTask.bind(graph)(task), expected);
});

test("uniqueIndexByProperty", function() {
Expand Down Expand Up @@ -70,7 +79,7 @@ test("computeRowsSelfDeps", function () {
var rowSizes = Graph.testableMethods.computeRows(nodes, nodeIndex)
equal(A1.depth, 0)
equal(A2.depth, 1)
equal(rowSizes, [1, 1])
deepEqual(rowSizes, [1, 1])
});

test("computeRowsGrouped", function() {
Expand All @@ -83,6 +92,8 @@ test("computeRowsGrouped", function() {
var D2 = {name: "D", taskId: "D2", deps: [], depth: -1}
var E1 = {name: "E", taskId: "E1", deps: [], depth: -1}
var E2 = {name: "E", taskId: "E2", deps: [], depth: -1}
var nodes = [A0, B0, C1, C2, D0, D1, D2, E1, E2]
var nodeIndex = {"A0": 0, "B0": 1, "C1": 2, "C2": 3, "D0": 4, "D1": 5, "D2": 6, "E1": 7, "E2": 8}
var rowSizes = Graph.testableMethods.computeRows(nodes, nodeIndex)
equal(A0.depth, 0)
equal(B0.depth, 1)
Expand All @@ -93,7 +104,7 @@ test("computeRowsGrouped", function() {
equal(D2.depth, 3)
equal(E1.depth, 4)
equal(E2.depth, 4)
equal(rowSizes, [1, 1, 2, 3, 2])
deepEqual(rowSizes, [1, 1, 2, 3, 2])
});

test("createGraph", function() {
Expand Down
Loading