# Error of using Dagger, according to the manual

**URL:** <https://discourse.julialang.org/t/error-of-using-dagger-according-to-the-manual/27011>\
**Category:** Julia at Scale\
**Created:** [July 31, 2019, 1:31am UTC](https://discourse.julialang.org/t/error-of-using-dagger-according-to-the-manual/27011 "2019-07-31T01:31:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![zhangliye](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zhangliye/32/3208_2.png) [@zhangliye](https://discourse.julialang.org/u/zhangliye)\
**Post date:** [July 31, 2019, 1:31am UTC](https://discourse.julialang.org/t/error-of-using-dagger-according-to-the-manual/27011/1 "2019-07-31T01:31:49Z")

</div>

I tried Dagger according to the manual and got some errors.

```julia
using Dagger
using Distributed

addprocs(3)
@everywhere function f1(v1::Float64, v2::Float64)
    r = 0.
    for i in 1:10^7
        r += sin(v1) + sin(v2)
    end
    return r
end
@everywhere function f2(v::Float64)
    r = 0.
    for i in 1:10^7
        r += cos(v)
    end
    return r
end
T1 = delayed(f1; v1=1., v2=2.)
T2 = delayed(f2; v=1.)(T1) # error here
T3 = delayed(f1; v1=3., v2=4.)
collect(T1) # error here 

```

MethodError: no method matching Thunk(::typeof(f2), ::getfield(Dagger, Symbol(“##36#37”)){Base.Iterators.Pairs{Symbol,Float64,Tuple{Symbol,Symbol},NamedTuple{(:v1, :v2),Tuple{Float64,Float64}}},typeof(f1)}; v=1.0)  
Closest candidates are:  
Thunk(::Any, ::Any…; id, get\_result, meta, persist, cache, cache\_ref, affinity) at /Users/zhangliye/.julia/packages/Dagger/sdZXi/src/thunk.jl:29 got unsupported keyword argument “v”

Stacktrace:  
[1] kwerr(::NamedTuple{(:v,),Tuple{Float64}}, ::Type, ::Function, ::Function) at ./error.jl:125  
[2] (::getfield(Core, Symbol(“#kw#Type”)))(::NamedTuple{(:v,),Tuple{Float64}}, ::Type{Thunk}, ::Function, ::Function) at ./none:0  
[3] (::getfield(Dagger, Symbol(“##36#37”)){Base.Iterators.Pairs{Symbol,Float64,Tuple{Symbol},NamedTuple{(:v,),Tuple{Float64}}},typeof(f2)})(::Function) at /Users/zhangliye/.julia/packages/Dagger/sdZXi/src/thunk.jl:71  
[4] top-level scope at In[32]:17

```julia
type or paste code here

```

Julia version information,

```julia
Julia Version 1.1.0
Commit 80516ca202 (2019-01-21 21:24 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin14.5.0)
  CPU: Intel(R) Core(TM) i5-8500 CPU @ 3.00GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, skylake)

```

Dagger document: [Dagger example](https://github.com/JuliaParallel/Dagger.jl)

---

<div class="post-metadata">

**Author:** ![jpsamaroo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jpsamaroo/32/46804_2.png) [@jpsamaroo](https://discourse.julialang.org/u/jpsamaroo)\
**Post date:** [August 1, 2019, 12:24am UTC](https://discourse.julialang.org/t/error-of-using-dagger-according-to-the-manual/27011/2 "2019-08-01T00:24:39Z")

</div>

You’re calling `delayed` incorrectly. For your first invocation, it would be `delayed(f1)(1., 2.)`. The kwargs to `delayed` are only used to communicate information to the scheduler, and the call to `delayed(f1)` returns a function which must then be called with the appropriate arguments to the function it wraps.

@Alessio_Bellisomi is working on a documentation PR to make these points more clear in the README.
