use of io.hops.hopsworks.persistence.entity.python.PythonDep in project hopsworks by logicalclocks.
the class LibraryController method persistAndMarkImmutable.
/**
* For each library in the conda environment figure out if it should be marked as unmutable.
*
* @param pyDepsInImage
* @return
*/
public Collection<PythonDep> persistAndMarkImmutable(Collection<PythonDep> pyDepsInImage) {
Collection<PythonDep> deps = new ArrayList();
for (PythonDep dep : pyDepsInImage) {
String libraryName = dep.getDependency();
if (settings.getImmutablePythonLibraryNames().contains(libraryName)) {
PythonDep pyDep = libraryFacade.getOrCreateDep(dep.getRepoUrl(), dep.getInstallType(), libraryName, dep.getVersion(), true, true);
deps.add(pyDep);
} else {
PythonDep pyDep = libraryFacade.getOrCreateDep(dep);
deps.add(pyDep);
}
}
return deps;
}
use of io.hops.hopsworks.persistence.entity.python.PythonDep in project hopsworks by logicalclocks.
the class LibraryController method parseCondaList.
public Collection<PythonDep> parseCondaList(String condaListStr) throws ServiceException {
Collection<PythonDep> deps = new ArrayList<>();
String[] lines = condaListStr.split(System.getProperty("line.separator"));
for (int i = 3; i < lines.length; i++) {
String line = lines[i];
String[] split = line.split(" +");
String libraryName = split[0];
String version = split[1];
String channel = "conda";
if (split.length > 3) {
channel = split[3].trim().isEmpty() ? channel : split[3];
}
CondaInstallType installType = CondaInstallType.PIP;
if (!(channel.equals("pypi"))) {
installType = CondaInstallType.CONDA;
}
AnacondaRepo repo = libraryFacade.getRepo(channel, true);
boolean cannotBeRemoved = channel.equals("default");
PythonDep pyDep = libraryFacade.getOrCreateDep(repo, installType, libraryName, version, false, cannotBeRemoved);
deps.add(pyDep);
}
return deps;
}
Aggregations