Skip to content

Commit a804d15

Browse files
committed
test/task-affinity: Fixes for Argument and Options
1 parent b400ca6 commit a804d15

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

test/task-affinity.jl

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@
66
@assert Dagger.Sch.unwrap_nested_exception(err) isa Dagger.Sch.SchedulingException
77
return Dagger.InvalidScope
88
end
9-
get_compute_scope(x::DTask) = Dagger.Sch._find_thunk(x).compute_scope
9+
function get_compute_scope(x::DTask)
10+
thunk = Dagger.Sch._find_thunk(x)
11+
return @something(thunk.options.compute_scope, thunk.options.scope, Dagger.DefaultScope())
12+
end
1013

11-
get_result_scope(x::DTask) = Dagger.Sch._find_thunk(x).result_scope
14+
get_result_scope(x::DTask) =
15+
@something(Dagger.Sch._find_thunk(x).options.result_scope, Dagger.AnyScope())
1216

1317
get_final_result_scope(x::DTask) = @something(fetch_or_invalidscope(x), fetch(x; raw=true).scope)
1418

@@ -18,18 +22,18 @@
1822
return res
1923
end
2024
thunk = Dagger.Sch._find_thunk(x)
21-
compute_scope = thunk.compute_scope
22-
result_scope = thunk.result_scope
23-
f_scope = thunk.f isa Dagger.Chunk ? thunk.f.scope : Dagger.AnyScope()
25+
compute_scope = @something(thunk.options.compute_scope, thunk.options.scope, Dagger.DefaultScope())
26+
result_scope = @something(thunk.options.result_scope, Dagger.AnyScope())
2427
inputs_scopes = Dagger.AbstractScope[]
2528
for input in thunk.inputs
29+
input = Dagger.unwrap_weak_checked(Dagger.value(input))
2630
if input isa Dagger.Chunk
2731
push!(inputs_scopes, input.scope)
2832
else
2933
push!(inputs_scopes, Dagger.AnyScope())
3034
end
3135
end
32-
return Dagger.constrain(compute_scope, result_scope, f_scope, inputs_scopes...)
36+
return Dagger.constrain(compute_scope, result_scope, inputs_scopes...)
3337
end
3438

3539
availprocs = collect(Dagger.all_processors())

0 commit comments

Comments
 (0)