From 8e57dfae3248e8e49131735a3eeadb2694726914 Mon Sep 17 00:00:00 2001 From: Bharath Sankaranarayan Date: Sat, 16 Feb 2019 20:57:03 -0800 Subject: [PATCH 1/4] removed under samples and moved under features --- samples/app-deploy/README.md | 28 --- samples/app-deploy/RollDice/roll-dice.R | 23 --- samples/app-deploy/RollDice/spec.yaml | 11 -- samples/app-deploy/SSIS/Project.params | 2 - samples/app-deploy/SSIS/README.md | 35 ---- samples/app-deploy/SSIS/back-up-db.database | 13 -- samples/app-deploy/SSIS/back-up-db.dtproj | 173 ------------------- samples/app-deploy/SSIS/back-up-db.dtsx | 118 ------------- samples/app-deploy/SSIS/back-up-db.sln | 27 --- samples/app-deploy/SSIS/spec.yaml | 6 - samples/app-deploy/addpy/add.py | 4 - samples/app-deploy/addpy/addpy-run-spec.yaml | 5 - samples/app-deploy/addpy/spec.yaml | 12 -- samples/app-deploy/hello-mleap/README.md | 34 ---- samples/app-deploy/hello-mleap/frame.json | 45 ----- samples/app-deploy/hello-mleap/run-spec.yaml | 3 - samples/app-deploy/hello-mleap/spec.yaml | 6 - samples/app-deploy/magic8ball/magic8ball.py | 41 ----- samples/app-deploy/magic8ball/spec.yaml | 11 -- samples/app-deploy/sumofsq/spec.yaml | 13 -- samples/app-deploy/sumofsq/sum_of_squares.R | 4 - 21 files changed, 614 deletions(-) delete mode 100644 samples/app-deploy/README.md delete mode 100644 samples/app-deploy/RollDice/roll-dice.R delete mode 100644 samples/app-deploy/RollDice/spec.yaml delete mode 100644 samples/app-deploy/SSIS/Project.params delete mode 100644 samples/app-deploy/SSIS/README.md delete mode 100644 samples/app-deploy/SSIS/back-up-db.database delete mode 100644 samples/app-deploy/SSIS/back-up-db.dtproj delete mode 100644 samples/app-deploy/SSIS/back-up-db.dtsx delete mode 100644 samples/app-deploy/SSIS/back-up-db.sln delete mode 100644 samples/app-deploy/SSIS/spec.yaml delete mode 100644 samples/app-deploy/addpy/add.py delete mode 100644 samples/app-deploy/addpy/addpy-run-spec.yaml delete mode 100644 samples/app-deploy/addpy/spec.yaml delete mode 100644 samples/app-deploy/hello-mleap/README.md delete mode 100644 samples/app-deploy/hello-mleap/frame.json delete mode 100644 samples/app-deploy/hello-mleap/run-spec.yaml delete mode 100644 samples/app-deploy/hello-mleap/spec.yaml delete mode 100644 samples/app-deploy/magic8ball/magic8ball.py delete mode 100644 samples/app-deploy/magic8ball/spec.yaml delete mode 100644 samples/app-deploy/sumofsq/spec.yaml delete mode 100644 samples/app-deploy/sumofsq/sum_of_squares.R diff --git a/samples/app-deploy/README.md b/samples/app-deploy/README.md deleted file mode 100644 index 709cb167..00000000 --- a/samples/app-deploy/README.md +++ /dev/null @@ -1,28 +0,0 @@ -# App deploy Samples CTP 2.3 -## Samples on how to deploy SQL Sever Big Data Cluster - - -## Python -These sample demonstrates how you can deploy a simple Python app into SQL Server Big Data Cluster as container app as web service that is swagger compliant for building your application. -__[addpy](addpy/)__ - -__[magic8ball](magic8ball/)__ - - -## R -These sample demonstrates how you can deploy a simple R app into SQL Server Big Data Cluster as container app as web service that is swagger compliant for building your application. - -__[RollDice](RollDice/)__ - -This sample demonstrates the use of data framess - -## MLeap -__[hello-mleap](hello-mleap/)__ - -This sample demonstrates how you use a MLeap bundle ( a Spark model serialized in this format) and run it outside of Spark. The sample is based on the MLeap sample availble here http://mleap-docs.combust.ml/mleap-serving/. We are using the MLeap Serving container that is published in docker hub. The MLeap Serving is deployed as container in SQL Server Big Data Cluster as container app as web service that takes the Leap Frame as the input. - - -## Sql Server Integration Services -__[SSIS](SSIS/)__ - -This sample demonstrates how you run SSIS application as a containerized application levering the cron capability in Kubernets. This example takes Data Transformation Services Package File Format (DTSX) developed using Visual Studio that takes a database backup and copies it over to the SQL Server instance for restoring. This will run as a cron job pushing the backups every minute. Please follow the README.md for detailed instructions. \ No newline at end of file diff --git a/samples/app-deploy/RollDice/roll-dice.R b/samples/app-deploy/RollDice/roll-dice.R deleted file mode 100644 index f0e2002c..00000000 --- a/samples/app-deploy/RollDice/roll-dice.R +++ /dev/null @@ -1,23 +0,0 @@ -##################################################### -##################################################### -## -## Roll dice demo -## -## -##################################################### -##################################################### -#install.packages("TeachingDemos") - -rollEm <- function(numDice = 2) -{ -list.of.packages <- c("TeachingDemos") -new.packages <- list.of.packages[!(list.of.packages %in% installed.packages()[,"Package"])] -if(length(new.packages)) install.packages(new.packages) - library(TeachingDemos) - - r<-dice(ndice = numDice) - return(as.data.frame(r)) -} - -result<-rollEm(x) - diff --git a/samples/app-deploy/RollDice/spec.yaml b/samples/app-deploy/RollDice/spec.yaml deleted file mode 100644 index d3036184..00000000 --- a/samples/app-deploy/RollDice/spec.yaml +++ /dev/null @@ -1,11 +0,0 @@ -name: roll-dice -version: v2 -runtime: R -src: ./roll-dice.R -entrypoint: rollEm -replicas: 1 -poolsize: 1 -inputs: - x: integer -output: - result: data.frame diff --git a/samples/app-deploy/SSIS/Project.params b/samples/app-deploy/SSIS/Project.params deleted file mode 100644 index 680ffe30..00000000 --- a/samples/app-deploy/SSIS/Project.params +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/samples/app-deploy/SSIS/README.md b/samples/app-deploy/SSIS/README.md deleted file mode 100644 index 2398e71a..00000000 --- a/samples/app-deploy/SSIS/README.md +++ /dev/null @@ -1,35 +0,0 @@ -## About -This is a sample SSIS app, which is a cronjob backing up the `DWConfiguration` database on the Master SQL Instance on disk every minute. - -See [CLI.md](../CLI.md) for instructions on setting up the mssqlctl CLI and connecting to a Aris cluster. - -To see the `back-up-db.dtsx` under the `back-up-db.sln`, Install Visual Studio 2017 if you don't have it already. Download and install [SSDT](https://docs.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt?view=sql-server-2017#ssdt-for-vs-2017-standalone-installer). -When you open the `back-up-db.sln`, the decryption password can be found in the spec.yaml, i.e. the value after "/De ". - -Install [SSMS](https://docs.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms?view=sql-server-2017) if not already. - -## How to run - -Create the app: -```bash -# drop back-up-db.dtsx and spec.yaml in a folder, e.g. name back-up-db -# edit back-up-db.dtsx, replace the value after "Data Source" in the connection string to "service-master-pool;" if not alread. Then deploy it by: -mssqlctl app create --spec ./back-up-db -``` - -Check the job: -```bash -watch kubectl -n test get job -``` - -Once it has completed at least one backup, go to SMSS and restore to see the backup files: - -`Right click on database DWConfiguration -> Tasks -> Restore -> Database... -> Select "Device" as Source -> Click on "..." -> Add` - -Clean up: -```bash -# delete app -mssqlctl app delete --name back-up-db --version v1 -# delete backup files -kubectl -n test exec -it mssql-master-pool-0 -c mssql-server -- /bin/bash -c "rm /var/opt/mssql/data/DWConfiguration_backup*.bak" -``` \ No newline at end of file diff --git a/samples/app-deploy/SSIS/back-up-db.database b/samples/app-deploy/SSIS/back-up-db.database deleted file mode 100644 index 0db07553..00000000 --- a/samples/app-deploy/SSIS/back-up-db.database +++ /dev/null @@ -1,13 +0,0 @@ - - back-up-db - back-up-db - 0001-01-01T00:00:00Z - 0001-01-01T00:00:00Z - 0001-01-01T00:00:00Z - Unprocessed - 0001-01-01T00:00:00Z - - Default - Unchanged - - \ No newline at end of file diff --git a/samples/app-deploy/SSIS/back-up-db.dtproj b/samples/app-deploy/SSIS/back-up-db.dtproj deleted file mode 100644 index c7606fa4..00000000 --- a/samples/app-deploy/SSIS/back-up-db.dtproj +++ /dev/null @@ -1,173 +0,0 @@ - - - Project - 15.0.900.40 - 9.0.1.0 - $base64$PFNvdXJjZUNvbnRyb2xJbmZvIHhtbG5zOnhzZD0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhtbG5zOmRkbDI9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDAzL2VuZ2luZS8yIiB4bWxuczpkZGwyXzI9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDAzL2VuZ2luZS8yLzIiIHhtbG5zOmRkbDEwMF8xMDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDA4L2VuZ2luZS8xMDAvMTAwIiB4bWxuczpkZGwyMDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDEwL2VuZ2luZS8yMDAiIHhtbG5zOmRkbDIwMF8yMDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDEwL2VuZ2luZS8yMDAvMjAwIiB4bWxuczpkZGwzMDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDExL2VuZ2luZS8zMDAiIHhtbG5zOmRkbDMwMF8zMDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDExL2VuZ2luZS8zMDAvMzAwIiB4bWxuczpkZGw0MDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDEyL2VuZ2luZS80MDAiIHhtbG5zOmRkbDQwMF80MDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDEyL2VuZ2luZS80MDAvNDAwIiB4bWxuczpkZGw1MDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDEzL2VuZ2luZS81MDAiIHhtbG5zOmRkbDUwMF81MDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDEzL2VuZ2luZS81MDAvNTAwIiB4bWxuczpkd2Q9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vRGF0YVdhcmVob3VzZS9EZXNpZ25lci8xLjAiPg0KICA8RW5hYmxlZD5mYWxzZTwvRW5hYmxlZD4NCiAgPFByb2plY3ROYW1lPjwvUHJvamVjdE5hbWU+DQogIDxBdXhQYXRoPjwvQXV4UGF0aD4NCiAgPExvY2FsUGF0aD48L0xvY2FsUGF0aD4NCiAgPFByb3ZpZGVyPjwvUHJvdmlkZXI+DQo8L1NvdXJjZUNvbnRyb2xJbmZvPg== - - back-up-db.database - back-up-db.database - - - - - - - - {e8c9e0b8-0df2-4ad1-b709-f1b7f6566275} - back-up-db - 0 - 0 - 0 - - - 2019-01-28T13:54:48.9995603-08:00 - DOMAIN\user - COMPUTER - - - PE7eur2J7Bo2pRBj7bZsUgIqFCNetfQI6OFvBo1tHLrxPBMlSyKaAnn3nhYJuaCQZWmRZkL8oW/7cbSr4t47SOUkVLFAxgeYf5ePpWQAOhIW5cx7kjkRHQpowxeKHo646oc8zIGTQxYbg7vF0D55RhzVhGLJHkq/ZscOuP7OX0Q7K9eGTNbDOUZ1oYQHkhK+ - 1 - - - - - - - - - - - {3A21CCD6-3D10-450F-8A17-D4AFE4A7EC93} - back-up-db - 1 - 0 - 16 - - - {CF860C75-D034-4DCF-BDBA-64DF44015B64} - 8 - - - 2 - - - - - - - - - - - 0 - 0 - 0 - Data Source=52.160.42.32,31433;User ID=sa;Initial Catalog=master;Connect Timeout=30;Application Name=SSIS-back-up-db-{B8154932-D688-4129-8CFA-17D9ED72CBAE}MasterSQL; - 18 - - - - - - - - - - - 0 - 0 - 0 - master - 18 - - - - - - - - - - - 0 - 0 - 1 - 18 - - - - - - - - - - - 0 - 0 - 0 - false - 3 - - - - - - - - - - - 0 - 0 - 0 - 52.160.42.32,31433 - 18 - - - - - - - - - - - 0 - 0 - 0 - sa - 18 - - - - - - - - - - - - - - Development - - bin - - - - - SQLServer2017 - - - LastModifiedTime - LastModifiedTime - 2019-01-28T22:16:09.8475842Z - - - - - - \ No newline at end of file diff --git a/samples/app-deploy/SSIS/back-up-db.dtsx b/samples/app-deploy/SSIS/back-up-db.dtsx deleted file mode 100644 index 14a2e28c..00000000 --- a/samples/app-deploy/SSIS/back-up-db.dtsx +++ /dev/null @@ -1,118 +0,0 @@ - - - 8 - - - - - - - - JehPjO2CpRYmMlmsO3zauyEGuMWFLjkOYrRfKQu0WpM8Mk2QzgPdOTKbAr3SGg4HN5djflNMUnktgqJgMwk5ri2eVyJ+L1sI18fxwibB3ZjyWOf9CWlLkFbBBegedxT+81UkdEDvsiCty3JK5jfI3mqcAXOxeTekTB9XuUZx5//tCUSJA9zCg29hNOtb4cGF - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -]]> - \ No newline at end of file diff --git a/samples/app-deploy/SSIS/back-up-db.sln b/samples/app-deploy/SSIS/back-up-db.sln deleted file mode 100644 index 743e4887..00000000 --- a/samples/app-deploy/SSIS/back-up-db.sln +++ /dev/null @@ -1,27 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.28307.329 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{159641D6-6404-4A2A-AE62-294DE0FE8301}") = "back-up-db", "back-up-db.dtproj", "{F5381D16-8187-42A1-9F13-A8D185013381}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{51125990-A018-4605-BA60-441B3A787A2F}" - ProjectSection(SolutionItems) = preProject - spec.yaml = spec.yaml - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Development|Default = Development|Default - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {F5381D16-8187-42A1-9F13-A8D185013381}.Development|Default.ActiveCfg = Development - {F5381D16-8187-42A1-9F13-A8D185013381}.Development|Default.Build.0 = Development - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {52FC42C3-3F4A-4EFD-B15B-5DE3F6BD857B} - EndGlobalSection -EndGlobal diff --git a/samples/app-deploy/SSIS/spec.yaml b/samples/app-deploy/SSIS/spec.yaml deleted file mode 100644 index 88c12847..00000000 --- a/samples/app-deploy/SSIS/spec.yaml +++ /dev/null @@ -1,6 +0,0 @@ -name: back-up-db -version: v1 -runtime: SSIS -entrypoint: ./back-up-db.dtsx -options: /REP V /De testing -schedule: "*/1 * * * *" diff --git a/samples/app-deploy/addpy/add.py b/samples/app-deploy/addpy/add.py deleted file mode 100644 index 284c999b..00000000 --- a/samples/app-deploy/addpy/add.py +++ /dev/null @@ -1,4 +0,0 @@ -def add(x,y): - result = x+y - return result; -result=add(x,y) diff --git a/samples/app-deploy/addpy/addpy-run-spec.yaml b/samples/app-deploy/addpy/addpy-run-spec.yaml deleted file mode 100644 index 6787c5c7..00000000 --- a/samples/app-deploy/addpy/addpy-run-spec.yaml +++ /dev/null @@ -1,5 +0,0 @@ -name: addpy -version: v1 -inputs: - x: 10 - y: 10 diff --git a/samples/app-deploy/addpy/spec.yaml b/samples/app-deploy/addpy/spec.yaml deleted file mode 100644 index 13e59fc9..00000000 --- a/samples/app-deploy/addpy/spec.yaml +++ /dev/null @@ -1,12 +0,0 @@ -name: addpy -version: v2 -runtime: Python -src: ./add.py -entrypoint: add -replicas: 1 -poolsize: 1 -inputs: - x: int - y: int -output: - result: int diff --git a/samples/app-deploy/hello-mleap/README.md b/samples/app-deploy/hello-mleap/README.md deleted file mode 100644 index fef5b7a0..00000000 --- a/samples/app-deploy/hello-mleap/README.md +++ /dev/null @@ -1,34 +0,0 @@ - -# Application `hello-mleap/v1` - -> Generated by: `mssqlctl` - -## Deploy Application - -```bash -> mssqlctl login --entrypoint http://host:port --u --p -> mssqlctl app create --spec ./hello-mleap -``` - -## Consume Application - -```bash -> mssqlctl app run --name hello-mleap --version v1 --inputs leap-frame=@ -``` - -## Application `spec.yaml` - -All your apps should be specified in a YAML file like this - it tells the CLI -what to deploy onto your cluster: - -```yaml -name: hello-mleap -version: v1 -runtime: Mleap -bundleFileName: model.lr.zip -replicas: 2 -poolsize: 2 -``` - -You can use this generated `/hello-mleap/spec.yaml` as a starting point to modify the -application as you see fit. diff --git a/samples/app-deploy/hello-mleap/frame.json b/samples/app-deploy/hello-mleap/frame.json deleted file mode 100644 index 3accc051..00000000 --- a/samples/app-deploy/hello-mleap/frame.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "schema": { - "fields": [{ - "name": "state", - "type": "string" - }, { - "name": "bathrooms", - "type": "double" - }, { - "name": "square_feet", - "type": "double" - }, { - "name": "bedrooms", - "type": "double" - }, { - "name": "security_deposit", - "type": "double" - }, { - "name": "cleaning_fee", - "type": "double" - }, { - "name": "extra_people", - "type": "double" - }, { - "name": "number_of_reviews", - "type": "double" - }, { - "name": "review_scores_rating", - "type": "double" - }, { - "name": "room_type", - "type": "string" - }, { - "name": "host_is_superhost", - "type": "string" - }, { - "name": "cancellation_policy", - "type": "string" - }, { - "name": "instant_bookable", - "type": "string" - }] - }, - "rows": [["NY", 2.0, 1250.0, 3.0, 50.0, 30.0, 2.0, 56.0, 90.0, "Entire home/apt", "1.0", "strict", "1.0"]] -} diff --git a/samples/app-deploy/hello-mleap/run-spec.yaml b/samples/app-deploy/hello-mleap/run-spec.yaml deleted file mode 100644 index 9263fdf6..00000000 --- a/samples/app-deploy/hello-mleap/run-spec.yaml +++ /dev/null @@ -1,3 +0,0 @@ -name: hello-mleap -version: v1 -inputs: ./frame.json \ No newline at end of file diff --git a/samples/app-deploy/hello-mleap/spec.yaml b/samples/app-deploy/hello-mleap/spec.yaml deleted file mode 100644 index be88007e..00000000 --- a/samples/app-deploy/hello-mleap/spec.yaml +++ /dev/null @@ -1,6 +0,0 @@ -name: hello-mleap1 -version: v1 -runtime: Mleap -bundleFileName: model.lr.zip -replicas: 2 -poolsize: 2 diff --git a/samples/app-deploy/magic8ball/magic8ball.py b/samples/app-deploy/magic8ball/magic8ball.py deleted file mode 100644 index 31aa2f02..00000000 --- a/samples/app-deploy/magic8ball/magic8ball.py +++ /dev/null @@ -1,41 +0,0 @@ -#This is a sample Python Script for an implementation for magic8ball -# how to run this - mssqlctl-pre app create -n magic8 -v v2 --code magic8ball.py --runtime Python --inputs quizme=str --outputs result=str - -import sys -import random -def magic8ball(txt): - question = txt - #print (input) - answers = random.randint(1,8) - msg="" - if question == "": - sys.exit() - - elif answers == 1: - msg="It is certain" - - elif answers == 2: - msg="Outlook good" - - elif answers == 3: - msg="You may rely on it" - - elif answers == 4: - msg="Ask again later" - - elif answers == 5: - msg="Concentrate and ask again" - - elif answers == 6: - msg="Reply hazy, try again" - - elif answers == 7: - msg="My reply is no" - - elif answers == 8: - msg="My sources say no" - - return msg -#quizme="SQL Server Big Data Cluster is awesome" - -result =magic8ball(txt) diff --git a/samples/app-deploy/magic8ball/spec.yaml b/samples/app-deploy/magic8ball/spec.yaml deleted file mode 100644 index 4bee4094..00000000 --- a/samples/app-deploy/magic8ball/spec.yaml +++ /dev/null @@ -1,11 +0,0 @@ -name: magic8ball -version: v2 -runtime: Python -src: ./magic8ball.py -entrypoint: magic8ball -replicas: 1 -poolsize: 1 -inputs: - txt: str -output: - result: str diff --git a/samples/app-deploy/sumofsq/spec.yaml b/samples/app-deploy/sumofsq/spec.yaml deleted file mode 100644 index 558220c1..00000000 --- a/samples/app-deploy/sumofsq/spec.yaml +++ /dev/null @@ -1,13 +0,0 @@ -name: sum-of-sq -version: v1 -runtime: R -src: ./sum_of_squares.R -entrypoint: sofsq -replicas: 1 -poolsize: 1 -inputs: - a: integer - b: integer -output: - result: integer - diff --git a/samples/app-deploy/sumofsq/sum_of_squares.R b/samples/app-deploy/sumofsq/sum_of_squares.R deleted file mode 100644 index 3caec4a3..00000000 --- a/samples/app-deploy/sumofsq/sum_of_squares.R +++ /dev/null @@ -1,4 +0,0 @@ -sofsq <- function(a,b) { - a^2 + b^2 -} -result <- sofsq (a,b) From f1d80706a0f91d65edff2d605ca79bd5f57a397b Mon Sep 17 00:00:00 2001 From: Bharath Sankaranarayan Date: Sat, 16 Feb 2019 22:06:17 -0800 Subject: [PATCH 2/4] removed Readme.md --- samples/app-deploy/README.md | 33 --------------------------------- 1 file changed, 33 deletions(-) delete mode 100644 samples/app-deploy/README.md diff --git a/samples/app-deploy/README.md b/samples/app-deploy/README.md deleted file mode 100644 index 61b231c6..00000000 --- a/samples/app-deploy/README.md +++ /dev/null @@ -1,33 +0,0 @@ -# Samples on how to deploy apps on SQL Sever Big Data Cluster - - -## Python -These sample demonstrates how you can deploy a simple Python app into SQL Server Big Data Cluster as container app as web service that is swagger compliant for building your application. - -__[addpy](addpy/)__ - -This sample demonstrates how to deploy a Python script that takes integers as input and outputs an integer. - -__[magic8ball](magic8ball/)__ - -This sample demonstrates how to deploy a Python script that takes a string as input and outputs a string. - - - -## R -These sample demonstrates how you can deploy a simple R app into SQL Server Big Data Cluster as container app as web service that is swagger compliant for building your application. - -__[RollDice](RollDice/)__ - -This sample demonstrates the use of data framess - -## MLeap -__[hello-mleap](hello-mleap/)__ - -This sample demonstrates how you use a MLeap bundle ( a Spark model serialized in this format) and run it outside of Spark. The sample is based on the MLeap sample availble here http://mleap-docs.combust.ml/mleap-serving/. We are using the MLeap Serving container that is published in docker hub. The MLeap Serving is deployed as container in SQL Server Big Data Cluster as container app as web service that takes the Leap Frame as the input. - - -## Sql Server Integration Services -__[SSIS](SSIS/)__ - -This sample demonstrates SSIS application can be run as a containerized application and use the cron capability in Kubernets as a scheduler. This example takes Data Transformation Services Package File Format (DTSX) developed using Visual Studio that takes a database backup and copies it over to the SQL Server instance for restoring. This will run as a cron job pushing the backups every minute. Please follow the README.md for detailed instructions. From f7970723891c0edd3d990e4421082f3abcdc556c Mon Sep 17 00:00:00 2001 From: Bharath Sankaranarayan Date: Sat, 16 Feb 2019 22:08:27 -0800 Subject: [PATCH 3/4] restore deleted files --- samples/app-deploy/README.md | 33 ++++ samples/app-deploy/RollDice/roll-dice.R | 23 +++ samples/app-deploy/RollDice/spec.yaml | 11 ++ samples/app-deploy/SSIS/Project.params | 2 + samples/app-deploy/SSIS/README.md | 35 ++++ samples/app-deploy/SSIS/back-up-db.database | 13 ++ samples/app-deploy/SSIS/back-up-db.dtproj | 173 +++++++++++++++++++ samples/app-deploy/SSIS/back-up-db.dtsx | 118 +++++++++++++ samples/app-deploy/SSIS/back-up-db.sln | 27 +++ samples/app-deploy/SSIS/spec.yaml | 6 + samples/app-deploy/addpy/add.py | 4 + samples/app-deploy/addpy/addpy-run-spec.yaml | 5 + samples/app-deploy/addpy/spec.yaml | 12 ++ samples/app-deploy/hello-mleap/README.md | 34 ++++ samples/app-deploy/hello-mleap/frame.json | 45 +++++ samples/app-deploy/hello-mleap/run-spec.yaml | 3 + samples/app-deploy/hello-mleap/spec.yaml | 6 + samples/app-deploy/magic8ball/magic8ball.py | 41 +++++ samples/app-deploy/magic8ball/spec.yaml | 11 ++ samples/app-deploy/sumofsq/spec.yaml | 13 ++ samples/app-deploy/sumofsq/sum_of_squares.R | 4 + 21 files changed, 619 insertions(+) create mode 100644 samples/app-deploy/README.md create mode 100644 samples/app-deploy/RollDice/roll-dice.R create mode 100644 samples/app-deploy/RollDice/spec.yaml create mode 100644 samples/app-deploy/SSIS/Project.params create mode 100644 samples/app-deploy/SSIS/README.md create mode 100644 samples/app-deploy/SSIS/back-up-db.database create mode 100644 samples/app-deploy/SSIS/back-up-db.dtproj create mode 100644 samples/app-deploy/SSIS/back-up-db.dtsx create mode 100644 samples/app-deploy/SSIS/back-up-db.sln create mode 100644 samples/app-deploy/SSIS/spec.yaml create mode 100644 samples/app-deploy/addpy/add.py create mode 100644 samples/app-deploy/addpy/addpy-run-spec.yaml create mode 100644 samples/app-deploy/addpy/spec.yaml create mode 100644 samples/app-deploy/hello-mleap/README.md create mode 100644 samples/app-deploy/hello-mleap/frame.json create mode 100644 samples/app-deploy/hello-mleap/run-spec.yaml create mode 100644 samples/app-deploy/hello-mleap/spec.yaml create mode 100644 samples/app-deploy/magic8ball/magic8ball.py create mode 100644 samples/app-deploy/magic8ball/spec.yaml create mode 100644 samples/app-deploy/sumofsq/spec.yaml create mode 100644 samples/app-deploy/sumofsq/sum_of_squares.R diff --git a/samples/app-deploy/README.md b/samples/app-deploy/README.md new file mode 100644 index 00000000..61b231c6 --- /dev/null +++ b/samples/app-deploy/README.md @@ -0,0 +1,33 @@ +# Samples on how to deploy apps on SQL Sever Big Data Cluster + + +## Python +These sample demonstrates how you can deploy a simple Python app into SQL Server Big Data Cluster as container app as web service that is swagger compliant for building your application. + +__[addpy](addpy/)__ + +This sample demonstrates how to deploy a Python script that takes integers as input and outputs an integer. + +__[magic8ball](magic8ball/)__ + +This sample demonstrates how to deploy a Python script that takes a string as input and outputs a string. + + + +## R +These sample demonstrates how you can deploy a simple R app into SQL Server Big Data Cluster as container app as web service that is swagger compliant for building your application. + +__[RollDice](RollDice/)__ + +This sample demonstrates the use of data framess + +## MLeap +__[hello-mleap](hello-mleap/)__ + +This sample demonstrates how you use a MLeap bundle ( a Spark model serialized in this format) and run it outside of Spark. The sample is based on the MLeap sample availble here http://mleap-docs.combust.ml/mleap-serving/. We are using the MLeap Serving container that is published in docker hub. The MLeap Serving is deployed as container in SQL Server Big Data Cluster as container app as web service that takes the Leap Frame as the input. + + +## Sql Server Integration Services +__[SSIS](SSIS/)__ + +This sample demonstrates SSIS application can be run as a containerized application and use the cron capability in Kubernets as a scheduler. This example takes Data Transformation Services Package File Format (DTSX) developed using Visual Studio that takes a database backup and copies it over to the SQL Server instance for restoring. This will run as a cron job pushing the backups every minute. Please follow the README.md for detailed instructions. diff --git a/samples/app-deploy/RollDice/roll-dice.R b/samples/app-deploy/RollDice/roll-dice.R new file mode 100644 index 00000000..f0e2002c --- /dev/null +++ b/samples/app-deploy/RollDice/roll-dice.R @@ -0,0 +1,23 @@ +##################################################### +##################################################### +## +## Roll dice demo +## +## +##################################################### +##################################################### +#install.packages("TeachingDemos") + +rollEm <- function(numDice = 2) +{ +list.of.packages <- c("TeachingDemos") +new.packages <- list.of.packages[!(list.of.packages %in% installed.packages()[,"Package"])] +if(length(new.packages)) install.packages(new.packages) + library(TeachingDemos) + + r<-dice(ndice = numDice) + return(as.data.frame(r)) +} + +result<-rollEm(x) + diff --git a/samples/app-deploy/RollDice/spec.yaml b/samples/app-deploy/RollDice/spec.yaml new file mode 100644 index 00000000..d3036184 --- /dev/null +++ b/samples/app-deploy/RollDice/spec.yaml @@ -0,0 +1,11 @@ +name: roll-dice +version: v2 +runtime: R +src: ./roll-dice.R +entrypoint: rollEm +replicas: 1 +poolsize: 1 +inputs: + x: integer +output: + result: data.frame diff --git a/samples/app-deploy/SSIS/Project.params b/samples/app-deploy/SSIS/Project.params new file mode 100644 index 00000000..680ffe30 --- /dev/null +++ b/samples/app-deploy/SSIS/Project.params @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/samples/app-deploy/SSIS/README.md b/samples/app-deploy/SSIS/README.md new file mode 100644 index 00000000..2398e71a --- /dev/null +++ b/samples/app-deploy/SSIS/README.md @@ -0,0 +1,35 @@ +## About +This is a sample SSIS app, which is a cronjob backing up the `DWConfiguration` database on the Master SQL Instance on disk every minute. + +See [CLI.md](../CLI.md) for instructions on setting up the mssqlctl CLI and connecting to a Aris cluster. + +To see the `back-up-db.dtsx` under the `back-up-db.sln`, Install Visual Studio 2017 if you don't have it already. Download and install [SSDT](https://docs.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt?view=sql-server-2017#ssdt-for-vs-2017-standalone-installer). +When you open the `back-up-db.sln`, the decryption password can be found in the spec.yaml, i.e. the value after "/De ". + +Install [SSMS](https://docs.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms?view=sql-server-2017) if not already. + +## How to run + +Create the app: +```bash +# drop back-up-db.dtsx and spec.yaml in a folder, e.g. name back-up-db +# edit back-up-db.dtsx, replace the value after "Data Source" in the connection string to "service-master-pool;" if not alread. Then deploy it by: +mssqlctl app create --spec ./back-up-db +``` + +Check the job: +```bash +watch kubectl -n test get job +``` + +Once it has completed at least one backup, go to SMSS and restore to see the backup files: + +`Right click on database DWConfiguration -> Tasks -> Restore -> Database... -> Select "Device" as Source -> Click on "..." -> Add` + +Clean up: +```bash +# delete app +mssqlctl app delete --name back-up-db --version v1 +# delete backup files +kubectl -n test exec -it mssql-master-pool-0 -c mssql-server -- /bin/bash -c "rm /var/opt/mssql/data/DWConfiguration_backup*.bak" +``` \ No newline at end of file diff --git a/samples/app-deploy/SSIS/back-up-db.database b/samples/app-deploy/SSIS/back-up-db.database new file mode 100644 index 00000000..0db07553 --- /dev/null +++ b/samples/app-deploy/SSIS/back-up-db.database @@ -0,0 +1,13 @@ + + back-up-db + back-up-db + 0001-01-01T00:00:00Z + 0001-01-01T00:00:00Z + 0001-01-01T00:00:00Z + Unprocessed + 0001-01-01T00:00:00Z + + Default + Unchanged + + \ No newline at end of file diff --git a/samples/app-deploy/SSIS/back-up-db.dtproj b/samples/app-deploy/SSIS/back-up-db.dtproj new file mode 100644 index 00000000..c7606fa4 --- /dev/null +++ b/samples/app-deploy/SSIS/back-up-db.dtproj @@ -0,0 +1,173 @@ + + + Project + 15.0.900.40 + 9.0.1.0 + $base64$PFNvdXJjZUNvbnRyb2xJbmZvIHhtbG5zOnhzZD0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhtbG5zOmRkbDI9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDAzL2VuZ2luZS8yIiB4bWxuczpkZGwyXzI9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDAzL2VuZ2luZS8yLzIiIHhtbG5zOmRkbDEwMF8xMDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDA4L2VuZ2luZS8xMDAvMTAwIiB4bWxuczpkZGwyMDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDEwL2VuZ2luZS8yMDAiIHhtbG5zOmRkbDIwMF8yMDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDEwL2VuZ2luZS8yMDAvMjAwIiB4bWxuczpkZGwzMDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDExL2VuZ2luZS8zMDAiIHhtbG5zOmRkbDMwMF8zMDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDExL2VuZ2luZS8zMDAvMzAwIiB4bWxuczpkZGw0MDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDEyL2VuZ2luZS80MDAiIHhtbG5zOmRkbDQwMF80MDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDEyL2VuZ2luZS80MDAvNDAwIiB4bWxuczpkZGw1MDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDEzL2VuZ2luZS81MDAiIHhtbG5zOmRkbDUwMF81MDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDEzL2VuZ2luZS81MDAvNTAwIiB4bWxuczpkd2Q9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vRGF0YVdhcmVob3VzZS9EZXNpZ25lci8xLjAiPg0KICA8RW5hYmxlZD5mYWxzZTwvRW5hYmxlZD4NCiAgPFByb2plY3ROYW1lPjwvUHJvamVjdE5hbWU+DQogIDxBdXhQYXRoPjwvQXV4UGF0aD4NCiAgPExvY2FsUGF0aD48L0xvY2FsUGF0aD4NCiAgPFByb3ZpZGVyPjwvUHJvdmlkZXI+DQo8L1NvdXJjZUNvbnRyb2xJbmZvPg== + + back-up-db.database + back-up-db.database + + + + + + + + {e8c9e0b8-0df2-4ad1-b709-f1b7f6566275} + back-up-db + 0 + 0 + 0 + + + 2019-01-28T13:54:48.9995603-08:00 + DOMAIN\user + COMPUTER + + + PE7eur2J7Bo2pRBj7bZsUgIqFCNetfQI6OFvBo1tHLrxPBMlSyKaAnn3nhYJuaCQZWmRZkL8oW/7cbSr4t47SOUkVLFAxgeYf5ePpWQAOhIW5cx7kjkRHQpowxeKHo646oc8zIGTQxYbg7vF0D55RhzVhGLJHkq/ZscOuP7OX0Q7K9eGTNbDOUZ1oYQHkhK+ + 1 + + + + + + + + + + + {3A21CCD6-3D10-450F-8A17-D4AFE4A7EC93} + back-up-db + 1 + 0 + 16 + + + {CF860C75-D034-4DCF-BDBA-64DF44015B64} + 8 + + + 2 + + + + + + + + + + + 0 + 0 + 0 + Data Source=52.160.42.32,31433;User ID=sa;Initial Catalog=master;Connect Timeout=30;Application Name=SSIS-back-up-db-{B8154932-D688-4129-8CFA-17D9ED72CBAE}MasterSQL; + 18 + + + + + + + + + + + 0 + 0 + 0 + master + 18 + + + + + + + + + + + 0 + 0 + 1 + 18 + + + + + + + + + + + 0 + 0 + 0 + false + 3 + + + + + + + + + + + 0 + 0 + 0 + 52.160.42.32,31433 + 18 + + + + + + + + + + + 0 + 0 + 0 + sa + 18 + + + + + + + + + + + + + + Development + + bin + + + + + SQLServer2017 + + + LastModifiedTime + LastModifiedTime + 2019-01-28T22:16:09.8475842Z + + + + + + \ No newline at end of file diff --git a/samples/app-deploy/SSIS/back-up-db.dtsx b/samples/app-deploy/SSIS/back-up-db.dtsx new file mode 100644 index 00000000..14a2e28c --- /dev/null +++ b/samples/app-deploy/SSIS/back-up-db.dtsx @@ -0,0 +1,118 @@ + + + 8 + + + + + + + + JehPjO2CpRYmMlmsO3zauyEGuMWFLjkOYrRfKQu0WpM8Mk2QzgPdOTKbAr3SGg4HN5djflNMUnktgqJgMwk5ri2eVyJ+L1sI18fxwibB3ZjyWOf9CWlLkFbBBegedxT+81UkdEDvsiCty3JK5jfI3mqcAXOxeTekTB9XuUZx5//tCUSJA9zCg29hNOtb4cGF + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + \ No newline at end of file diff --git a/samples/app-deploy/SSIS/back-up-db.sln b/samples/app-deploy/SSIS/back-up-db.sln new file mode 100644 index 00000000..743e4887 --- /dev/null +++ b/samples/app-deploy/SSIS/back-up-db.sln @@ -0,0 +1,27 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.329 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{159641D6-6404-4A2A-AE62-294DE0FE8301}") = "back-up-db", "back-up-db.dtproj", "{F5381D16-8187-42A1-9F13-A8D185013381}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{51125990-A018-4605-BA60-441B3A787A2F}" + ProjectSection(SolutionItems) = preProject + spec.yaml = spec.yaml + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Development|Default = Development|Default + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F5381D16-8187-42A1-9F13-A8D185013381}.Development|Default.ActiveCfg = Development + {F5381D16-8187-42A1-9F13-A8D185013381}.Development|Default.Build.0 = Development + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {52FC42C3-3F4A-4EFD-B15B-5DE3F6BD857B} + EndGlobalSection +EndGlobal diff --git a/samples/app-deploy/SSIS/spec.yaml b/samples/app-deploy/SSIS/spec.yaml new file mode 100644 index 00000000..88c12847 --- /dev/null +++ b/samples/app-deploy/SSIS/spec.yaml @@ -0,0 +1,6 @@ +name: back-up-db +version: v1 +runtime: SSIS +entrypoint: ./back-up-db.dtsx +options: /REP V /De testing +schedule: "*/1 * * * *" diff --git a/samples/app-deploy/addpy/add.py b/samples/app-deploy/addpy/add.py new file mode 100644 index 00000000..284c999b --- /dev/null +++ b/samples/app-deploy/addpy/add.py @@ -0,0 +1,4 @@ +def add(x,y): + result = x+y + return result; +result=add(x,y) diff --git a/samples/app-deploy/addpy/addpy-run-spec.yaml b/samples/app-deploy/addpy/addpy-run-spec.yaml new file mode 100644 index 00000000..6787c5c7 --- /dev/null +++ b/samples/app-deploy/addpy/addpy-run-spec.yaml @@ -0,0 +1,5 @@ +name: addpy +version: v1 +inputs: + x: 10 + y: 10 diff --git a/samples/app-deploy/addpy/spec.yaml b/samples/app-deploy/addpy/spec.yaml new file mode 100644 index 00000000..13e59fc9 --- /dev/null +++ b/samples/app-deploy/addpy/spec.yaml @@ -0,0 +1,12 @@ +name: addpy +version: v2 +runtime: Python +src: ./add.py +entrypoint: add +replicas: 1 +poolsize: 1 +inputs: + x: int + y: int +output: + result: int diff --git a/samples/app-deploy/hello-mleap/README.md b/samples/app-deploy/hello-mleap/README.md new file mode 100644 index 00000000..fef5b7a0 --- /dev/null +++ b/samples/app-deploy/hello-mleap/README.md @@ -0,0 +1,34 @@ + +# Application `hello-mleap/v1` + +> Generated by: `mssqlctl` + +## Deploy Application + +```bash +> mssqlctl login --entrypoint http://host:port --u --p +> mssqlctl app create --spec ./hello-mleap +``` + +## Consume Application + +```bash +> mssqlctl app run --name hello-mleap --version v1 --inputs leap-frame=@ +``` + +## Application `spec.yaml` + +All your apps should be specified in a YAML file like this - it tells the CLI +what to deploy onto your cluster: + +```yaml +name: hello-mleap +version: v1 +runtime: Mleap +bundleFileName: model.lr.zip +replicas: 2 +poolsize: 2 +``` + +You can use this generated `/hello-mleap/spec.yaml` as a starting point to modify the +application as you see fit. diff --git a/samples/app-deploy/hello-mleap/frame.json b/samples/app-deploy/hello-mleap/frame.json new file mode 100644 index 00000000..3accc051 --- /dev/null +++ b/samples/app-deploy/hello-mleap/frame.json @@ -0,0 +1,45 @@ +{ + "schema": { + "fields": [{ + "name": "state", + "type": "string" + }, { + "name": "bathrooms", + "type": "double" + }, { + "name": "square_feet", + "type": "double" + }, { + "name": "bedrooms", + "type": "double" + }, { + "name": "security_deposit", + "type": "double" + }, { + "name": "cleaning_fee", + "type": "double" + }, { + "name": "extra_people", + "type": "double" + }, { + "name": "number_of_reviews", + "type": "double" + }, { + "name": "review_scores_rating", + "type": "double" + }, { + "name": "room_type", + "type": "string" + }, { + "name": "host_is_superhost", + "type": "string" + }, { + "name": "cancellation_policy", + "type": "string" + }, { + "name": "instant_bookable", + "type": "string" + }] + }, + "rows": [["NY", 2.0, 1250.0, 3.0, 50.0, 30.0, 2.0, 56.0, 90.0, "Entire home/apt", "1.0", "strict", "1.0"]] +} diff --git a/samples/app-deploy/hello-mleap/run-spec.yaml b/samples/app-deploy/hello-mleap/run-spec.yaml new file mode 100644 index 00000000..9263fdf6 --- /dev/null +++ b/samples/app-deploy/hello-mleap/run-spec.yaml @@ -0,0 +1,3 @@ +name: hello-mleap +version: v1 +inputs: ./frame.json \ No newline at end of file diff --git a/samples/app-deploy/hello-mleap/spec.yaml b/samples/app-deploy/hello-mleap/spec.yaml new file mode 100644 index 00000000..be88007e --- /dev/null +++ b/samples/app-deploy/hello-mleap/spec.yaml @@ -0,0 +1,6 @@ +name: hello-mleap1 +version: v1 +runtime: Mleap +bundleFileName: model.lr.zip +replicas: 2 +poolsize: 2 diff --git a/samples/app-deploy/magic8ball/magic8ball.py b/samples/app-deploy/magic8ball/magic8ball.py new file mode 100644 index 00000000..31aa2f02 --- /dev/null +++ b/samples/app-deploy/magic8ball/magic8ball.py @@ -0,0 +1,41 @@ +#This is a sample Python Script for an implementation for magic8ball +# how to run this - mssqlctl-pre app create -n magic8 -v v2 --code magic8ball.py --runtime Python --inputs quizme=str --outputs result=str + +import sys +import random +def magic8ball(txt): + question = txt + #print (input) + answers = random.randint(1,8) + msg="" + if question == "": + sys.exit() + + elif answers == 1: + msg="It is certain" + + elif answers == 2: + msg="Outlook good" + + elif answers == 3: + msg="You may rely on it" + + elif answers == 4: + msg="Ask again later" + + elif answers == 5: + msg="Concentrate and ask again" + + elif answers == 6: + msg="Reply hazy, try again" + + elif answers == 7: + msg="My reply is no" + + elif answers == 8: + msg="My sources say no" + + return msg +#quizme="SQL Server Big Data Cluster is awesome" + +result =magic8ball(txt) diff --git a/samples/app-deploy/magic8ball/spec.yaml b/samples/app-deploy/magic8ball/spec.yaml new file mode 100644 index 00000000..4bee4094 --- /dev/null +++ b/samples/app-deploy/magic8ball/spec.yaml @@ -0,0 +1,11 @@ +name: magic8ball +version: v2 +runtime: Python +src: ./magic8ball.py +entrypoint: magic8ball +replicas: 1 +poolsize: 1 +inputs: + txt: str +output: + result: str diff --git a/samples/app-deploy/sumofsq/spec.yaml b/samples/app-deploy/sumofsq/spec.yaml new file mode 100644 index 00000000..558220c1 --- /dev/null +++ b/samples/app-deploy/sumofsq/spec.yaml @@ -0,0 +1,13 @@ +name: sum-of-sq +version: v1 +runtime: R +src: ./sum_of_squares.R +entrypoint: sofsq +replicas: 1 +poolsize: 1 +inputs: + a: integer + b: integer +output: + result: integer + diff --git a/samples/app-deploy/sumofsq/sum_of_squares.R b/samples/app-deploy/sumofsq/sum_of_squares.R new file mode 100644 index 00000000..3caec4a3 --- /dev/null +++ b/samples/app-deploy/sumofsq/sum_of_squares.R @@ -0,0 +1,4 @@ +sofsq <- function(a,b) { + a^2 + b^2 +} +result <- sofsq (a,b) From 328d3fe96b4b5543d73532696556408ebf8ce0d7 Mon Sep 17 00:00:00 2001 From: Bharath Sankaranarayan Date: Sat, 16 Feb 2019 22:19:39 -0800 Subject: [PATCH 4/4] removed README.md --- samples/app-deploy/README.md | 33 --------------------------------- 1 file changed, 33 deletions(-) delete mode 100644 samples/app-deploy/README.md diff --git a/samples/app-deploy/README.md b/samples/app-deploy/README.md deleted file mode 100644 index 61b231c6..00000000 --- a/samples/app-deploy/README.md +++ /dev/null @@ -1,33 +0,0 @@ -# Samples on how to deploy apps on SQL Sever Big Data Cluster - - -## Python -These sample demonstrates how you can deploy a simple Python app into SQL Server Big Data Cluster as container app as web service that is swagger compliant for building your application. - -__[addpy](addpy/)__ - -This sample demonstrates how to deploy a Python script that takes integers as input and outputs an integer. - -__[magic8ball](magic8ball/)__ - -This sample demonstrates how to deploy a Python script that takes a string as input and outputs a string. - - - -## R -These sample demonstrates how you can deploy a simple R app into SQL Server Big Data Cluster as container app as web service that is swagger compliant for building your application. - -__[RollDice](RollDice/)__ - -This sample demonstrates the use of data framess - -## MLeap -__[hello-mleap](hello-mleap/)__ - -This sample demonstrates how you use a MLeap bundle ( a Spark model serialized in this format) and run it outside of Spark. The sample is based on the MLeap sample availble here http://mleap-docs.combust.ml/mleap-serving/. We are using the MLeap Serving container that is published in docker hub. The MLeap Serving is deployed as container in SQL Server Big Data Cluster as container app as web service that takes the Leap Frame as the input. - - -## Sql Server Integration Services -__[SSIS](SSIS/)__ - -This sample demonstrates SSIS application can be run as a containerized application and use the cron capability in Kubernets as a scheduler. This example takes Data Transformation Services Package File Format (DTSX) developed using Visual Studio that takes a database backup and copies it over to the SQL Server instance for restoring. This will run as a cron job pushing the backups every minute. Please follow the README.md for detailed instructions.