зеркало из https://github.com/Azure/AzureDSVM.git
Merge branch 'master' of github.com:Azure/AzureDSR
This commit is contained in:
Коммит
e8d0ab0452
8
Makefile
8
Makefile
|
@ -9,5 +9,11 @@ include r.mk
|
|||
|
||||
include git.mk
|
||||
|
||||
# Cleanup
|
||||
# Utilities
|
||||
|
||||
deploy: scripts
|
||||
(cd vignettes; Rscript DeployDSVM.R)
|
||||
|
||||
delete: scripts
|
||||
(cd vignettes; Rscript DeleteRG.R)
|
||||
|
||||
|
|
4
r.mk
4
r.mk
|
@ -20,8 +20,8 @@ build:
|
|||
install: build
|
||||
R CMD INSTALL $(PKG)_$(VER).tar.gz
|
||||
|
||||
.PHONY: vignettes
|
||||
vignettes: $(VR)
|
||||
.PHONY: scripts
|
||||
scripts: $(VR)
|
||||
|
||||
# Cleanup
|
||||
|
||||
|
|
|
@ -14,6 +14,20 @@ cease.
|
|||
This script is best run interactively to review its operation and to
|
||||
ensure that the interaction with Azure completes.
|
||||
|
||||
A common use case is for a Data Scientist to create their R programs
|
||||
to analyse a dataset on their local compute platform (e.g., a laptop
|
||||
with 6GB RAM running Ubuntu with R installed). Development is
|
||||
performed with a subset of the full dataset (a random sample) that
|
||||
will not exceed the available memory and will return results
|
||||
quickly. When the experimental setup is complete the script can be
|
||||
sent across to a considerably more capable compute engine on Azure,
|
||||
possibly a cluster of servers to build models in parallel.
|
||||
|
||||
This tutorial will deploy several Linux Data Science Virtual Machines
|
||||
(DSVMs), distribute a copmute task over those servers, colelct the
|
||||
results and generate a report, and then delete the compute
|
||||
resources.
|
||||
|
||||
# Setup
|
||||
|
||||
To get started load our Azure credentials as well as the user's ssh
|
||||
|
|
|
@ -0,0 +1,113 @@
|
|||
---
|
||||
title = "Using Azure Data Science Resources: Delete a Resource Group"
|
||||
author= "Graham Williams"
|
||||
---
|
||||
|
||||
# Use Case
|
||||
|
||||
A sample deployment of a Linux Data Science Virtual Machine (DSVM) is
|
||||
presented in the
|
||||
[AzureDSR's Deploy DSMV](https://github.com/Azure/AzureDSR/blob/master/vignettes/DeployDSVM.Rmd)
|
||||
document. All of the resources (the virtual machine, public IP
|
||||
address, network interface, storage account, network security group,
|
||||
and virtual network) will be hosted within a single resource
|
||||
group. Thus it is convenient to simply delete the resource group to
|
||||
remove the deployment of the DSVM.
|
||||
|
||||
This script can be run after the
|
||||
[AzureDSR's Deploy DSMV](https://github.com/Azure/AzureDSR/blob/master/vignettes/DeployDSVM.Rmd)
|
||||
script to delete all resources created in that script.
|
||||
|
||||
# Preparation
|
||||
|
||||
We assume the user already has an Azure subscription and we have
|
||||
obtained the credentials required. See
|
||||
[AzureSMR's Authentication Guide](https://github.com/Microsoft/AzureSMR/blob/master/vignettes/Authentication.Rmd)
|
||||
for details. We will then ensure the resource group exists and then
|
||||
delete it.
|
||||
|
||||
# Setup
|
||||
|
||||
To get started we need to load our Azure credentials.
|
||||
|
||||
```{r credentials, eval=FALSE}
|
||||
# Credentials come from app creation in Active Directory within Azure.
|
||||
|
||||
TID <- "72f9....db47" # Tenant ID
|
||||
CID <- "9c52....074a" # Client ID
|
||||
KEY <- "9Efb....4nwV....ASa8=" # User key
|
||||
|
||||
```
|
||||
|
||||
We might be able to load such information from the file
|
||||
<USER>_credentials.R where <USER> is replaced with your username.
|
||||
|
||||
```{r setup}
|
||||
# Load the required subscription resources: TID, CID, and KEY.
|
||||
|
||||
USER <- Sys.getenv("USER")
|
||||
|
||||
source(paste0(USER, "_credentials.R"))
|
||||
|
||||
# Install the packages if required.
|
||||
|
||||
## devtools::install_github("Microsoft/AzureSMR")
|
||||
## devtools::install_github("Azure/AzureDSR", auth_token=GIT_TOKEN)
|
||||
```
|
||||
|
||||
```{r packages}
|
||||
# Load the required packages.
|
||||
|
||||
library(AzureSMR) # Support for managing Azure resources.
|
||||
library(AzureDSR) # Further support for the Data Scientist.
|
||||
library(magrittr)
|
||||
library(dplyr)
|
||||
```
|
||||
|
||||
```{r tuning}
|
||||
# Parameters for this script: the name for the new resource group and
|
||||
# its location across the Azure cloud. The resource name is used to
|
||||
# name the resource group that we will create transiently for the
|
||||
# purposes of this script.
|
||||
|
||||
RG <- "my_dsvm_rg_sea" # The resource group to be deleted.
|
||||
```
|
||||
|
||||
```{r connect}
|
||||
# Connect to the Azure subscription and use this as the context for
|
||||
# our activities.
|
||||
|
||||
context <- createAzureContext(tenantID=TID, clientID=CID, authKey=KEY)
|
||||
|
||||
# Check if the resource group already exists. Take note this script
|
||||
# will not remove the resource group if it pre-existed.
|
||||
|
||||
context %>%
|
||||
azureListRG() %>%
|
||||
filter(name == RG) %>%
|
||||
select(name, location) %T>%
|
||||
print() %>%
|
||||
nrow() %>%
|
||||
equals(0) %>%
|
||||
not() %T>%
|
||||
print() ->
|
||||
rg_pre_exists
|
||||
```
|
||||
|
||||
# Delete the Resource Group
|
||||
|
||||
Delete the resource group within which all resources were created.
|
||||
|
||||
```{r create resource group}
|
||||
if (rg_pre_exists)
|
||||
{
|
||||
# Delete the resource group RG.
|
||||
|
||||
# Note that to delete a resource group can take some time, like 10 minutes.
|
||||
|
||||
azureDeleteResourceGroup(context, RG)
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
Once deleted we are consuming no more.
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
title = "Using Azure Data Science Resources: Connect to Linux DSVM Quick Start"
|
||||
title = "Using Azure Data Science Resources: Deploy Linux DSVM"
|
||||
author= "Graham Williams"
|
||||
---
|
||||
|
||||
|
@ -11,7 +11,9 @@ not run to then delete the resource group if the resources are no
|
|||
longer required. Once deleted consumption will cease.
|
||||
|
||||
This script is best run interactively to review its operation and to
|
||||
ensure that the interaction with Azure completes.
|
||||
ensure that the interaction with Azure completes. As a standalone
|
||||
script it can be run to setup a new resource group and single Linux
|
||||
DSVM.
|
||||
|
||||
# Preparation
|
||||
|
||||
|
@ -69,7 +71,6 @@ library(AzureSMR) # Support for managing Azure resources.
|
|||
library(AzureDSR) # Further support for the Data Scientist.
|
||||
library(magrittr)
|
||||
library(dplyr)
|
||||
library(rattle) # Use weatherAUS as a "large" dataset.
|
||||
```
|
||||
|
||||
```{r tuning}
|
Загрузка…
Ссылка в новой задаче