|
|
@ -72,16 +72,16 @@ public class PytorchTaskTest { |
|
|
|
envManager.setPythonEnvTool(PythonEnvManager.ENV_TOOL_CONDA); |
|
|
|
envManager.setPythonEnvTool(PythonEnvManager.ENV_TOOL_CONDA); |
|
|
|
envManager.setCondaPythonVersion("3.9"); |
|
|
|
envManager.setCondaPythonVersion("3.9"); |
|
|
|
String condaEnvCommand39 = envManager.getBuildEnvCommand(requirementPath); |
|
|
|
String condaEnvCommand39 = envManager.getBuildEnvCommand(requirementPath); |
|
|
|
Assert.assertEquals(condaEnvCommand39, "conda create -y python=3.9 -p ./venv && source activate ./venv && python -m pip install -r " + requirementPath); |
|
|
|
Assert.assertEquals(condaEnvCommand39, "conda create -y python=3.9 -p ./venv && source activate ./venv && ./venv/bin/python -m pip install -r " + requirementPath); |
|
|
|
|
|
|
|
|
|
|
|
envManager.setCondaPythonVersion("3.8"); |
|
|
|
envManager.setCondaPythonVersion("3.8"); |
|
|
|
String condaEnvCommand38 = envManager.getBuildEnvCommand(requirementPath); |
|
|
|
String condaEnvCommand38 = envManager.getBuildEnvCommand(requirementPath); |
|
|
|
Assert.assertEquals(condaEnvCommand38, "conda create -y python=3.8 -p ./venv && source activate ./venv && python -m pip install -r " + requirementPath); |
|
|
|
Assert.assertEquals(condaEnvCommand38, "conda create -y python=3.8 -p ./venv && source activate ./venv && ./venv/bin/python -m pip install -r " + requirementPath); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
envManager.setPythonEnvTool(PythonEnvManager.ENV_TOOL_VENV); |
|
|
|
envManager.setPythonEnvTool(PythonEnvManager.ENV_TOOL_VENV); |
|
|
|
String venvEnvCommand = envManager.getBuildEnvCommand(requirementPath); |
|
|
|
String venvEnvCommand = envManager.getBuildEnvCommand(requirementPath); |
|
|
|
Assert.assertEquals(venvEnvCommand, "virtualenv -p ${PYTHON_HOME} ./venv && source ./venv/bin/activate && python -m pip install -r " + requirementPath); |
|
|
|
Assert.assertEquals(venvEnvCommand, "virtualenv -p ${PYTHON_HOME} ./venv && source ./venv/bin/activate && ./venv/bin/python -m pip install -r " + requirementPath); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -146,7 +146,7 @@ public class PytorchTaskTest { |
|
|
|
PytorchTask task = initTask(parameters); |
|
|
|
PytorchTask task = initTask(parameters); |
|
|
|
Assert.assertEquals(task.buildPythonExecuteCommand(), |
|
|
|
Assert.assertEquals(task.buildPythonExecuteCommand(), |
|
|
|
"export PYTHONPATH=.\n" + |
|
|
|
"export PYTHONPATH=.\n" + |
|
|
|
"conda create -y python=3.6 -p ./venv && source activate ./venv && python -m pip install -r requirements.txt\n" + |
|
|
|
"conda create -y python=3.6 -p ./venv && source activate ./venv && ./venv/bin/python -m pip install -r requirements.txt\n" + |
|
|
|
"./venv/bin/python main.py --epochs=1 --dry-run"); |
|
|
|
"./venv/bin/python main.py --epochs=1 --dry-run"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -163,7 +163,7 @@ public class PytorchTaskTest { |
|
|
|
PytorchTask task = initTask(parameters); |
|
|
|
PytorchTask task = initTask(parameters); |
|
|
|
Assert.assertEquals(task.buildPythonExecuteCommand(), |
|
|
|
Assert.assertEquals(task.buildPythonExecuteCommand(), |
|
|
|
"export PYTHONPATH=.\n" + |
|
|
|
"export PYTHONPATH=.\n" + |
|
|
|
"virtualenv -p ${PYTHON_HOME} ./venv && source ./venv/bin/activate && python -m pip install -r requirements.txt\n" + |
|
|
|
"virtualenv -p ${PYTHON_HOME} ./venv && source ./venv/bin/activate && ./venv/bin/python -m pip install -r requirements.txt\n" + |
|
|
|
"./venv/bin/python main.py --epochs=1 --dry-run"); |
|
|
|
"./venv/bin/python main.py --epochs=1 --dry-run"); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
@ -189,7 +189,7 @@ public class PytorchTaskTest { |
|
|
|
createFile(scriptFile); |
|
|
|
createFile(scriptFile); |
|
|
|
|
|
|
|
|
|
|
|
String expected = "export PYTHONPATH=%s\n" + |
|
|
|
String expected = "export PYTHONPATH=%s\n" + |
|
|
|
"virtualenv -p ${PYTHON_HOME} ./venv && source ./venv/bin/activate && python -m pip install -r %s\n" + |
|
|
|
"virtualenv -p ${PYTHON_HOME} ./venv && source ./venv/bin/activate && ./venv/bin/python -m pip install -r %s\n" + |
|
|
|
"./venv/bin/python %s"; |
|
|
|
"./venv/bin/python %s"; |
|
|
|
System.out.println(task.buildPythonExecuteCommand()); |
|
|
|
System.out.println(task.buildPythonExecuteCommand()); |
|
|
|
Assert.assertEquals(String.format(expected, pythonPath, requirementFile, scriptFile), task.buildPythonExecuteCommand()); |
|
|
|
Assert.assertEquals(String.format(expected, pythonPath, requirementFile, scriptFile), task.buildPythonExecuteCommand()); |
|
|
|