Skip to content

Commit e83365c

Browse files
Merge pull request #28 from xsqian/main
asserts for the env varibale for different platform
2 parents aa88869 + 6f4cc65 commit e83365c

File tree

3 files changed

+39
-62
lines changed

3 files changed

+39
-62
lines changed

env.template

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1-
S3_BUCKET_NAME=
21
OPENAI_API_BASE=
3-
OPENAI_API_KEY=
2+
OPENAI_API_KEY=
3+
#for platform Iguazio, you need to set the MYSQL_URL and remove S3_BUCKET_NAME
4+
MYSQL_URL=
5+
#for platform Mck, you need to set the S3_BUCKET_NAME and remove MYSQL_URL
6+
S3_BUCKET_NAME=

mlrun.env

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

notebook.ipynb

Lines changed: 34 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
},
5252
{
5353
"cell_type": "code",
54-
"execution_count": 1,
54+
"execution_count": null,
5555
"id": "aed64e7c-1706-4a78-89ff-75b8a382472a",
5656
"metadata": {
5757
"jupyter": {
@@ -62,7 +62,7 @@
6262
},
6363
"outputs": [],
6464
"source": [
65-
"# !pip install SQLAlchemy==2.0.31 pymysql"
65+
"!pip install SQLAlchemy==2.0.31 pymysql dotenv"
6666
]
6767
},
6868
{
@@ -90,7 +90,8 @@
9090
"- This demo is limited to run with MLRun 1.9.x Python 3.11, with CPU, a mysql database and run the pipeline with `engine = \"remote\"`.\n",
9191
"- GPU is not supported at the moment.\n",
9292
"- Need to setup a mysql database for the demo. sqlite is not supported now.\n",
93-
"- Please set `run_with_gpu = False`, `use_sqlite = False`, `engine = \"remote\"`"
93+
"- Please set `run_with_gpu = False`, `use_sqlite = False`, `engine = \"remote\"`\n",
94+
"- .env include OPENAI_API_KEY, OPENAI_API_BASE, and MYSQL_URL"
9495
]
9596
},
9697
{
@@ -108,7 +109,8 @@
108109
"source": [
109110
"- GPU is not supported at the moment.\n",
110111
"- sqlite is supported.\n",
111-
"- Please set `run_with_gpu = False`, `use_sqlite = True`, `engine = \"remote\"`"
112+
"- Please set `run_with_gpu = False`, `use_sqlite = True`, `engine = \"remote\"`\n",
113+
"- .env include OPENAI_API_KEY, OPENAI_API_BASE, and S3_BUCKET_NAME"
112114
]
113115
},
114116
{
@@ -140,21 +142,20 @@
140142
},
141143
{
142144
"cell_type": "code",
143-
"execution_count": null,
145+
"execution_count": 1,
144146
"id": "76f05c23312057a3",
145147
"metadata": {},
146148
"outputs": [],
147149
"source": [
148150
"# True = run with GPU, False = run with CPU\n",
149151
"run_with_gpu = False\n",
150152
"language = \"en\" # The languages of the calls, es - Spanish, en - English\n",
151-
"skip_calls_generation = False\n",
152-
"use_sqlite = True"
153+
"skip_calls_generation = False"
153154
]
154155
},
155156
{
156157
"cell_type": "code",
157-
"execution_count": null,
158+
"execution_count": 2,
158159
"id": "7e7503f4-8830-4972-a986-10f4c29624b9",
159160
"metadata": {
160161
"tags": []
@@ -166,7 +167,7 @@
166167
"True"
167168
]
168169
},
169-
"execution_count": 3,
170+
"execution_count": 2,
170171
"metadata": {},
171172
"output_type": "execute_result"
172173
}
@@ -176,7 +177,6 @@
176177
"import os\n",
177178
"import sys\n",
178179
"import mlrun\n",
179-
"\n",
180180
"dotenv_file = \".env\"\n",
181181
"sys.path.insert(0, os.path.abspath(\"./\"))\n",
182182
"\n",
@@ -185,7 +185,7 @@
185185
},
186186
{
187187
"cell_type": "code",
188-
"execution_count": 4,
188+
"execution_count": 3,
189189
"id": "d33fc614-2898-4b12-b34f-62181651a9b5",
190190
"metadata": {},
191191
"outputs": [],
@@ -195,6 +195,21 @@
195195
"assert os.environ[\"OPENAI_API_KEY\"]"
196196
]
197197
},
198+
{
199+
"cell_type": "code",
200+
"execution_count": 4,
201+
"id": "9e2a5fd0-f4ff-486a-9d22-e5b80b7eb2a4",
202+
"metadata": {},
203+
"outputs": [],
204+
"source": [
205+
"if not mlrun.mlconf.is_ce_mode():\n",
206+
" assert os.environ[\"MYSQL_URL\"]\n",
207+
" use_sqlite = False\n",
208+
"else:\n",
209+
" assert os.environ[\"S3_BUCKET_NAME\"]\n",
210+
" use_sqlite = True"
211+
]
212+
},
198213
{
199214
"cell_type": "markdown",
200215
"id": "1ea33fee-ec95-48e3-aae8-9247ae182481",
@@ -230,7 +245,6 @@
230245
"execution_count": null,
231246
"id": "80b388f8-5aa3-4b6a-9b6d-b6dca242165e",
232247
"metadata": {
233-
"scrolled": true,
234248
"tags": []
235249
},
236250
"outputs": [],
@@ -239,6 +253,7 @@
239253
"project = mlrun.get_or_create_project(\n",
240254
" name=project_name,\n",
241255
" user_project=False,\n",
256+
" allow_cross_project=True,\n",
242257
" parameters={\n",
243258
" \"build_image\": True,\n",
244259
" \"source\": \"git://github.com/mlrun/demo-call-center.git#main\",\n",
@@ -296,7 +311,7 @@
296311
},
297312
{
298313
"cell_type": "code",
299-
"execution_count": 6,
314+
"execution_count": 14,
300315
"id": "adc25213-d4d6-411d-a9b0-edf91007ba33",
301316
"metadata": {},
302317
"outputs": [],
@@ -343,21 +358,10 @@
343358
},
344359
{
345360
"cell_type": "code",
346-
"execution_count": 7,
361+
"execution_count": null,
347362
"id": "8d3d7cca-ff52-4ffd-98df-7d70e8b083cf",
348363
"metadata": {},
349-
"outputs": [
350-
{
351-
"data": {
352-
"text/plain": [
353-
"<mlrun.projects.project.MlrunProject at 0x7fa2d60f05d0>"
354-
]
355-
},
356-
"execution_count": 7,
357-
"metadata": {},
358-
"output_type": "execute_result"
359-
}
360-
],
364+
"outputs": [],
361365
"source": [
362366
"project.spec.params['build_image']=False\n",
363367
"project.save()"
@@ -555,21 +559,12 @@
555559
},
556560
{
557561
"cell_type": "code",
558-
"execution_count": 15,
562+
"execution_count": null,
559563
"id": "399ed9c3-2765-4f03-a812-79428e51149e",
560564
"metadata": {
561565
"tags": []
562566
},
563-
"outputs": [
564-
{
565-
"name": "stdout",
566-
"output_type": "stream",
567-
"text": [
568-
"> 2025-08-18 03:40:34,753 [info] downloading s3://igz1-xingsheng-medium-r/projects/call-center-demo/artifacts/582022de-ef13-47b9-8b63-dbcf8680135e/text-to-audio/0/audio_files.zip to local temp file\n",
569-
"> 2025-08-18 03:40:37,898 [info] downloading s3://igz1-xingsheng-medium-r/projects/call-center-demo/artifacts/582022de-ef13-47b9-8b63-dbcf8680135e/conversation-generation/0/conversations.zip to local temp file\n"
570-
]
571-
}
572-
],
567+
"outputs": [],
573568
"source": [
574569
"import zipfile\n",
575570
"\n",
@@ -669,9 +664,9 @@
669664
],
670665
"metadata": {
671666
"kernelspec": {
672-
"display_name": "mlrun",
667+
"display_name": "py311",
673668
"language": "python",
674-
"name": "mlrun"
669+
"name": "conda-env-.conda-py311-py"
675670
},
676671
"language_info": {
677672
"codemirror_mode": {

0 commit comments

Comments
 (0)