public async Task TestDeleteNotebook() { NotebookClient client = CreateClient(); string notebookName = Recording.GenerateId("Notebook", 16); Notebook notebook = new Notebook( new NotebookMetadata { LanguageInfo = new NotebookLanguageInfo(name: "Python") }, nbformat: 4, nbformatMinor: 2, new List <NotebookCell>() ); NotebookCreateOrUpdateNotebookOperation createOperation = await client.StartCreateOrUpdateNotebookAsync(notebookName, new NotebookResource(notebookName, notebook)); await createOperation.WaitForCompletionAsync(); NotebookDeleteNotebookOperation deleteOperation = await client.StartDeleteNotebookAsync(notebookName); Response response = await deleteOperation.WaitForCompletionAsync(); Assert.AreEqual(200, response.Status); }
public async Task TestDeleteNotebook() { NotebookClient client = CreateClient(); NotebookResource resource = await DisposableNotebook.CreateResource(client, this.Recording); NotebookDeleteNotebookOperation operation = await client.StartDeleteNotebookAsync(resource.Name); await operation.WaitAndAssertSuccessfulCompletion(); }
public async Task CreateAndUploadNotebook() { #region Snippet:CreateNotebookClient #if SNIPPET // Replace the string below with your actual endpoint url. string endpoint = "<my-endpoint-url>"; #else string endpoint = TestEnvironment.EndpointUrl; #endif var client = new NotebookClient(endpoint: new Uri(endpoint), credential: new DefaultAzureCredential()); #endregion #region Snippet:ConfigureNotebookResource string notebookName = "Test-Notebook"; var cell = new NotebookCell("code", new NotebookMetadata(), new string[] { "from azureml.opendatasets import NycTlcYellow\n", "\n", "data = NycTlcYellow()\n", "df = data.to_spark_dataframe()\n", "# Display 10 rows\n", "display(df.limit(10))" }); var newNotebook = new Notebook(new NotebookMetadata(), 4, 2, new NotebookCell[] { cell }); var notebookResource = new NotebookResource(notebookName, newNotebook); #endregion #region Snippet:CreateNotebook NotebookCreateOrUpdateNotebookOperation operation = await client.StartCreateOrUpdateNotebookAsync(notebookName, notebookResource); await operation.WaitForCompletionAsync(); Console.WriteLine("The notebook is created"); #endregion #region Snippet:RetrieveNotebook NotebookResource retrievedNotebook = client.GetNotebook(notebookName); #endregion #region Snippet:ListNotebooks Pageable <NotebookResource> notebooks = client.GetNotebooksByWorkspace(); foreach (NotebookResource notebook in notebooks) { Console.WriteLine(notebook.Name); } #endregion #region Snippet:DeleteNotebook NotebookDeleteNotebookOperation deleteNotebookOperation = client.StartDeleteNotebook(notebookName); await deleteNotebookOperation.WaitForCompletionResponseAsync(); #endregion }
public async Task TestRenameLinkedService() { NotebookClient client = CreateClient(); NotebookResource resource = await DisposableNotebook.CreateResource(client, Recording); string newNotebookName = Recording.GenerateId("Notebook2", 16); NotebookRenameNotebookOperation renameOperation = await client.StartRenameNotebookAsync(resource.Name, new ArtifactRenameRequest() { NewName = newNotebookName }); await renameOperation.WaitForCompletionResponseAsync(); NotebookResource notebook = await client.GetNotebookAsync(newNotebookName); Assert.AreEqual(newNotebookName, notebook.Name); NotebookDeleteNotebookOperation operation = await client.StartDeleteNotebookAsync(newNotebookName); await operation.WaitForCompletionResponseAsync(); }
public async ValueTask DisposeAsync() { NotebookDeleteNotebookOperation operation = await _client.StartDeleteNotebookAsync(Name); await operation.WaitForCompletionResponseAsync(); }