Esempio n. 1
0
def _setup_pyenvs(
        pyenv_zip_path: Union[str, Dict[topologies.NodeLabel, str]]
) -> Dict[topologies.NodeLabel, _env.PythonEnvDescription]:
    if isinstance(pyenv_zip_path, str):
        pyenv = _env.gen_pyenv_from_existing_archive(pyenv_zip_path)
        pyenvs = {
            topologies.NodeLabel.CPU: pyenv,
            topologies.NodeLabel.GPU: pyenv
        }
    else:
        pyenvs = {label: _env.gen_pyenv_from_existing_archive(env_zip_path)
                  for label, env_zip_path in pyenv_zip_path.items()}
    return pyenvs
Esempio n. 2
0
def test_gen_pyenvs_from_existing_env(path_to_archive, expected_cmd,
                                      expected_dest_path,
                                      standalone_client_mode):
    result = gen_pyenv_from_existing_archive(path_to_archive,
                                             standalone_client_mode)
    assert result.path_to_archive == path_to_archive
    assert result.dispatch_task_cmd == expected_cmd
    assert result.dest_path == expected_dest_path
Esempio n. 3
0
def test_gen_pyenvs_from_unknown_format():
    with pytest.raises(ValueError):
        gen_pyenv_from_existing_archive("/path/to/pack.tar.bz2")
Esempio n. 4
0
def test_gen_pyenvs_from_unknown_format():
    with pytest.raises(ValueError):
        gen_pyenv_from_existing_archive("/path/to/pack.tar.bz2",
                                        standalone_client_mode=False)