zhongjiajie commented on pull request #7631:
URL: 
https://github.com/apache/dolphinscheduler/pull/7631#issuecomment-1007190157


   I here allow it raise error base on py4j jave gateway server track stack, 
and I directly using chaining error message for more easy location the error. 
You could see in keyword `During handling of the above exception, another 
exception occurred`
   
   Here it is an example 
   
   ```log
   Traceback (most recent call last):
     File 
"/Users/zhongjiajie/Documents/program/dolphinscheduler/dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/core/database.py",
 line 59, in get_database_info
       self._database = gateway.entry_point.getDatasourceInfo(name)
     File 
"/Users/zhongjiajie/.virtualenvs/pydolphinschduler/lib/python3.8/site-packages/py4j/java_gateway.py",
 line 1309, in __call__
       return_value = get_return_value(
     File 
"/Users/zhongjiajie/.virtualenvs/pydolphinschduler/lib/python3.8/site-packages/py4j/protocol.py",
 line 326, in get_return_value
       raise Py4JJavaError(
   py4j.protocol.Py4JJavaError: An error occurred while calling 
t.getDatasourceInfo.
   : java.lang.IllegalArgumentException: Can not find any datasource by name 
first_mysql
        at 
org.apache.dolphinscheduler.server.PythonGatewayServer.getDatasourceInfo(PythonGatewayServer.java:398)
        at sun.reflect.GeneratedMethodAccessor187.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244)
        at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:357)
        at py4j.Gateway.invoke(Gateway.java:282)
        at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)
        at py4j.commands.CallCommand.execute(CallCommand.java:79)
        at py4j.GatewayConnection.run(GatewayConnection.java:238)
        at java.lang.Thread.run(Thread.java:748)
   
   
   During handling of the above exception, another exception occurred:
   
   Traceback (most recent call last):
     File 
"/Users/zhongjiajie/Documents/program/dolphinscheduler/dolphinscheduler-python/pydolphinscheduler/examples/task_datax_example.py",
 line 94, in <module>
       pd.run()
     File 
"/Users/zhongjiajie/Documents/program/dolphinscheduler/dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/core/process_definition.py",
 line 325, in run
       self.submit()
     File 
"/Users/zhongjiajie/Documents/program/dolphinscheduler/dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/core/process_definition.py",
 line 377, in submit
       json.dumps(self.task_definition_json),
     File 
"/Users/zhongjiajie/Documents/program/dolphinscheduler/dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/core/process_definition.py",
 line 215, in task_definition_json
       return [task.get_define() for task in self.tasks.values()]
     File 
"/Users/zhongjiajie/Documents/program/dolphinscheduler/dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/core/process_definition.py",
 line 215, in <listcomp>
       return [task.get_define() for task in self.tasks.values()]
     File 
"/Users/zhongjiajie/Documents/program/dolphinscheduler/dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/core/base.py",
 line 69, in get_define
       content = self.get_define_custom(camel_attr, self._DEFINE_ATTR)
     File 
"/Users/zhongjiajie/Documents/program/dolphinscheduler/dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/core/base.py",
 line 56, in get_define_custom
       val = getattr(self, attr, None)
     File 
"/Users/zhongjiajie/Documents/program/dolphinscheduler/dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/tasks/datax.py",
 line 116, in task_params
       datasource = Database(self.datasource_name, "dsType", "dataSource")
     File 
"/Users/zhongjiajie/Documents/program/dolphinscheduler/dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/core/database.py",
 line 39, in __init__
       self[type_key] = self.database_type
     File 
"/Users/zhongjiajie/Documents/program/dolphinscheduler/dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/core/database.py",
 line 45, in database_type
       return self.get_database_info(self.database_name).get("type")
     File 
"/Users/zhongjiajie/Documents/program/dolphinscheduler/dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/core/database.py",
 line 62, in get_database_info
       raise PyDSParamException(str(ex.java_exception))
   pydolphinscheduler.exceptions.PyDSParamException: 
java.lang.IllegalArgumentException: Can not find any datasource by name 
first_mysql
   
   Process finished with exit code 1
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to