MCPcopy Create free account
hub / github.com/dmlc/xgboost / run_pickling

Method run_pickling

tests/python-gpu/test_gpu_pickling.py:42–67  ·  view source on GitHub ↗
(self, bst: Union[xgb.Booster, xgb.XGBModel])

Source from the content-addressed store, hash-verified

40 args_template = ["pytest", "--verbose", "-s", "--fulltrace"]
41
42 def run_pickling(self, bst: Union[xgb.Booster, xgb.XGBModel]) -> None:
43 save_pickle(bst, model_path)
44 args = [
45 "pytest",
46 "--verbose",
47 "-s",
48 "--fulltrace",
49 "./tests/python-gpu/load_pickle.py::TestLoadPickle::test_load_pkl",
50 ]
51 command = ""
52 for arg in args:
53 command += arg
54 command += " "
55
56 cuda_environment = {"CUDA_VISIBLE_DEVICES": "-1"}
57 env = os.environ.copy()
58 # Passing new_environment directly to `env' argument results
59 # in failure on Windows:
60 # Fatal Python error: _Py_HashRandomization_Init: failed to
61 # get random numbers to initialize Python
62 env.update(cuda_environment)
63
64 # Load model in a CPU only environment.
65 status = subprocess.call(command, env=env, shell=True)
66 assert status == 0
67 os.remove(model_path)
68
69 # TODO: This test is too slow
70 @pytest.mark.skipif(**tm.no_sklearn())

Callers 1

test_picklingMethod · 0.95

Calls 4

save_pickleFunction · 0.85
copyMethod · 0.80
removeMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected