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

error handling - send message from graphql #286

Merged
merged 11 commits into from
Apr 12, 2023
Merged

error handling - send message from graphql #286

merged 11 commits into from
Apr 12, 2023

Conversation

horheynm
Copy link
Member

@horheynm horheynm commented Mar 23, 2023

Before:

(.venv) george@Georges-MacBook-Pro sparsezoo % python3 '/Users/george/neuralmagic/sparsezoo/scratch/graohql.py'
Traceback (most recent call last):
  File "/Users/george/neuralmagic/sparsezoo/scratch/graohql.py", line 15, in <module>
    m = gql.fetch(operation_body=operation_body, fields=fields, arguments=arguments)
  File "/Users/george/neuralmagic/sparsezoo/src/sparsezoo/api/graphql.py", line 46, in fetch
    response_objects = self.make_request(
  File "/Users/george/neuralmagic/sparsezoo/src/sparsezoo/api/graphql.py", line 82, in make_request
    return response_json["data"][query.operation_body]
TypeError: 'NoneType' object is not subscriptable

After:

Traceback (most recent call last):
  File "/Users/george/neuralmagic/sparsezoo/scratch/graohql.py", line 15, in <module>
    m = gql.fetch(operation_body=operation_body, fields=fields, arguments=arguments)
  File "/Users/george/neuralmagic/sparsezoo/src/sparsezoo/api/graphql.py", line 47, in fetch
    response_objects = self.make_request(
  File "/Users/george/neuralmagic/sparsezoo/src/sparsezoo/api/exceptions.py", line 33, in inner_function
    return fn(*args, **kwargs)
  File "/Users/george/neuralmagic/sparsezoo/src/sparsezoo/api/graphql.py", line 81, in make_request
    validate_graphql_response(response=response, query_body=query.query_body)
  File "/Users/george/neuralmagic/sparsezoo/src/sparsezoo/api/exceptions.py", line 46, in validate_graphql_response
    raise InvalidQueryException(f"{response_json['errors']}\n{query_body}")
sparsezoo.api.exceptions.InvalidQueryException: [{'message': "Cannot query field 'blah' on type 'Query'.", 'locations': [{'line': 3, 'column': 9}]}]

    {
        blah (architecture: "bert",)
            {
               benchmarkResults { batchSize deviceInfo numCores recordedUnits recordedValue } 
            }
    }

@horheynm horheynm requested review from tdg5 and derekk-nm March 23, 2023 17:22
Copy link

@dfneuralmagic dfneuralmagic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@horheynm horheynm merged commit 5d68384 into main Apr 12, 2023
@horheynm horheynm deleted the graphql-error branch April 12, 2023 14:02
horheynm added a commit that referenced this pull request Apr 13, 2023
* error handling - send message from graphql

Union to Optional

error message

* error message

* comments

* tests

* tests

* change def name

* error logic
horheynm added a commit that referenced this pull request Apr 17, 2023
* fix return type annotation and tests (#282)

Co-authored-by: Danny Guinther <dannyguinther@gmail.com>

* error handling - send message from graphql (#286)

* error handling - send message from graphql

Union to Optional

error message

* error message

* comments

* tests

* tests

* change def name

* error logic

* Stub v2 (#271)

* Dummy graphql requests module

* graphql api request

* return Model instances

* Update NOTICE (#242)

license name change

* bump main to 1.4.0 (#246)

Co-authored-by: dhuang <dhuang@MacBook-Pro.local>

* Pin numpy version to <=1.21.6 (#247)

search

search, download draft

draft, successful search and download

draft

Update: `ModelAnalysis.from_onnx(...)` to additionally work with loaded `ModelProto` (#253)

refactor

search, download

* lint

* pass tests

* init files

* lint

* Add dummy test using test-specific subclass

* tests

* add incremeent_downloads=False

* allow empty arguments

* comments

* query parser, allow dict as input, add tests for extra functionality

* restore models.utils

* restore models.utils

* v2 stub

* comments

* change stubs to ones on prod

* lint

* Update src/sparsezoo/model/utils.py

Co-authored-by: Danny Guinther <dannyguinther@gmail.com>

* Update src/sparsezoo/model/utils.py

Co-authored-by: Danny Guinther <dannyguinther@gmail.com>

* Update src/sparsezoo/api/utils.py

Co-authored-by: Danny Guinther <dannyguinther@gmail.com>

---------

Co-authored-by: Danny Guinther <dguinther@neuralmagic.com>
Co-authored-by: Jeannie Finks <74554921+jeanniefinks@users.noreply.github.com>
Co-authored-by: dhuangnm <74931910+dhuangnm@users.noreply.github.com>
Co-authored-by: dhuang <dhuang@MacBook-Pro.local>
Co-authored-by: Rahul Tuli <rahul@neuralmagic.com>
Co-authored-by: Danny Guinther <dannyguinther@gmail.com>

---------

Co-authored-by: Danny Guinther <dannyguinther@gmail.com>
Co-authored-by: Danny Guinther <dguinther@neuralmagic.com>
Co-authored-by: Jeannie Finks <74554921+jeanniefinks@users.noreply.github.com>
Co-authored-by: dhuangnm <74931910+dhuangnm@users.noreply.github.com>
Co-authored-by: dhuang <dhuang@MacBook-Pro.local>
Co-authored-by: Rahul Tuli <rahul@neuralmagic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants