Skip to content

Commit 9024161

Browse files
committed
Add pipeline information to printer
1 parent 2487993 commit 9024161

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

R/Graph.R

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,14 @@ Graph = R6Class("Graph",
423423
with_options(list(datatable.prettyprint.char = collimit), {
424424
print(lines, row.names = FALSE)
425425
})
426+
427+
if(all(!duplicated(self$edges[["src_id"]]))) {
428+
ppunit = paste0(self$ids(), collapse = " -> ")
429+
} else {
430+
ppunit = "<SUPPRESSED>"
431+
}
432+
pp = paste0(c("<INPUT>", ppunit, "<OUTPUT>"), collapse = " -> ")
433+
cli_h3(sprintf("Pipeline: %s", pp))
426434
} else {
427435
cat("Empty Graph.\n")
428436
}

R/GraphLearner.R

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,17 @@ GraphLearner = R6Class("GraphLearner", inherit = Learner,
312312
},
313313
plot = function(html = FALSE, horizontal = FALSE, ...) {
314314
private$.graph$plot(html = html, horizontal = horizontal, ...)
315+
},
316+
print = function() {
317+
super$print(self)
318+
319+
if(all(!duplicated(self$edges[["src_id"]]))) {
320+
ppunit = paste0(self$ids(), collapse = " -> ")
321+
} else {
322+
ppunit = "<SUPPRESSED>"
323+
}
324+
pp = paste0(c("<INPUT>", ppunit, "<OUTPUT>"), collapse = " -> ")
325+
cli_h3(sprintf("Pipeline: %s", pp))
315326
}
316327
),
317328
active = list(

0 commit comments

Comments
 (0)