diff --git a/samples/applications/app deploy/README.md b/samples/applications/app deploy/README.md new file mode 100644 index 00000000..369f5b86 --- /dev/null +++ b/samples/applications/app deploy/README.md @@ -0,0 +1 @@ +# App deploy Samples diff --git a/samples/applications/app deploy/RollDice/roll-dice.R b/samples/applications/app deploy/RollDice/roll-dice.R new file mode 100644 index 00000000..f0e2002c --- /dev/null +++ b/samples/applications/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/applications/app deploy/RollDice/spec.yaml b/samples/applications/app deploy/RollDice/spec.yaml new file mode 100644 index 00000000..d3036184 --- /dev/null +++ b/samples/applications/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/applications/app deploy/addpy/add.py b/samples/applications/app deploy/addpy/add.py new file mode 100644 index 00000000..284c999b --- /dev/null +++ b/samples/applications/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/applications/app deploy/addpy/addpy-run-spec.yaml b/samples/applications/app deploy/addpy/addpy-run-spec.yaml new file mode 100644 index 00000000..6787c5c7 --- /dev/null +++ b/samples/applications/app deploy/addpy/addpy-run-spec.yaml @@ -0,0 +1,5 @@ +name: addpy +version: v1 +inputs: + x: 10 + y: 10 diff --git a/samples/applications/app deploy/addpy/spec.yaml b/samples/applications/app deploy/addpy/spec.yaml new file mode 100644 index 00000000..13e59fc9 --- /dev/null +++ b/samples/applications/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/applications/app deploy/magic8ball/magic8ball.py b/samples/applications/app deploy/magic8ball/magic8ball.py new file mode 100644 index 00000000..31aa2f02 --- /dev/null +++ b/samples/applications/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/applications/app deploy/magic8ball/spec.yaml b/samples/applications/app deploy/magic8ball/spec.yaml new file mode 100644 index 00000000..4bee4094 --- /dev/null +++ b/samples/applications/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/applications/app deploy/sumofsq/spec.yaml b/samples/applications/app deploy/sumofsq/spec.yaml new file mode 100644 index 00000000..558220c1 --- /dev/null +++ b/samples/applications/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/applications/app deploy/sumofsq/sum_of_squares.R b/samples/applications/app deploy/sumofsq/sum_of_squares.R new file mode 100644 index 00000000..3caec4a3 --- /dev/null +++ b/samples/applications/app deploy/sumofsq/sum_of_squares.R @@ -0,0 +1,4 @@ +sofsq <- function(a,b) { + a^2 + b^2 +} +result <- sofsq (a,b)