harris-chris / Jot.jl

Streamlines the creation and management of AWS Lambda functions written in Julia
MIT License
41 stars 6 forks source link

no method matching get_responder_package_name(::Nothing) #33

Closed sklink closed 1 year ago

sklink commented 1 year ago

I've generated a package following the instructions on Julia and am running an error when attempting to call get_responder using a package. I think it may have to do with missing information in my Project.toml as the get_responder_from_package_spec method seems to be looking for pkg.repo.source

Here's the error:

ERROR: LoadError: MethodError: no method matching get_responder_package_name(::Nothing)
Closest candidates are:
  get_responder_package_name(::String) at ~/.julia/packages/Jot/jzEEH/src/Responder.jl:256
Stacktrace:
 [1] get_responder_from_package_spec(pkg::Pkg.Types.PackageSpec, response_function::Symbol, ::Type{Dict}; registry_urls::Vector{String})
   @ Jot ~/.julia/packages/Jot/jzEEH/src/Responder.jl:56
 [2] get_responder_from_local_package(path::String, response_function::Symbol, ::Type{Dict}; registry_urls::Vector{String})
   @ Jot ~/.julia/packages/Jot/jzEEH/src/Responder.jl:45
 [3] get_responder(path_url::String, response_function::Symbol, response_function_param_type::Type{Dict}; dependencies::Vector{String}, registry_urls::Vector{String})
   @ Jot ~/.julia/packages/Jot/jzEEH/src/Responder.jl:182
 [4] get_responder(path_url::String, response_function::Symbol, response_function_param_type::Type{Dict})
   @ Jot ~/.julia/packages/Jot/jzEEH/src/Responder.jl:166

This is my Project.toml:

name = "HelloWorld"
uuid = "e2d255a6-a9f0-4867-97a6-ac6706df2382"
authors = ["Matt <contact@me.com>"]
version = "0.1.0"

[deps]
HiGHS = "87dc4568-4c63-4d18-b0c0-bb2238e4078b"
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"

and my src/HelloWorld.jl:

module HelloWorld

using JuMP
using HiGHS #open source

increment_vector(v::Vector{Int}) = map(x -> x + 1, v)

end # module HelloWorld

Here's the script that's running the get_responder:

import Pkg;
Pkg.add(url="https://github.com/harris-chris/Jot.jl#main");

using Jot

Pkg.activate("./src/HelloWorld")

responder = get_responder("./src/HelloWorld", :increment_vector, Vector{Int})
local_image = create_local_image(responder; image_suffix="increment_vector")
remote_image = push_to_ecr!(local_image)
lambda_function = create_lambda_function(remote_image)
harris-chris commented 1 year ago

Hmm, I'm looking at this on my phone, but what you have looks fine - let me try to recreate it when I'm at my PC, hopefully in the next 24 hours.

On Wed, 26 Oct 2022, 08:15 Matt Doak, @.***> wrote:

I've generated a package following the instructions on Julia https://pkgdocs.julialang.org/v1/creating-packages/ and am running an error when attempting to call get_responder using a package. I think it may have to do with missing information in my Project.toml as the get_responder_from_package_spec method seems to be looking for pkg.repo.source

Here's the error:

ERROR: LoadError: MethodError: no method matching get_responder_package_name(::Nothing) Closest candidates are: get_responder_package_name(::String) at ~/.julia/packages/Jot/jzEEH/src/Responder.jl:256 Stacktrace: [1] get_responder_from_package_spec(pkg::Pkg.Types.PackageSpec, response_function::Symbol, ::Type{Dict}; registry_urls::Vector{String}) @ Jot ~/.julia/packages/Jot/jzEEH/src/Responder.jl:56 [2] get_responder_from_local_package(path::String, response_function::Symbol, ::Type{Dict}; registry_urls::Vector{String}) @ Jot ~/.julia/packages/Jot/jzEEH/src/Responder.jl:45 [3] get_responder(path_url::String, response_function::Symbol, response_function_param_type::Type{Dict}; dependencies::Vector{String}, registry_urls::Vector{String}) @ Jot ~/.julia/packages/Jot/jzEEH/src/Responder.jl:182 [4] get_responder(path_url::String, response_function::Symbol, response_function_param_type::Type{Dict}) @ Jot ~/.julia/packages/Jot/jzEEH/src/Responder.jl:166

This is my Project.toml:

name = "HelloWorld" uuid = "e2d255a6-a9f0-4867-97a6-ac6706df2382" authors = ["Matt @.***>"] version = "0.1.0"

[deps] HiGHS = "87dc4568-4c63-4d18-b0c0-bb2238e4078b" JuMP = "4076af6c-e467-56ae-b986-b466b2749572"

and my src/HelloWorld.jl:

module HelloWorld

using JuMP using HiGHS #open source

increment_vector(v::Vector{Int}) = map(x -> x + 1, v)

end # module HelloWorld

Here's the script that's running the get_responder:

import Pkg; Pkg.add(url="https://github.com/harris-chris/Jot.jl#main");

using Jot

Pkg.activate("./src/HelloWorld")

responder = get_responder("./src/HelloWorld", :increment_vector, Vector{Int}) local_image = create_local_image(responder; image_suffix="increment_vector") remote_image = push_to_ecr!(local_image) lambda_function = create_lambda_function(remote_image)

— Reply to this email directly, view it on GitHub https://github.com/harris-chris/Jot.jl/issues/33, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALDMVSGNNTX5GIG7N2UR6UTWFBS2HANCNFSM6AAAAAARON5CSU . You are receiving this because you are subscribed to this thread.Message ID: @.***>

harris-chris commented 1 year ago

OK, thanks for bringing this up, it was an issue with Jot instead of your script. I was relying on some Julia internals which appear to have at some point changed. I've edited your script slightly to this and it now runs for me. Note that you need to Pkg.activate the location of the Project.toml, rather than the actual Julia script:

import Pkg
Pkg.add(url="https://github.com/harris-chris/Jot.jl#main")
using Jot

Pkg.activate("./")
using HelloWorld

responder = get_responder(HelloWorld, :increment_vector, Vector{Int})
local_image = create_local_image(responder; image_suffix="increment_vector")
remote_image = push_to_ecr!(local_image)
lambda_function = create_lambda_function(remote_image)
sklink commented 1 year ago

That worked, thanks for the help!