def project(request, projectid): """Get or updates a new Carme project.""" assert isinstance(request, HttpRequest) """If it was a post then set the configuration""" if request.method == "POST": carmewrapper.setStatus(projectid, "Task", "Config") app.tasks.configAll(projectid, request.POST) return JsonResponse(carmewrapper.getProjectDetails(projectid))
def projects(request): """Makes a new Carme project.""" assert isinstance(request, HttpRequest) """If it was a post then set the configuration""" if request.method == "POST": projectid = str(uuid.uuid4()) app.tasks.new(projectid) carmewrapper.setStatus(projectid, "Task", "Config") app.tasks.configAll(projectid, request.POST) return JsonResponse({'projectid': projectid}) else: return JsonResponse({})
def form(request): """Renders the Carme form setup page.""" assert isinstance(request, HttpRequest) """If it was a post then set the make the project and go to the page""" if request.method == "POST": projectid = str(uuid.uuid4()) app.tasks.new(projectid) carmewrapper.setStatus(projectid, "Task", "Config") app.tasks.configAll(projectid, request.POST) return redirect("project", projectid) else: return render( request, 'app/form.html', { 'title':'New Form', 'year':datetime.now().year, } )
def new(projectid): carmewrapper.new(projectid) carmewrapper.setStatus(projectid, "State", "New") carmewrapper.setStatus(projectid, "IP", "NONE")
def delete(projectid): carmewrapper.setStatus(projectid, "State", "Deleted") carmewrapper.cleanUp(projectid)
def setup(projectid): carmewrapper.setStatus(projectid, "Cluster", "Creating") result = carmewrapper.createCluster(projectid) carmewrapper.setStatus(projectid, "Cluster", "Created") carmewrapper.setStatus(projectid, "Jupyter", "Installing") result += carmewrapper.installJupyter(projectid) carmewrapper.setStatus(projectid, "Jupyter", "Installed") carmewrapper.setStatus(projectid, "Task", "Idle") carmewrapper.setStatus(projectid, "State", "Started")
def config(projectid, config, filename): carmewrapper.config(projectid, config, filename) carmewrapper.setStatus(projectid, "State", "Configured") carmewrapper.setStatus(projectid, "Task", "Idle")
def configAll(projectid, config): carmewrapper.configAll(projectid, config) carmewrapper.setStatus(projectid, "State", "Configured") carmewrapper.setStatus(projectid, "Task", "Idle")
def setup(request, projectid): carmewrapper.setStatus(projectid, "Task", "Setup") app.tasks.setup.delay(projectid) return JsonResponse(carmewrapper.getProjectDetails(projectid))