Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't set "debug" mode on query pipeline #2656

Closed
fsanna13 opened this issue Jun 13, 2022 · 3 comments · Fixed by #2720
Closed

Can't set "debug" mode on query pipeline #2656

fsanna13 opened this issue Jun 13, 2022 · 3 comments · Fixed by #2720
Labels
topic:rest_api type:bug Something isn't working

Comments

@fsanna13
Copy link

I'm trying to run a query pipeline using a YAML file that uses the TextToSparqlRetriever component to make queries on a GraphDB instance I'm running locally. I also want to set the "debug" parameter to true so that I can have some more informations about an error I'm getting (which I'm sure I can solve myself, must be some error in my custom components code).

The application starts correctly, but when I run the query pipeline by sending a ReST request using this payload (like this documentation page says):

{
    "query": "Find all datasets covering the theme energy",
    "params": {
        "debug": true
    }
}

I receive an error saying that

AttributeError: 'bool' object has no attribute 'keys'

Now, browsing the files I noticed that the error comes from this lines of code in the search controller:

 # format targeted node filters (e.g. "params": {"Retriever": {"filters": {"value"}}})
for key in params.keys():
    if "filters" in params[key].keys():
        params[key]["filters"] = _format_filters(params[key]["filters"])

This means that the parameters will always have to be an object / dictionary to be correctly parsed, or it will obviously give the error above of no keys found. Isn't it an error? Or am I using the pipeline wrong?

@masci
Copy link
Contributor

masci commented Jun 14, 2022

@fsanna13 that's definitely a bug, thanks for reporting and good job finding the root cause!

Would you like to go through the last mile and open a PR to fix it? :)

@julian-risch
Copy link
Member

Hi @fsanna13 great to see that you would like to use the Text2SPARQLRetriever in a pipeline. I think we haven't done that so far so there could be some unexpected challenges indeed. Keep us posted and we will be happy to help. Regarding params, a few lines in the code before it is accessed with params.keys(), it is also initialized if it is not set already:

params = request.params or {}

That way we make sure it is a dictionary if it is not already set. The question is why params is a boolean in your case? 🤔

@masci
Copy link
Contributor

masci commented Jun 23, 2022

@julian-risch I think we still have a bug, it's params["debug"] being boolean, which should be ok - can you have a look at this PR? #2720

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic:rest_api type:bug Something isn't working
Projects
None yet
3 participants