Skip to content

Commit 57fb50e

Browse files
committed
added app-pack-gen build notebook tutorial
1 parent 5c1ee33 commit 57fb50e

File tree

1 file changed

+179
-0
lines changed

1 file changed

+179
-0
lines changed
Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "06d1e842-8f93-4611-a636-9d5b61d7db3d",
6+
"metadata": {},
7+
"source": [
8+
"# Application Pacakge Builds\n",
9+
"\n",
10+
"The process of turngin your notebook into a runable application package is described below. This requires the repository in which your applicaiton package is being built, as well as an access token to call the service. These build command will be integrated into unity_py in the future."
11+
]
12+
},
13+
{
14+
"cell_type": "code",
15+
"execution_count": 1,
16+
"id": "35953442-9689-4f04-b733-ba46eb0887a0",
17+
"metadata": {},
18+
"outputs": [],
19+
"source": [
20+
"import requests\n",
21+
"\n",
22+
"from unity_sds_client.unity import Unity\n",
23+
"from unity_sds_client.unity import UnityEnvironments\n"
24+
]
25+
},
26+
{
27+
"cell_type": "markdown",
28+
"id": "4ec41929-35e3-4e3a-a9f7-cd11ddfac113",
29+
"metadata": {},
30+
"source": [
31+
"For now, we will use the app-package builder in the development environment. So we need to get a token that works in that envionrment"
32+
]
33+
},
34+
{
35+
"cell_type": "code",
36+
"execution_count": 4,
37+
"id": "92f2f0e6-e761-4152-8d40-0a80edb6f552",
38+
"metadata": {},
39+
"outputs": [
40+
{
41+
"name": "stdin",
42+
"output_type": "stream",
43+
"text": [
44+
"Please enter your Unity username: gangl\n",
45+
"Please enter your Unity password: ········\n"
46+
]
47+
}
48+
],
49+
"source": [
50+
"# if you're reading this as a user, you probably have a 'TEST' or 'PROD' user account. This will be updated to work though unity-py directly.\n",
51+
"s = Unity(UnityEnvironments.DEV)\n",
52+
"token = s._session.get_auth().get_token()"
53+
]
54+
},
55+
{
56+
"cell_type": "markdown",
57+
"id": "178e0cfa-defd-4c84-b2cf-60fb4b64ae0d",
58+
"metadata": {},
59+
"source": [
60+
"We need the (open) repository that we would like to build. If you want to build a private repository, or a repository that is not publicly accessible, then you will need to build this on your own with the app-pack-generator."
61+
]
62+
},
63+
{
64+
"cell_type": "code",
65+
"execution_count": 5,
66+
"id": "a5476227-ebf5-4b57-896b-1bee2ad5944c",
67+
"metadata": {},
68+
"outputs": [],
69+
"source": [
70+
"### Not the .git url? \n",
71+
"clone_url = \"https://github.com/unity-sds/unity-example-application\""
72+
]
73+
},
74+
{
75+
"cell_type": "code",
76+
"execution_count": 6,
77+
"id": "3f3744ec-2210-4984-af5e-05fbcca804e7",
78+
"metadata": {},
79+
"outputs": [],
80+
"source": [
81+
"api_url = \"https://d3vc8w9zcq658.cloudfront.net/ads/mcp-clone\""
82+
]
83+
},
84+
{
85+
"cell_type": "code",
86+
"execution_count": 7,
87+
"id": "4d355511-f290-4d04-98cf-e23887905b7d",
88+
"metadata": {},
89+
"outputs": [],
90+
"source": [
91+
"response = requests.get(api_url, \n",
92+
" headers = { 'content-type': 'application/json',\n",
93+
" 'Authorization': 'Bearer ' + token,\n",
94+
" 'clone_url': clone_url })"
95+
]
96+
},
97+
{
98+
"cell_type": "code",
99+
"execution_count": 8,
100+
"id": "c481e6d8-4c60-4926-b146-f426bb066674",
101+
"metadata": {},
102+
"outputs": [
103+
{
104+
"data": {
105+
"text/plain": [
106+
"200"
107+
]
108+
},
109+
"execution_count": 8,
110+
"metadata": {},
111+
"output_type": "execute_result"
112+
}
113+
],
114+
"source": [
115+
"response.status_code"
116+
]
117+
},
118+
{
119+
"cell_type": "code",
120+
"execution_count": 9,
121+
"id": "cf1bbf6b-1883-4911-b43f-3d2a7fa91202",
122+
"metadata": {},
123+
"outputs": [
124+
{
125+
"data": {
126+
"text/plain": [
127+
"b'{\"clone_url\": \"https://github.com/unity-sds/unity-example-application\", \"log_group_name\": \"/aws/lambda/Unity-ADS--MCP-Clone\"}'"
128+
]
129+
},
130+
"execution_count": 9,
131+
"metadata": {},
132+
"output_type": "execute_result"
133+
}
134+
],
135+
"source": [
136+
"response.content"
137+
]
138+
},
139+
{
140+
"cell_type": "markdown",
141+
"id": "a0afc3f4-cb79-4d5c-96a3-66e1176a5482",
142+
"metadata": {},
143+
"source": [
144+
"## What next?\n",
145+
"\n",
146+
"For now, there is little insight intpthe build process, but this will be future delivered capability. For now, you can monitor dockstore for your newly built (or newly versioned, if it's being re-built) application pacakge. for the above Pacakge, it can be found at http://awslbdockstorestack-lb-1429770210.us-west-2.elb.amazonaws.com:9998/workflows/dockstore.org/edwinsarkissian/SBG-unity-reflect-correct:1?tab=info"
147+
]
148+
},
149+
{
150+
"cell_type": "code",
151+
"execution_count": null,
152+
"id": "5d0233d1-c05e-4df6-a0ee-231249a258bd",
153+
"metadata": {},
154+
"outputs": [],
155+
"source": []
156+
}
157+
],
158+
"metadata": {
159+
"kernelspec": {
160+
"display_name": "Python 3 (ipykernel)",
161+
"language": "python",
162+
"name": "python3"
163+
},
164+
"language_info": {
165+
"codemirror_mode": {
166+
"name": "ipython",
167+
"version": 3
168+
},
169+
"file_extension": ".py",
170+
"mimetype": "text/x-python",
171+
"name": "python",
172+
"nbconvert_exporter": "python",
173+
"pygments_lexer": "ipython3",
174+
"version": "3.8.18"
175+
}
176+
},
177+
"nbformat": 4,
178+
"nbformat_minor": 5
179+
}

0 commit comments

Comments
 (0)