Пример #1
0
 def unarchiveNotebook(notebookId: str, notebookName: str):
     """
     Service to unarchive notebook 
     """
     res = ApiResponse(message="Error in archiving notebook")
     response = Zeppelin.renameNotebook(notebookId, notebookName)
     if response:
         res.update(True, "Notebook unarchived successfully", None)
     return res
Пример #2
0
    def editNotebook(notebookObjId: int, payload: dict):
        """
        Service to update a template based notebook
        :param notebookObjId: ID of the NotebookObject to be edited
        :param payload: Dict containing notebook template info
        """
        res = ApiResponse(message="Error updating notebook")
        defaultPayload = payload.copy()
        notebookObject = NotebookObject.objects.get(id=notebookObjId)
        notebook, connection = NotebookJobServices._prepareNotebookJson(
            notebookObject.notebookTemplate, payload)

        updateSuccess = Zeppelin.updateNotebookParagraphs(
            notebookObject.notebookZeppelinId, notebook)
        if updateSuccess:
            if defaultPayload.get("name"):
                Zeppelin.renameNotebook(notebookObject.notebookZeppelinId,
                                        defaultPayload.get("name"))
            notebookObject.defaultPayload = defaultPayload
            notebookObject.connection = connection
            notebookObject.save()
            res.update(True, "Notebook updated successfully")
        return res