mirror of
https://github.com/Microsoft/sql-server-samples.git
synced 2025-12-08 14:58:54 +00:00
app deploy samples
This commit is contained in:
@@ -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)
|
||||
Reference in New Issue
Block a user