Skip to content
This repository was archived by the owner on Mar 8, 2020. It is now read-only.

Conversation

@juanjux
Copy link
Contributor

@juanjux juanjux commented Jul 3, 2017

  • Errors will be now propagated from the AST extractor to the driver respone "errors" field.

  • Also remove an old cruft file from the start of times when we were benchmarking different msgpack implementations to find the fastest one to bang the python native driver.

Fixes #28.

@bzz
Copy link
Contributor

bzz commented Jul 6, 2017

👍 Tested this and it provides nice formatted errors for the client

fmt.Printf("erorrs:%+v\n")

results in

errors:[Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/python_driver/requestprocessor.py", line 136, in process_request
    raise Exception('Could not determine Python version')
Exception: Could not determine Python version
] for bits.py

or

errors:[Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/python_driver/requestprocessor.py", line 136, in process_request
    raise Exception('Could not determine Python version')
Exception: Could not determine Python version
] for tmp_gpu_coding.py

@juanjux juanjux requested a review from smola July 6, 2017 11:11
@juanjux
Copy link
Contributor Author

juanjux commented Jul 6, 2017

@bzz that's actually not totally right since the errors should be the real errors that the AST extractor gives, not the "could not determine Python version", that is not in the code anymore as you can see if you check the PR changes, are you sure you're using this commit and rebuild the Python driver image and set the server to use the local docker daemon? (this fix is not yet in the Python driver image since the PR is not merged).

@juanjux juanjux requested a review from abeaumont July 6, 2017 11:20
@bzz
Copy link
Contributor

bzz commented Jul 6, 2017

Let me try again

@bzz
Copy link
Contributor

bzz commented Jul 6, 2017

Latest code results in

failed:fatal, 1 errors:[Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/python_driver/requestprocessor.py", line 139, in process_request
    '\n------ Python3 errors:\n%s' % codeinfo['py3_ast_errors']
Exception: Errors produced trying to get an AST for both Python versions
------ Python2 errors:
[b'Traceback (most recent call last):\n  File "<string>", line 1, in <module>\n  File "/usr/lib/python2.7/site-packages/pydetector/astexport.py", line 20, in export_dict\n    return visitor.parse()\n  File "/usr/lib/python2.7/site-packages/pydetector/astexport.py", line 360, in parse\n    node = ast.parse(self.codestr, mode=\'exec\')\n  File "$usr/lib/python2.7/ast.py", line 37, in parse\n    return compile(source, filename, mode, PyCF_ONLY_AST)\n  File "<unknown>", line 57\n    >>> ac = Account.objects.get(usern$me="user0")\n     ^\nSyntaxError: invalid syntax\n']
------ Python3 errors:
['Traceback (most recent call last):\n  File "/usr/lib/python3.6/site-packages/pydetector/ast_checks.py", line 52, in check_ast\n    current_ast = export_dict(code)\n  File
"/usr/lib/python3.6/site-packages/pydetector/astexport.py", line 20, in export_dict\n    return visitor.parse()\n  File "/usr/lib/python3.6/site-packages/pydetector/astexpor
t.py", line 360, in parse\n    node = ast.parse(self.codestr, mode=\'exec\')\n  File "/usr/lib/python3.6/ast.py", line 35, in parse\n    return compile(source, filename, mod
e, PyCF_ONLY_AST)\n  File "<unknown>", line 57\n    >>> ac = Account.objects.get(username="user0")\n     ^\nSyntaxError: invalid syntax\n']
] for common_op.py

@juanjux
Copy link
Contributor Author

juanjux commented Jul 6, 2017

@bzz, that right 👍 it's showing the error that every Python version gives when trying to extract the AST (if it can't detect quickly the Python version will analyze Python 3 AST and if that can't be extracted Python 2, returning both errors).

@juanjux juanjux merged commit 17bfa20 into bblfsh:master Jul 6, 2017
@juanjux juanjux deleted the fix/propagate_errors branch July 13, 2017 08:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants