app deploy samples

This commit is contained in:
Bharath Sankaranarayan
2019-02-14 16:05:30 -08:00
parent 84bb5ec79a
commit 0d5662a68d
10 changed files with 125 additions and 0 deletions
@@ -0,0 +1 @@
# App deploy Samples
@@ -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)
@@ -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
@@ -0,0 +1,4 @@
def add(x,y):
result = x+y
return result;
result=add(x,y)
@@ -0,0 +1,5 @@
name: addpy
version: v1
inputs:
x: 10
y: 10
@@ -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
@@ -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)
@@ -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
@@ -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
@@ -0,0 +1,4 @@
sofsq <- function(a,b) {
a^2 + b^2
}
result <- sofsq (a,b)