From 88d43634ae8e26fded0b2904cb25ebc74c104df4 Mon Sep 17 00:00:00 2001 From: Brandon Koch Date: Thu, 31 Jan 2019 11:06:02 -0800 Subject: [PATCH 1/2] Added app templates --- samples/app-templates/mleap/frame.airbnb.json | 45 ++++++++++++ samples/app-templates/mleap/run-spec.yaml | 3 + samples/app-templates/mleap/spec.yaml | 4 ++ samples/app-templates/python/hello.py | 18 +++++ samples/app-templates/python/run-spec.yaml | 4 ++ samples/app-templates/python/spec.yaml | 11 +++ samples/app-templates/r/hello.R | 12 ++++ samples/app-templates/r/run-spec.yaml | 4 ++ samples/app-templates/r/spec.yaml | 11 +++ samples/app-templates/ssis/hello.dtsx | 68 +++++++++++++++++++ samples/app-templates/ssis/run-spec.yaml | 2 + samples/app-templates/ssis/spec.yaml | 6 ++ 12 files changed, 188 insertions(+) create mode 100644 samples/app-templates/mleap/frame.airbnb.json create mode 100644 samples/app-templates/mleap/run-spec.yaml create mode 100644 samples/app-templates/mleap/spec.yaml create mode 100644 samples/app-templates/python/hello.py create mode 100644 samples/app-templates/python/run-spec.yaml create mode 100644 samples/app-templates/python/spec.yaml create mode 100644 samples/app-templates/r/hello.R create mode 100644 samples/app-templates/r/run-spec.yaml create mode 100644 samples/app-templates/r/spec.yaml create mode 100644 samples/app-templates/ssis/hello.dtsx create mode 100644 samples/app-templates/ssis/run-spec.yaml create mode 100644 samples/app-templates/ssis/spec.yaml diff --git a/samples/app-templates/mleap/frame.airbnb.json b/samples/app-templates/mleap/frame.airbnb.json new file mode 100644 index 00000000..3accc051 --- /dev/null +++ b/samples/app-templates/mleap/frame.airbnb.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-templates/mleap/run-spec.yaml b/samples/app-templates/mleap/run-spec.yaml new file mode 100644 index 00000000..0fa7edb1 --- /dev/null +++ b/samples/app-templates/mleap/run-spec.yaml @@ -0,0 +1,3 @@ +name: hello-mleap +version: v1 +inputs: ./frame.airbnb.json \ No newline at end of file diff --git a/samples/app-templates/mleap/spec.yaml b/samples/app-templates/mleap/spec.yaml new file mode 100644 index 00000000..c392d3cc --- /dev/null +++ b/samples/app-templates/mleap/spec.yaml @@ -0,0 +1,4 @@ +name: hello-mleap +version: v1 +runtime: Mleap +bundleFileName: airbnb.model.lr.zip \ No newline at end of file diff --git a/samples/app-templates/python/hello.py b/samples/app-templates/python/hello.py new file mode 100644 index 00000000..9ef1b95a --- /dev/null +++ b/samples/app-templates/python/hello.py @@ -0,0 +1,18 @@ +def handler(msg): + """ + Writes input argument back-out to the standard output returning input as + output. + + Generated by: `SQL Server Big Data Cluster` + + :param msg: The message to echo. + :type msg: str + :return: The input message `msg` as output `out`. + """ + print(msg) + out = msg + return out + + +if __name__ == '__main__': + handler('Hello') \ No newline at end of file diff --git a/samples/app-templates/python/run-spec.yaml b/samples/app-templates/python/run-spec.yaml new file mode 100644 index 00000000..34d8f7e4 --- /dev/null +++ b/samples/app-templates/python/run-spec.yaml @@ -0,0 +1,4 @@ +name: hello-python +version: v1 +inputs: + msg: hello \ No newline at end of file diff --git a/samples/app-templates/python/spec.yaml b/samples/app-templates/python/spec.yaml new file mode 100644 index 00000000..4a27bcbf --- /dev/null +++ b/samples/app-templates/python/spec.yaml @@ -0,0 +1,11 @@ +name: hello-python +version: v1 +runtime: Python +src: ./hello.py +entrypoint: handler +replicas: 1 +poolsize: 1 +inputs: + msg: str +output: + out: str \ No newline at end of file diff --git a/samples/app-templates/r/hello.R b/samples/app-templates/r/hello.R new file mode 100644 index 00000000..04175d7b --- /dev/null +++ b/samples/app-templates/r/hello.R @@ -0,0 +1,12 @@ +#' Writes input argument back-out to the +#' standard output returning input as output. +#' +#' Generated by: `SQL Server Big Data Cluster` +#' +#' @param msg A character message to echo. +#' @return The input \code{msg} as output \code{out}. +handler <- function(msg) { + print(msg) + out = msg + out +} diff --git a/samples/app-templates/r/run-spec.yaml b/samples/app-templates/r/run-spec.yaml new file mode 100644 index 00000000..5f1969dc --- /dev/null +++ b/samples/app-templates/r/run-spec.yaml @@ -0,0 +1,4 @@ +name: hello-r +version: v1 +inputs: + msg: hello \ No newline at end of file diff --git a/samples/app-templates/r/spec.yaml b/samples/app-templates/r/spec.yaml new file mode 100644 index 00000000..fc09f4c8 --- /dev/null +++ b/samples/app-templates/r/spec.yaml @@ -0,0 +1,11 @@ +name: hello-r +version: v1 +runtime: R +src: ./hello.R +entrypoint: handler +replicas: 1 +poolsize: 1 +inputs: + msg: character +output: + out: character \ No newline at end of file diff --git a/samples/app-templates/ssis/hello.dtsx b/samples/app-templates/ssis/hello.dtsx new file mode 100644 index 00000000..103864b6 --- /dev/null +++ b/samples/app-templates/ssis/hello.dtsx @@ -0,0 +1,68 @@ + + + 8 + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + \ No newline at end of file diff --git a/samples/app-templates/ssis/run-spec.yaml b/samples/app-templates/ssis/run-spec.yaml new file mode 100644 index 00000000..da7a3db4 --- /dev/null +++ b/samples/app-templates/ssis/run-spec.yaml @@ -0,0 +1,2 @@ +name: hello-ssis +version: v1 \ No newline at end of file diff --git a/samples/app-templates/ssis/spec.yaml b/samples/app-templates/ssis/spec.yaml new file mode 100644 index 00000000..6fd2c686 --- /dev/null +++ b/samples/app-templates/ssis/spec.yaml @@ -0,0 +1,6 @@ +name: hello-ssis +version: v1 +runtime: SSIS +entrypoint: ./hello.dtsx +options: /REP V +schedule: "*/2 * * * *" From 861e85217370c71df33a49c04b5b13eb5cde652d Mon Sep 17 00:00:00 2001 From: Brandon Koch Date: Fri, 1 Feb 2019 12:29:25 -0800 Subject: [PATCH 2/2] Moved app-templates to be under sql-big-data-cluster and added general README --- .../app-templates/README.md | 20 +++++++++++++++++++ .../app-templates/mleap/frame.airbnb.json | 0 .../app-templates/mleap/run-spec.yaml | 0 .../app-templates/mleap/spec.yaml | 0 .../app-templates/python/hello.py | 0 .../app-templates/python/run-spec.yaml | 0 .../app-templates/python/spec.yaml | 0 .../app-templates/r/hello.R | 0 .../app-templates/r/run-spec.yaml | 0 .../app-templates/r/spec.yaml | 0 .../app-templates/ssis/hello.dtsx | 0 .../app-templates/ssis/run-spec.yaml | 0 .../app-templates/ssis/spec.yaml | 0 13 files changed, 20 insertions(+) create mode 100644 samples/features/sql-big-data-cluster/app-templates/README.md rename samples/{ => features/sql-big-data-cluster}/app-templates/mleap/frame.airbnb.json (100%) rename samples/{ => features/sql-big-data-cluster}/app-templates/mleap/run-spec.yaml (100%) rename samples/{ => features/sql-big-data-cluster}/app-templates/mleap/spec.yaml (100%) rename samples/{ => features/sql-big-data-cluster}/app-templates/python/hello.py (100%) rename samples/{ => features/sql-big-data-cluster}/app-templates/python/run-spec.yaml (100%) rename samples/{ => features/sql-big-data-cluster}/app-templates/python/spec.yaml (100%) rename samples/{ => features/sql-big-data-cluster}/app-templates/r/hello.R (100%) rename samples/{ => features/sql-big-data-cluster}/app-templates/r/run-spec.yaml (100%) rename samples/{ => features/sql-big-data-cluster}/app-templates/r/spec.yaml (100%) rename samples/{ => features/sql-big-data-cluster}/app-templates/ssis/hello.dtsx (100%) rename samples/{ => features/sql-big-data-cluster}/app-templates/ssis/run-spec.yaml (100%) rename samples/{ => features/sql-big-data-cluster}/app-templates/ssis/spec.yaml (100%) diff --git a/samples/features/sql-big-data-cluster/app-templates/README.md b/samples/features/sql-big-data-cluster/app-templates/README.md new file mode 100644 index 00000000..133b1fed --- /dev/null +++ b/samples/features/sql-big-data-cluster/app-templates/README.md @@ -0,0 +1,20 @@ +# App Templates +These are the language kernel templates for deployment and consumption of applications deployed into an on premise SQL Server Big Data Cluster. + +Each directory listed is a separate language kernel that is supported for app deployment: +- Python +- R +- SSIS +- Mleap + +Each template contains three primary files: +- spec.yaml + - This is the deployment definition given to the cluster +- run-spec.yaml + - This is the app consumption definition given to the VS Code Ext. client +- app code + - Example code for deployment of that particular type of language kernel + +These templates are automatically pulled by the mssqlctl CLI and the App Deploy VS Code Extension. Customers may also download these templates themselves outside of the clients, if desired. + +Future language kernels supported for app deployment will be contributed as templates here. \ No newline at end of file diff --git a/samples/app-templates/mleap/frame.airbnb.json b/samples/features/sql-big-data-cluster/app-templates/mleap/frame.airbnb.json similarity index 100% rename from samples/app-templates/mleap/frame.airbnb.json rename to samples/features/sql-big-data-cluster/app-templates/mleap/frame.airbnb.json diff --git a/samples/app-templates/mleap/run-spec.yaml b/samples/features/sql-big-data-cluster/app-templates/mleap/run-spec.yaml similarity index 100% rename from samples/app-templates/mleap/run-spec.yaml rename to samples/features/sql-big-data-cluster/app-templates/mleap/run-spec.yaml diff --git a/samples/app-templates/mleap/spec.yaml b/samples/features/sql-big-data-cluster/app-templates/mleap/spec.yaml similarity index 100% rename from samples/app-templates/mleap/spec.yaml rename to samples/features/sql-big-data-cluster/app-templates/mleap/spec.yaml diff --git a/samples/app-templates/python/hello.py b/samples/features/sql-big-data-cluster/app-templates/python/hello.py similarity index 100% rename from samples/app-templates/python/hello.py rename to samples/features/sql-big-data-cluster/app-templates/python/hello.py diff --git a/samples/app-templates/python/run-spec.yaml b/samples/features/sql-big-data-cluster/app-templates/python/run-spec.yaml similarity index 100% rename from samples/app-templates/python/run-spec.yaml rename to samples/features/sql-big-data-cluster/app-templates/python/run-spec.yaml diff --git a/samples/app-templates/python/spec.yaml b/samples/features/sql-big-data-cluster/app-templates/python/spec.yaml similarity index 100% rename from samples/app-templates/python/spec.yaml rename to samples/features/sql-big-data-cluster/app-templates/python/spec.yaml diff --git a/samples/app-templates/r/hello.R b/samples/features/sql-big-data-cluster/app-templates/r/hello.R similarity index 100% rename from samples/app-templates/r/hello.R rename to samples/features/sql-big-data-cluster/app-templates/r/hello.R diff --git a/samples/app-templates/r/run-spec.yaml b/samples/features/sql-big-data-cluster/app-templates/r/run-spec.yaml similarity index 100% rename from samples/app-templates/r/run-spec.yaml rename to samples/features/sql-big-data-cluster/app-templates/r/run-spec.yaml diff --git a/samples/app-templates/r/spec.yaml b/samples/features/sql-big-data-cluster/app-templates/r/spec.yaml similarity index 100% rename from samples/app-templates/r/spec.yaml rename to samples/features/sql-big-data-cluster/app-templates/r/spec.yaml diff --git a/samples/app-templates/ssis/hello.dtsx b/samples/features/sql-big-data-cluster/app-templates/ssis/hello.dtsx similarity index 100% rename from samples/app-templates/ssis/hello.dtsx rename to samples/features/sql-big-data-cluster/app-templates/ssis/hello.dtsx diff --git a/samples/app-templates/ssis/run-spec.yaml b/samples/features/sql-big-data-cluster/app-templates/ssis/run-spec.yaml similarity index 100% rename from samples/app-templates/ssis/run-spec.yaml rename to samples/features/sql-big-data-cluster/app-templates/ssis/run-spec.yaml diff --git a/samples/app-templates/ssis/spec.yaml b/samples/features/sql-big-data-cluster/app-templates/ssis/spec.yaml similarity index 100% rename from samples/app-templates/ssis/spec.yaml rename to samples/features/sql-big-data-cluster/app-templates/ssis/spec.yaml