Skip to content

Commit 0cdc5c7

Browse files
Updating readmes for rolldice and add app deploy samples.
1 parent 1819ff0 commit 0cdc5c7

3 files changed

Lines changed: 112 additions & 6 deletions

File tree

samples/features/sql-big-data-cluster/app-deploy/RollDice/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ To run this sample, you need the following prerequisites.
5757
Once the app is listed as `Ready` you can continue to the next step.
5858
5. Test the app by running the following command:
5959
```bash
60-
mssqlctl app run -n roll-dice -v [version] --input x=[number of dice to roll]
60+
mssqlctl app run -n roll-dice -v [version] --input x=3
6161
```
6262
You should get output like the example for three dice below. The results of the dice rolled are in the `result` data frame:
6363
```json
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# Running a Python script in SQL Server big data cluster
2+
3+
### Contents
4+
5+
[About this sample](#about-this-sample)<br/>
6+
[Before you begin](#before-you-begin)<br/>
7+
[Run this sample](#run-this-sample)<br/>
8+
[Sample details](#sample-details)<br/>
9+
[Related links](#related-links)<br/>
10+
11+
<a name=about-this-sample></a>
12+
13+
## About this sample
14+
15+
This is a sample [Python](https://www.python.org/) app, which shows how to run a Python script in SQL Server big data cluster. This sample creates an app that adds two whole numbers and returns the result. The code for this sample is in [add.py](add.py) The inputs and outputs are shown below.
16+
17+
### Inputs
18+
|Parameter|Description|
19+
|-|-|
20+
|`x`|The first whole number to add|
21+
|`y`|The second whole number to add|
22+
23+
### Outputs
24+
|Parameter|Description|
25+
|-|-|
26+
|`result`|The result of adding `x` and `y`|
27+
28+
29+
<a name=before-you-begin></a>
30+
31+
## Before you begin
32+
33+
To run this sample, you need the following prerequisites.
34+
35+
**Software prerequisites:**
36+
37+
1. SQL Server big data cluster CTP 2.3 or later.
38+
2. `mssqlctl`. Refer to [installing mssqlctl](https://docs.microsoft.com/en-us/sql/big-data-cluster/deploy-install-mssqlctl?view=sqlallproducts-allversions) document on setting up the `mssqlctl` and connecting to a SQL Server 2019 big data cluster.
39+
40+
<a name=run-this-sample></a>
41+
42+
## Run this sample
43+
44+
1. Clone or download this sample on your computer.
45+
2. Log in to the SQL Server big data cluster using the command below using the IP address of the `endpoint-service-proxy` in your cluster. If you are not familiar with `mssqltctl` you can refer to the [documentation](https://docs.microsoft.com/en-us/sql/big-data-cluster/big-data-cluster-create-apps?view=sqlallproducts-allversions) and then return to this sample.
46+
47+
```bash
48+
mssqlctl login -e https://<ip-address-of-endpoint-service-proxy>:30777 -u <user-name> -p <password>
49+
```
50+
3. Deploy the application by running the following command, specifying the folder where your `spec.yaml` and `add.py` files are located:
51+
```bash
52+
mssqlctl app create --spec ./addpy
53+
```
54+
4. Check the deployment by running the following command:
55+
```bash
56+
mssqlctl app list -n addpy -v [version]
57+
```
58+
Once the app is listed as `Ready` you can continue to the next step.
59+
5. Test the app by running the following command:
60+
```bash
61+
mssqlctl app run -n addpy -v [version] --input x=3,y=5
62+
```
63+
You should get output like the example below. The result of adding 3+5 are returned as `result`.
64+
```json
65+
{
66+
"changedFiles": [],
67+
"consoleOutput": "",
68+
"errorMessage": "",
69+
"outputFiles": {},
70+
"outputParameters": {
71+
"result": 8
72+
},
73+
"success": true
74+
}
75+
```
76+
6. You can clean up the sample by running the following commands:
77+
```bash
78+
# delete app
79+
mssqlctl app delete --name addpy --version [version]
80+
```
81+
82+
<a name=sample-details></a>
83+
84+
## Sample details
85+
86+
Please refer to [add.py](add.py) for the code for this sample.
87+
88+
### Spec file
89+
Here is the spec file for this application. As you can see the sample uses the `Python` runtime and calls the `add` method in the `add.py` file, accepting two integer inputs named `x` and `y` and returning an integer output named `result`.
90+
91+
```yaml
92+
name: addpy
93+
version: v1
94+
runtime: Python
95+
src: ./add.py
96+
entrypoint: add
97+
replicas: 1
98+
poolsize: 1
99+
inputs:
100+
x: int
101+
y: int
102+
output:
103+
result: int
104+
```
105+
106+
<a name=related-links></a>
107+
108+
## Related Links
109+
For more information, see these articles:
110+
111+
[How to deploy and app on SQL Server 2019 big data cluster (preview)](https://docs.microsoft.com/en-us/sql/big-data-cluster/big-data-cluster-create-apps?view=sqlallproducts-allversions)

samples/features/sql-big-data-cluster/app-deploy/addpy/addpy-run-spec.yaml

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)