use of io.hops.hopsworks.common.jupyter.RepositoryStatus in project hopsworks by logicalclocks.
the class JupyterService method getGitStatusOfJupyterRepo.
@GET
@Path("/git/status")
@Produces(MediaType.APPLICATION_JSON)
@AllowedProjectRoles({ AllowedProjectRoles.DATA_OWNER, AllowedProjectRoles.DATA_SCIENTIST })
@JWTRequired(acceptedTokens = { Audience.API }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER" })
public Response getGitStatusOfJupyterRepo(@Context SecurityContext sc) throws ProjectException, ServiceException {
Users user = jWTHelper.getUserPrincipal(sc);
String projectUser = hdfsUsersController.getHdfsUserName(project, user);
JupyterProject jupyterProject = jupyterFacade.findByUser(projectUser);
if (jupyterProject == null) {
throw new ProjectException(RESTCodes.ProjectErrorCode.JUPYTER_SERVER_NOT_FOUND, Level.FINE, "Could not found Jupyter server", "Could not found Jupyter server for Hopsworks user: " + projectUser);
}
if (!jupyterManager.ping(jupyterProject)) {
throw new ServiceException(RESTCodes.ServiceErrorCode.JUPYTER_SERVERS_NOT_RUNNING, Level.FINE, "Jupyter server is not running", "Jupyter server for Hopsworks user: " + projectUser + " is not running");
}
JupyterSettings jupyterSettings = jupyterSettingsFacade.findByProjectUser(project, user.getEmail());
RepositoryStatus status = NullJupyterNbVCSController.EMPTY_REPOSITORY_STATUS;
if (jupyterSettings.isGitBackend()) {
status = jupyterNbVCSController.status(jupyterProject, jupyterSettings);
}
return Response.ok(status).build();
}
Aggregations