Repository: modin-project/modin

Issue:
Move backend check in Modin XGBoost from module to funcs
### Describe the problem
<!-- Describe the problem clearly here. -->
In current implementation check for the backend is in `modin.experimental.xgboost`  module. Need to move this check to `predict/train` function directly to make possible importing this module (for building docs, for examples).



Discussion:

Resolving patch:
diff --git a/modin/experimental/xgboost/xgboost.py b/modin/experimental/xgboost/xgboost.py
--- a/modin/experimental/xgboost/xgboost.py
+++ b/modin/experimental/xgboost/xgboost.py
@@ -20,11 +20,6 @@
 
 from modin.config import Engine
 
-if Engine.get() == "Ray":
-    from .xgboost_ray import _train, _predict
-else:
-    raise ValueError("Current version supports only Ray engine as MODIN_ENGINE.")
-
 LOGGER = logging.getLogger("[modin.xgboost]")
 
 
@@ -99,6 +94,12 @@ def train(
                          'eval': {'logloss': ['0.480385', '0.357756']}}}
     """
     LOGGER.info("Training started")
+
+    if Engine.get() == "Ray":
+        from .xgboost_ray import _train
+    else:
+        raise ValueError("Current version supports only Ray engine.")
+
     result = _train(
         dtrain, nthread, evenly_data_distribution, params, *args, evals=evals, **kwargs
     )
@@ -137,6 +138,11 @@ def predict(
     """
     LOGGER.info("Prediction started")
 
+    if Engine.get() == "Ray":
+        from .xgboost_ray import _predict
+    else:
+        raise ValueError("Current version supports only Ray engine.")
+
     if isinstance(model, xgb.Booster):
         booster = model
     elif isinstance(model, dict):


Test patch:
diff --git a/modin/experimental/xgboost/test/__init__.py b/modin/experimental/xgboost/test/__init__.py
new file mode 100644
--- /dev/null
+++ b/modin/experimental/xgboost/test/__init__.py
@@ -0,0 +1,12 @@
+# Licensed to Modin Development Team under one or more contributor license agreements.
+# See the NOTICE file distributed with this work for additional information regarding
+# copyright ownership.  The Modin Development Team licenses this file to you under the
+# Apache License, Version 2.0 (the "License"); you may not use this file except in
+# compliance with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software distributed under
+# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
+# ANY KIND, either express or implied. See the License for the specific language
+# governing permissions and limitations under the License.
diff --git a/modin/experimental/xgboost/test/test_default.py b/modin/experimental/xgboost/test/test_default.py
new file mode 100644
--- /dev/null
+++ b/modin/experimental/xgboost/test/test_default.py
@@ -0,0 +1,30 @@
+# Licensed to Modin Development Team under one or more contributor license agreements.
+# See the NOTICE file distributed with this work for additional information regarding
+# copyright ownership.  The Modin Development Team licenses this file to you under the
+# Apache License, Version 2.0 (the "License"); you may not use this file except in
+# compliance with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software distributed under
+# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
+# ANY KIND, either express or implied. See the License for the specific language
+# governing permissions and limitations under the License.
+
+
+import pytest
+from modin.config import Engine
+
+import modin.experimental.xgboost as xgb
+
+
+@pytest.mark.skipif(
+    Engine.get() == "Ray",
+    reason="This test doesn't make sense on Ray backend.",
+)
+@pytest.mark.parametrize("func", ["train", "predict"])
+def test_backend(func):
+    try:
+        getattr(xgb, func)({}, xgb.ModinDMatrix(None, None))
+    except ValueError:
+        pass