Skip to content

Commit f7ae327

Browse files
committed
Rename EagerThunk to DTask
1 parent 0f1db98 commit f7ae327

21 files changed

+95
-92
lines changed

docs/src/api-dagger/types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Pages = ["types.md"]
1010
## Task Types
1111
```@docs
1212
Thunk
13-
EagerThunk
13+
DTask
1414
```
1515

1616
## Task Options Types

docs/src/darray.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,8 @@ Now, `DZ` will contain the result of computing `(DX .+ DX) .* 3`.
353353
```
354354
julia> Dagger.chunks(DZ)
355355
2×2 Matrix{Any}:
356-
EagerThunk (finished) EagerThunk (finished)
357-
EagerThunk (finished) EagerThunk (finished)
356+
DTask (finished) DTask (finished)
357+
DTask (finished) DTask (finished)
358358
359359
julia> Dagger.chunks(fetch(DZ))
360360
2×2 Matrix{Union{Thunk, Dagger.Chunk}}:
@@ -363,7 +363,7 @@ julia> Dagger.chunks(fetch(DZ))
363363
```
364364

365365
Here we can see the `DArray`'s internal representation of the partitions, which
366-
are stored as either `EagerThunk` objects (representing an ongoing or completed
366+
are stored as either `DTask` objects (representing an ongoing or completed
367367
computation) or `Chunk` objects (which reference data which exist locally or on
368368
other Julia workers). Of course, one doesn't typically need to worry about
369369
these internal details unless implementing low-level operations on `DArray`s.

docs/src/task-spawning.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ or `spawn` if it's more convenient:
1212

1313
`Dagger.spawn(f, Dagger.Options(options), args...; kwargs...)`
1414

15-
When called, it creates an [`EagerThunk`](@ref) (also known as a "thunk" or
15+
When called, it creates an [`DTask`](@ref) (also known as a "thunk" or
1616
"task") object representing a call to function `f` with the arguments `args` and
1717
keyword arguments `kwargs`. If it is called with other thunks as args/kwargs,
1818
such as in `Dagger.@spawn f(Dagger.@spawn g())`, then, in this example, the
@@ -22,9 +22,9 @@ waits on `g()` to complete before executing.
2222

2323
An important observation to make is that, for each argument to
2424
`@spawn`/`spawn`, if the argument is the result of another `@spawn`/`spawn`
25-
call (thus it's an [`EagerThunk`](@ref)), the argument will be computed first, and then
25+
call (thus it's an [`DTask`](@ref)), the argument will be computed first, and then
2626
its result will be passed into the function receiving the argument. If the
27-
argument is *not* an [`EagerThunk`](@ref) (instead, some other type of Julia object),
27+
argument is *not* an [`DTask`](@ref) (instead, some other type of Julia object),
2828
it'll be passed as-is to the function `f` (with some exceptions).
2929

3030
## Options
@@ -75,7 +75,7 @@ The final result (from `fetch(s)`) is the obvious consequence of the operation:
7575

7676
Dagger's `@spawn` macro works similarly to `@async` and `Threads.@spawn`: when
7777
called, it wraps the function call specified by the user in an
78-
[`EagerThunk`](@ref) object, and immediately places it onto a running scheduler,
78+
[`DTask`](@ref) object, and immediately places it onto a running scheduler,
7979
to be executed once its dependencies are fulfilled.
8080

8181
```julia
@@ -114,7 +114,7 @@ One can also safely call `@spawn` from another worker (not ID 1), and it will be
114114

115115
```
116116
x = fetch(Distributed.@spawnat 2 Dagger.@spawn 1+2) # fetches the result of `@spawnat`
117-
x::EagerThunk
117+
x::DTask
118118
@assert fetch(x) == 3 # fetch the result of `@spawn`
119119
```
120120

docs/src/use-cases/parallel-nested-loops.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,12 @@ end
7272

7373
In this code we have job interdependence. Firstly, we are calculating the
7474
standard deviation `σ` and than we are using that value in the function `f`.
75-
Since `Dagger.@spawn` yields an `EagerThunk` rather than actual values, we need
75+
Since `Dagger.@spawn` yields an `DTask` rather than actual values, we need
7676
to use the `fetch` function to obtain those values. In this example, the value
7777
fetching is perfomed once all computations are completed (note that `@sync`
7878
preceding the loop forces the loop to wait for all jobs to complete). Also,
7979
note that contrary to the previous example, we do not need to implement locking
80-
as we are just pushing the `EagerThunk` results of `Dagger.@spawn` serially
80+
as we are just pushing the `DTask` results of `Dagger.@spawn` serially
8181
into the DataFrame (which is fast since `Dagger.@spawn` doesn't block).
8282

8383
The above use case scenario has been tested by running `julia -t 8` (or with

ext/GraphVizExt.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ else
77
end
88

99
import Dagger
10-
import Dagger: EagerThunk, Chunk, Processor
10+
import Dagger: DTask, Chunk, Processor
1111
import Dagger.TimespanLogging: Timespan
1212
import Graphs: SimpleDiGraph, add_edge!, add_vertex!, inneighbors, outneighbors, vertices, is_directed, edges, nv, src, dst
1313

ext/PlotsExt.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ else
99
end
1010

1111
import Dagger
12-
import Dagger: EagerThunk, Chunk, Processor
12+
import Dagger: DTask, Chunk, Processor
1313
import Dagger.TimespanLogging: Timespan
1414

1515
function logs_to_df(logs::Dict)

src/Dagger.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ include("utils/processors.jl")
4545
include("task-tls.jl")
4646
include("scopes.jl")
4747
include("utils/scopes.jl")
48-
include("eager_thunk.jl")
48+
include("dtask.jl")
4949
include("queue.jl")
5050
include("thunk.jl")
5151
include("submission.jl")

src/array/matrix.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function (+)(a::ArrayDomain, b::ArrayDomain)
6666
end
6767

6868
struct BinaryComputeOp{F} end
69-
BinaryComputeOp{F}(x::Union{Chunk,EagerThunk}, y::Union{Chunk,EagerThunk}) where F = @spawn F(x, y)
69+
BinaryComputeOp{F}(x::Union{Chunk,DTask}, y::Union{Chunk,DTask}) where F = @spawn F(x, y)
7070
BinaryComputeOp{F}(x, y) where F = F(x, y)
7171

7272
const AddComputeOp = BinaryComputeOp{+}

src/array/sort.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ function dsort_chunks(cs, nchunks=length(cs), nsamples=2000;
305305
end
306306

307307
function propagate_affinity!(c, aff)
308-
if !isa(c, EagerThunk)
308+
if !isa(c, DTask)
309309
return
310310
end
311311
if c.affinity !== nothing

src/chunks.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ function shard(@nospecialize(f); procs=nothing, workers=nothing, per_thread=fals
199199
end
200200
end
201201
isempty(procs) && throw(ArgumentError("Cannot create empty Shard"))
202-
shard_running_dict = Dict{Processor,EagerThunk}()
202+
shard_running_dict = Dict{Processor,DTask}()
203203
for proc in procs
204204
scope = proc isa OSProc ? ProcessScope(proc) : ExactScope(proc)
205205
thunk = Dagger.@spawn scope=scope _mutable_inner(f, proc, scope)

0 commit comments

Comments
 (0)