Exemplo n.º 1
0
def get_notebook_token(project):
    spawner = NotebookSpawner(project_name=project.unique_name,
                              project_uuid=project.uuid.hex,
                              k8s_config=settings.K8S_CONFIG,
                              namespace=settings.K8S_NAMESPACE,
                              in_cluster=True)
    return spawner.get_notebook_token()
Exemplo n.º 2
0
def start_notebook(project, image):
    spawner = NotebookSpawner(
        project_name=project.unique_name,
        project_uuid=project.uuid.hex,
        k8s_config=settings.K8S_CONFIG,
        namespace=settings.K8S_NAMESPACE,
        in_cluster=True)

    spawner.start_notebook(image=image, resources=project.notebook.compiled_spec.resources)
    project.has_notebook = True
    project.save()
Exemplo n.º 3
0
def stop_notebook(project, update_status=False):
    spawner = NotebookSpawner(project_name=project.unique_name,
                              project_uuid=project.uuid.hex,
                              k8s_config=settings.K8S_CONFIG,
                              namespace=settings.K8S_NAMESPACE,
                              in_cluster=True)

    spawner.stop_notebook()
    project.has_notebook = False
    project.save()
    if update_status:
        # Update experiment status to show that its stopped
        project.notebook.set_status(status=ExperimentLifeCycle.STOPPED,
                                    message='Notebook was stopped')