Skip to content

Commit 9016977

Browse files
committed
Move at-dagdebug into utils
1 parent 3582b42 commit 9016977

File tree

3 files changed

+34
-34
lines changed

3 files changed

+34
-34
lines changed

src/Dagger.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ include("options.jl")
2525
include("processor.jl")
2626
include("scopes.jl")
2727
include("thunk.jl")
28+
include("utils/dagdebug.jl")
2829
include("chunks.jl")
2930

3031
# Task scheduling

src/sch/util.jl

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,3 @@
1-
const DAGDEBUG_CATEGORIES = Symbol[:global, :submit, :schedule, :scope,
2-
:take, :execute, :move, :processor]
3-
macro dagdebug(thunk, category, msg, args...)
4-
cat_sym = category.value
5-
@gensym id
6-
debug_ex_id = :(@debug "[$($id)] ($($(repr(cat_sym)))) $($msg)" _module=Dagger _file=$(string(__source__.file)) _line=$(__source__.line))
7-
append!(debug_ex_id.args, args)
8-
debug_ex_noid = :(@debug "($($(repr(cat_sym)))) $($msg)" _module=Dagger _file=$(string(__source__.file)) _line=$(__source__.line))
9-
append!(debug_ex_noid.args, args)
10-
esc(quote
11-
let $id = -1
12-
if $thunk isa Integer
13-
$id = Int($thunk)
14-
elseif $thunk isa Thunk
15-
$id = $thunk.id
16-
elseif $thunk === nothing
17-
$id = 0
18-
else
19-
@warn "Unsupported thunk argument to @dagdebug: $(typeof($thunk))"
20-
$id = -1
21-
end
22-
if $id > 0
23-
if $(QuoteNode(cat_sym)) in $DAGDEBUG_CATEGORIES
24-
$debug_ex_id
25-
end
26-
elseif $id == 0
27-
if $(QuoteNode(cat_sym)) in $DAGDEBUG_CATEGORIES
28-
$debug_ex_noid
29-
end
30-
end
31-
end
32-
end)
33-
end
34-
351
"""
362
unwrap_nested_exception(err::Exception) -> Bool
373

src/utils/dagdebug.jl

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
const DAGDEBUG_CATEGORIES = Symbol[:global, :submit, :schedule, :scope,
2+
:take, :execute, :move, :processor]
3+
macro dagdebug(thunk, category, msg, args...)
4+
cat_sym = category.value
5+
@gensym id
6+
debug_ex_id = :(@debug "[$($id)] ($($(repr(cat_sym)))) $($msg)" _module=Dagger _file=$(string(__source__.file)) _line=$(__source__.line))
7+
append!(debug_ex_id.args, args)
8+
debug_ex_noid = :(@debug "($($(repr(cat_sym)))) $($msg)" _module=Dagger _file=$(string(__source__.file)) _line=$(__source__.line))
9+
append!(debug_ex_noid.args, args)
10+
esc(quote
11+
let $id = -1
12+
if $thunk isa Integer
13+
$id = Int($thunk)
14+
elseif $thunk isa Thunk
15+
$id = $thunk.id
16+
elseif $thunk === nothing
17+
$id = 0
18+
else
19+
@warn "Unsupported thunk argument to @dagdebug: $(typeof($thunk))"
20+
$id = -1
21+
end
22+
if $id > 0
23+
if $(QuoteNode(cat_sym)) in $DAGDEBUG_CATEGORIES
24+
$debug_ex_id
25+
end
26+
elseif $id == 0
27+
if $(QuoteNode(cat_sym)) in $DAGDEBUG_CATEGORIES
28+
$debug_ex_noid
29+
end
30+
end
31+
end
32+
end)
33+
end

0 commit comments

Comments
 (0)