deephaven / vscode-deephaven

Deephaven Visual Studio Code Extension
Apache License 2.0
0 stars 0 forks source link

Line numbers in errors are not useful #9

Open chipkent opened 3 weeks ago

chipkent commented 3 weeks ago

I run this code with a known error on line 11.


from deephaven import empty_table, time_table
from deephaven.plot import Figure

t1 = empty_table(10).update(["X = i", "Y = 10 * i"])
t2 = time_table("PT1s").update(["X = i%10", "Y = 10 * i"])

t3 = t1.natural_join(t2.last_by("X"), on="X", joins="YY=Y")

p1 = Figure().plot_xy("Plot 1", t1, x="X", y="Y").show()
p2 = Figure().plot_xy(t2, "X", "Y").show()

# p1 = Figure().plot_xy("Plot 1", t1, x="X", y="Y").show()
# p2 = Figure().plot_xy("Plot 2", t2, x="X", y="Y").show()

print("DH Rules")
print("DH Sucks")

Here is the error -- no mention of line 11 or even the file name:

14:16:33.055 ERROR r-Scheduler-Serial-1 | .c.ConsoleServiceGrpcImpl | Error running script: java.lang.RuntimeException: Error in Python interpreter:
Type: <class 'deephaven.dherror.DHError'>
Value: Improper input type: name=series_name type=<class 'deephaven.table.Table'> supported=['str'] : Improper input type: name=series_name type=<class 'deephaven.table.Table'> supported=['str']
NoneType: None

Line: 47
Namespace: _assert_type
File: /private/tmp/my-dh-venv/lib/python3.11/site-packages/deephaven/plot/figure.py
Traceback (most recent call last):
  File "<string>", line -1, in <module>
  File "/private/tmp/my-dh-venv/lib/python3.11/site-packages/deephaven/plot/figure.py", line -1, in plot_xy
  File "/private/tmp/my-dh-venv/lib/python3.11/site-packages/deephaven/plot/figure.py", line -1, in _convert_j
  File "/private/tmp/my-dh-venv/lib/python3.11/site-packages/deephaven/plot/figure.py", line -1, in _assert_type

    at org.jpy.PyLib.executeCode(Native Method)
    at org.jpy.PyObject.executeCode(PyObject.java:138)
    at io.deephaven.engine.util.PythonEvaluatorJpy.evalScript(PythonEvaluatorJpy.java:73)
    at io.deephaven.integrations.python.PythonDeephavenSession.lambda$evaluate$1(PythonDeephavenSession.java:205)
    at io.deephaven.util.locks.FunctionalLock.doLockedInterruptibly(FunctionalLock.java:51)
    at io.deephaven.integrations.python.PythonDeephavenSession.evaluate(PythonDeephavenSession.java:205)
    at io.deephaven.engine.util.AbstractScriptSession.lambda$evaluateScript$0(AbstractScriptSession.java:165)
    at io.deephaven.engine.context.ExecutionContext.lambda$apply$0(ExecutionContext.java:196)
    at io.deephaven.engine.context.ExecutionContext.apply(ExecutionContext.java:207)
    at io.deephaven.engine.context.ExecutionContext.apply(ExecutionContext.java:195)
    at io.deephaven.engine.util.AbstractScriptSession.evaluateScript(AbstractScriptSession.java:165)
    at io.deephaven.engine.util.DelegatingScriptSession.evaluateScript(DelegatingScriptSession.java:72)
    at io.deephaven.engine.util.ScriptSession.evaluateScript(ScriptSession.java:75)
    at io.deephaven.server.console.ConsoleServiceGrpcImpl.lambda$executeCommand$4(ConsoleServiceGrpcImpl.java:193)
    at io.deephaven.server.session.SessionState$ExportBuilder.lambda$submit$2(SessionState.java:1537)
    at io.deephaven.server.session.SessionState$ExportObject.doExport(SessionState.java:995)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at io.deephaven.server.runner.scheduler.SchedulerModule$ThreadFactory.lambda$newThread$0(SchedulerModule.java:100)
    at java.base/java.lang.Thread.run(Thread.java:829)
bmingles commented 1 week ago

Oddly when I run this script, I get the same error with different line numbers.

Running full script:

image

Running selected line 10 p2 = Figure().plot_xy(t2, "X", "Y").show()

image

I'm not sure how to get the -1 line number shown in the ticket description. @chipkent curious if I'm doing something wrong for the reproduction here?

That said, even if the line number is positive, there are 2 issues I see here:

  1. The line number seems to be relative to the number of selected lines as opposed to the file
  2. It just says <string> instead of providing a file name.

I do actually see this same behavior in code studio, so I think this is something that we should create a ticket for there and address there as well. The line number issue is likely something we can address only there and get it for free in the extension. The filename may be more nuanced since vscode file could be something outside of what code studio is aware of and would need special handling.

bmingles commented 1 week ago

@chipkent there's a possibility the -1 line numbers may be a Python bug fixed in 3.12.

bmingles commented 13 hours ago

I was able to reproduce the -1 line numbers in 3.11.0 per reproduction steps here: https://github.com/python/cpython/issues/101400