Skip to content

Commit d863438

Browse files
authored
Show region parameter override for uploading whylogs profiles (#1448)
* minor updates to writer example Example: ``` os.environ["WHYLABS_UPLOAD_REGION"] = 'ap-southeast-2' ``` - [x] I have reviewed the [Guidelines for Contributing](CONTRIBUTING.md) and the [Code of Conduct](CODE_OF_CONDUCT.md).
1 parent c2d8fae commit d863438

File tree

1 file changed

+35
-121
lines changed

1 file changed

+35
-121
lines changed

python/examples/integrations/writers/Writing_to_WhyLabs.ipynb

Lines changed: 35 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,26 @@
9696
},
9797
{
9898
"cell_type": "code",
99-
"execution_count": null,
99+
"execution_count": 6,
100100
"metadata": {},
101-
"outputs": [],
101+
"outputs": [
102+
{
103+
"data": {
104+
"text/plain": [
105+
"<whylogs.api.whylabs.session.session.LocalSession at 0x7fe3f463edf0>"
106+
]
107+
},
108+
"execution_count": 6,
109+
"metadata": {},
110+
"output_type": "execute_result"
111+
}
112+
],
102113
"source": [
103114
"import whylogs as why\n",
115+
"import os\n",
104116
"\n",
117+
"# Optionally you can override the AWS region that profiles get uploaded to when uploading to WhyLabs\n",
118+
"# os.environ[\"WHYLABS_UPLOAD_REGION\"] = 'ap-southeast-2'\n",
105119
"why.init()"
106120
]
107121
},
@@ -142,7 +156,7 @@
142156
},
143157
{
144158
"cell_type": "code",
145-
"execution_count": 3,
159+
"execution_count": 8,
146160
"metadata": {},
147161
"outputs": [
148162
{
@@ -283,7 +297,7 @@
283297
"4 Purchase 39.0 "
284298
]
285299
},
286-
"execution_count": 3,
300+
"execution_count": 8,
287301
"metadata": {},
288302
"output_type": "execute_result"
289303
}
@@ -315,7 +329,7 @@
315329
},
316330
{
317331
"cell_type": "code",
318-
"execution_count": 4,
332+
"execution_count": 9,
319333
"metadata": {},
320334
"outputs": [],
321335
"source": [
@@ -352,16 +366,16 @@
352366
},
353367
{
354368
"cell_type": "code",
355-
"execution_count": 5,
369+
"execution_count": 12,
356370
"metadata": {},
357371
"outputs": [
358372
{
359373
"data": {
360374
"text/plain": [
361-
"(True, 'log-f8V2ZqQLLXXlBIwi')"
375+
"(True, 'log-SluRuCMaglUHtWln')"
362376
]
363377
},
364-
"execution_count": 5,
378+
"execution_count": 12,
365379
"metadata": {},
366380
"output_type": "execute_result"
367381
}
@@ -371,7 +385,7 @@
371385
"\n",
372386
"# The writer uses the same credentials that you set up in why.init\n",
373387
"writer = WhyLabsWriter()\n",
374-
"writer.write(file=profile.view())"
388+
"writer.write(profile)"
375389
]
376390
},
377391
{
@@ -402,16 +416,16 @@
402416
},
403417
{
404418
"cell_type": "code",
405-
"execution_count": 6,
419+
"execution_count": 11,
406420
"metadata": {},
407421
"outputs": [
408422
{
409423
"data": {
410424
"text/plain": [
411-
"[(True, 'log-F8p8MMkxQ7U6PxjG')]"
425+
"[(True, 'log-iPA3fD7K3IAXqwZk')]"
412426
]
413427
},
414-
"execution_count": 6,
428+
"execution_count": 11,
415429
"metadata": {},
416430
"output_type": "execute_result"
417431
}
@@ -468,23 +482,9 @@
468482
},
469483
{
470484
"cell_type": "code",
471-
"execution_count": 7,
485+
"execution_count": null,
472486
"metadata": {},
473-
"outputs": [
474-
{
475-
"name": "stdout",
476-
"output_type": "stream",
477-
"text": [
478-
"Logged profile for 2023-09-08 20:45:08.661221+00:00\n",
479-
"Logged profile for 2023-09-07 20:45:09.714203+00:00\n",
480-
"Logged profile for 2023-09-06 20:45:10.755056+00:00\n",
481-
"Logged profile for 2023-09-05 20:45:11.696173+00:00\n",
482-
"Logged profile for 2023-09-04 20:45:12.807533+00:00\n",
483-
"Logged profile for 2023-09-03 20:45:13.793383+00:00\n",
484-
"Logged profile for 2023-09-02 20:45:14.460016+00:00\n"
485-
]
486-
}
487-
],
487+
"outputs": [],
488488
"source": [
489489
"import numpy as np\n",
490490
"from datetime import datetime, timedelta\n",
@@ -517,71 +517,9 @@
517517
},
518518
{
519519
"cell_type": "code",
520-
"execution_count": 8,
520+
"execution_count": null,
521521
"metadata": {},
522-
"outputs": [
523-
{
524-
"name": "stdout",
525-
"output_type": "stream",
526-
"text": [
527-
"profiling batch: 0 out of 10 batches of data\n"
528-
]
529-
},
530-
{
531-
"name": "stderr",
532-
"output_type": "stream",
533-
"text": [
534-
"trace_id was specified as None but there is already a trace_id defined in metadata[whylabs.traceId]: 717a6394-cef6-46f7-8f0f-38d8cbdfee0b\n",
535-
"trace_id was specified as None but there is already a trace_id defined in metadata[whylabs.traceId]: 717a6394-cef6-46f7-8f0f-38d8cbdfee0b\n"
536-
]
537-
},
538-
{
539-
"name": "stdout",
540-
"output_type": "stream",
541-
"text": [
542-
"profiling batch: 1 out of 10 batches of data\n",
543-
"profiling batch: 2 out of 10 batches of data\n",
544-
"profiling batch: 3 out of 10 batches of data\n"
545-
]
546-
},
547-
{
548-
"name": "stderr",
549-
"output_type": "stream",
550-
"text": [
551-
"trace_id was specified as None but there is already a trace_id defined in metadata[whylabs.traceId]: 717a6394-cef6-46f7-8f0f-38d8cbdfee0b\n",
552-
"trace_id was specified as None but there is already a trace_id defined in metadata[whylabs.traceId]: 717a6394-cef6-46f7-8f0f-38d8cbdfee0b\n",
553-
"trace_id was specified as None but there is already a trace_id defined in metadata[whylabs.traceId]: 717a6394-cef6-46f7-8f0f-38d8cbdfee0b\n",
554-
"trace_id was specified as None but there is already a trace_id defined in metadata[whylabs.traceId]: 717a6394-cef6-46f7-8f0f-38d8cbdfee0b\n",
555-
"trace_id was specified as None but there is already a trace_id defined in metadata[whylabs.traceId]: 717a6394-cef6-46f7-8f0f-38d8cbdfee0b\n"
556-
]
557-
},
558-
{
559-
"name": "stdout",
560-
"output_type": "stream",
561-
"text": [
562-
"profiling batch: 4 out of 10 batches of data\n",
563-
"profiling batch: 5 out of 10 batches of data\n",
564-
"profiling batch: 6 out of 10 batches of data\n",
565-
"profiling batch: 7 out of 10 batches of data\n",
566-
"profiling batch: 8 out of 10 batches of data\n"
567-
]
568-
},
569-
{
570-
"name": "stderr",
571-
"output_type": "stream",
572-
"text": [
573-
"trace_id was specified as None but there is already a trace_id defined in metadata[whylabs.traceId]: 717a6394-cef6-46f7-8f0f-38d8cbdfee0b\n",
574-
"trace_id was specified as None but there is already a trace_id defined in metadata[whylabs.traceId]: 717a6394-cef6-46f7-8f0f-38d8cbdfee0b\n"
575-
]
576-
},
577-
{
578-
"name": "stdout",
579-
"output_type": "stream",
580-
"text": [
581-
"profiling batch: 9 out of 10 batches of data\n"
582-
]
583-
}
584-
],
522+
"outputs": [],
585523
"source": [
586524
"import numpy as np\n",
587525
"from whylogs.api.writer.whylabs import WhyLabsWriter\n",
@@ -622,25 +560,9 @@
622560
},
623561
{
624562
"cell_type": "code",
625-
"execution_count": 9,
563+
"execution_count": null,
626564
"metadata": {},
627-
"outputs": [
628-
{
629-
"name": "stderr",
630-
"output_type": "stream",
631-
"text": [
632-
"WARNING:whylogs.api.writer.whylabs:About to upload a profile with a dataset_timestamp that is in the future: -283.243124961853s old.\n"
633-
]
634-
},
635-
{
636-
"name": "stdout",
637-
"output_type": "stream",
638-
"text": [
639-
"Uploaded with <whylogs.api.writer.whylabs.WhyLabsWriter object at 0x7f001c0a2d60>, profile with timestamp: 2023-09-08 20:50:00+00:00 and filename profile.2023-09-08_13-50.bin\n",
640-
"Uploaded with <whylogs.api.writer.local.LocalWriter object at 0x7f001c0d2280>, profile with timestamp: 2023-09-08 20:50:00+00:00 and filename profile.2023-09-08_13-50.bin\n"
641-
]
642-
}
643-
],
565+
"outputs": [],
644566
"source": [
645567
"telemetry_agent.close()"
646568
]
@@ -654,17 +576,9 @@
654576
},
655577
{
656578
"cell_type": "code",
657-
"execution_count": 10,
579+
"execution_count": null,
658580
"metadata": {},
659-
"outputs": [
660-
{
661-
"name": "stdout",
662-
"output_type": "stream",
663-
"text": [
664-
"profile.2023-09-08_13-45.bin profile.2023-09-08_13-50.bin\n"
665-
]
666-
}
667-
],
581+
"outputs": [],
668582
"source": [
669583
"!ls *.bin"
670584
]
@@ -686,7 +600,7 @@
686600
"name": "python",
687601
"nbconvert_exporter": "python",
688602
"pygments_lexer": "ipython3",
689-
"version": "3.9.16"
603+
"version": "3.8.10"
690604
},
691605
"orig_nbformat": 4,
692606
"vscode": {

0 commit comments

Comments
 (0)