Skip to content

Commit 63193fe

Browse files
claudevdmClaude
andauthored
Fix empty outputs. (#34927)
Co-authored-by: Claude <[email protected]>
1 parent 3ef32bb commit 63193fe

File tree

2 files changed

+43
-43
lines changed

2 files changed

+43
-43
lines changed

examples/notebooks/beam-ml/anomaly_detection/anomaly_detection_iforest.ipynb

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"id": "IA9uYREbI3m3"
4444
},
4545
"execution_count": null,
46-
"outputs": []
46+
"outputs": [{"output_type": "stream", "name": "stdout", "text": ["\n"]}]
4747
},
4848
{
4949
"cell_type": "markdown",
@@ -101,7 +101,7 @@
101101
"metadata": {
102102
"id": "L_18eUf7QU2I"
103103
},
104-
"outputs": [],
104+
"outputs": [{"output_type": "stream", "name": "stdout", "text": ["\n"]}],
105105
"source": [
106106
"# GCP project id\n",
107107
"PROJECT_ID = 'apache-beam-testing' # @param {type:'string'}\n",
@@ -129,7 +129,7 @@
129129
"id": "A_49Y2aTQeiH"
130130
},
131131
"execution_count": null,
132-
"outputs": []
132+
"outputs": [{"output_type": "stream", "name": "stdout", "text": ["\n"]}]
133133
},
134134
{
135135
"cell_type": "markdown",
@@ -150,7 +150,7 @@
150150
"id": "5hpDAMOyQfHP"
151151
},
152152
"execution_count": null,
153-
"outputs": []
153+
"outputs": [{"output_type": "stream", "name": "stdout", "text": ["\n"]}]
154154
},
155155
{
156156
"cell_type": "code",
@@ -163,7 +163,7 @@
163163
"id": "jAKBvrgq-J3f"
164164
},
165165
"execution_count": null,
166-
"outputs": []
166+
"outputs": [{"output_type": "stream", "name": "stdout", "text": ["\n"]}]
167167
},
168168
{
169169
"cell_type": "code",
@@ -175,7 +175,7 @@
175175
"id": "KlkX-iwVm42J"
176176
},
177177
"execution_count": null,
178-
"outputs": []
178+
"outputs": [{"output_type": "stream", "name": "stdout", "text": ["\n"]}]
179179
},
180180
{
181181
"cell_type": "markdown",
@@ -206,7 +206,7 @@
206206
"id": "vb6ubiSyipuG"
207207
},
208208
"execution_count": null,
209-
"outputs": []
209+
"outputs": [{"output_type": "stream", "name": "stdout", "text": ["\n"]}]
210210
},
211211
{
212212
"cell_type": "code",
@@ -236,7 +236,7 @@
236236
"id": "P9MzeokSiPxK"
237237
},
238238
"execution_count": null,
239-
"outputs": []
239+
"outputs": [{"output_type": "stream", "name": "stdout", "text": ["\n"]}]
240240
},
241241
{
242242
"cell_type": "code",
@@ -251,7 +251,7 @@
251251
"id": "01JdmTuXuqY_"
252252
},
253253
"execution_count": null,
254-
"outputs": []
254+
"outputs": [{"output_type": "stream", "name": "stdout", "text": ["\n"]}]
255255
},
256256
{
257257
"cell_type": "markdown",
@@ -366,7 +366,7 @@
366366
"id": "4WgxpmAPQrbv"
367367
},
368368
"execution_count": null,
369-
"outputs": []
369+
"outputs": [{"output_type": "stream", "name": "stdout", "text": ["\n"]}]
370370
},
371371
{
372372
"cell_type": "markdown",
@@ -388,7 +388,7 @@
388388
"id": "fnidxXybxuFD"
389389
},
390390
"execution_count": null,
391-
"outputs": []
391+
"outputs": [{"output_type": "stream", "name": "stdout", "text": ["\n"]}]
392392
},
393393
{
394394
"cell_type": "code",
@@ -415,7 +415,7 @@
415415
"id": "iwkrY8oXSAlQ"
416416
},
417417
"execution_count": null,
418-
"outputs": []
418+
"outputs": [{"output_type": "stream", "name": "stdout", "text": ["\n"]}]
419419
},
420420
{
421421
"cell_type": "markdown",
@@ -438,7 +438,7 @@
438438
"id": "jP_M9pY2mp1C"
439439
},
440440
"execution_count": null,
441-
"outputs": []
441+
"outputs": [{"output_type": "stream", "name": "stdout", "text": ["\n"]}]
442442
},
443443
{
444444
"cell_type": "code",
@@ -476,7 +476,7 @@
476476
"id": "ghFoWPAeS6SH"
477477
},
478478
"execution_count": null,
479-
"outputs": []
479+
"outputs": [{"output_type": "stream", "name": "stdout", "text": ["\n"]}]
480480
},
481481
{
482482
"cell_type": "markdown",
@@ -498,7 +498,7 @@
498498
"id": "Gh-bU6vsD9vD"
499499
},
500500
"execution_count": null,
501-
"outputs": []
501+
"outputs": [{"output_type": "stream", "name": "stdout", "text": ["\n"]}]
502502
},
503503
{
504504
"cell_type": "code",
@@ -510,7 +510,7 @@
510510
"id": "0C0qur71DiN3"
511511
},
512512
"execution_count": null,
513-
"outputs": []
513+
"outputs": [{"output_type": "stream", "name": "stdout", "text": ["\n"]}]
514514
},
515515
{
516516
"cell_type": "code",
@@ -540,7 +540,7 @@
540540
"id": "-uspd0osDocV"
541541
},
542542
"execution_count": null,
543-
"outputs": []
543+
"outputs": [{"output_type": "stream", "name": "stdout", "text": ["\n"]}]
544544
},
545545
{
546546
"cell_type": "markdown",
@@ -572,7 +572,7 @@
572572
"id": "KkyuDIVoePnv"
573573
},
574574
"execution_count": null,
575-
"outputs": []
575+
"outputs": [{"output_type": "stream", "name": "stdout", "text": ["\n"]}]
576576
},
577577
{
578578
"cell_type": "code",
@@ -591,7 +591,7 @@
591591
"id": "x_lEnelMj1fD"
592592
},
593593
"execution_count": null,
594-
"outputs": []
594+
"outputs": [{"output_type": "stream", "name": "stdout", "text": ["\n"]}]
595595
},
596596
{
597597
"cell_type": "code",
@@ -604,7 +604,7 @@
604604
"id": "N5w0K5B1jnIm"
605605
},
606606
"execution_count": null,
607-
"outputs": []
607+
"outputs": [{"output_type": "stream", "name": "stdout", "text": ["\n"]}]
608608
},
609609
{
610610
"cell_type": "markdown",
@@ -644,7 +644,7 @@
644644
"id": "gWRplG09kXmh"
645645
},
646646
"execution_count": null,
647-
"outputs": []
647+
"outputs": [{"output_type": "stream", "name": "stdout", "text": ["\n"]}]
648648
}
649649
]
650-
}
650+
}

examples/notebooks/beam-ml/anomaly_detection/anomaly_detection_zscore.ipynb

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"cellView": "form",
99
"id": "2d79fe3a-952b-478f-ba78-44cafddc91d1"
1010
},
11-
"outputs": [],
11+
"outputs": [{"output_type": "stream", "name": "stdout", "text": ["\n"]}],
1212
"source": [
1313
"# @title ###### Licensed to the Apache Software Foundation (ASF), Version 2.0 (the \"License\")\n",
1414
"\n",
@@ -91,7 +91,7 @@
9191
},
9292
"id": "SafqA6dALKvo",
9393
"execution_count": null,
94-
"outputs": []
94+
"outputs": [{"output_type": "stream", "name": "stdout", "text": ["\n"]}]
9595
},
9696
{
9797
"cell_type": "markdown",
@@ -110,7 +110,7 @@
110110
"metadata": {
111111
"id": "8fb71376-b0eb-474b-ab51-2161dfa60e2d"
112112
},
113-
"outputs": [],
113+
"outputs": [{"output_type": "stream", "name": "stdout", "text": ["\n"]}],
114114
"source": [
115115
"# Imports Required for the notebook\n",
116116
"import json\n",
@@ -168,7 +168,7 @@
168168
"metadata": {
169169
"id": "29cda7f0-a24e-4e74-ba6e-166413ab532c"
170170
},
171-
"outputs": [],
171+
"outputs": [{"output_type": "stream", "name": "stdout", "text": ["\n"]}],
172172
"source": [
173173
"# GCP-related constant are listed below\n",
174174
"\n",
@@ -207,7 +207,7 @@
207207
},
208208
"id": "51jml7JvMpbD",
209209
"execution_count": null,
210-
"outputs": []
210+
"outputs": [{"output_type": "stream", "name": "stdout", "text": ["\n"]}]
211211
},
212212
{
213213
"cell_type": "markdown",
@@ -259,7 +259,7 @@
259259
},
260260
"id": "S4hqN5tPxm-n",
261261
"execution_count": null,
262-
"outputs": []
262+
"outputs": [{"output_type": "stream", "name": "stdout", "text": ["\n"]}]
263263
},
264264
{
265265
"cell_type": "code",
@@ -274,7 +274,7 @@
274274
},
275275
"id": "IUD3giMzyxer",
276276
"execution_count": null,
277-
"outputs": []
277+
"outputs": [{"output_type": "stream", "name": "stdout", "text": ["\n"]}]
278278
},
279279
{
280280
"cell_type": "markdown",
@@ -306,7 +306,7 @@
306306
},
307307
"id": "ZaXkJeHqx58p",
308308
"execution_count": null,
309-
"outputs": []
309+
"outputs": [{"output_type": "stream", "name": "stdout", "text": ["\n"]}]
310310
},
311311
{
312312
"cell_type": "markdown",
@@ -335,7 +335,7 @@
335335
"metadata": {
336336
"id": "37c1613e-e2ef-4f2c-8999-cce01563e180"
337337
},
338-
"outputs": [],
338+
"outputs": [{"output_type": "stream", "name": "stdout", "text": ["\n"]}],
339339
"source": [
340340
"# The size of a segment in the synthetic data set. Each segment represents\n",
341341
"# a collection of data points generated from either a fixed distribution\n",
@@ -397,7 +397,7 @@
397397
"metadata": {
398398
"id": "8e6f4f59-c6e5-4991-84d9-14eab18eb699"
399399
},
400-
"outputs": [],
400+
"outputs": [{"output_type": "stream", "name": "stdout", "text": ["\n"]}],
401401
"source": [
402402
"plt.figure(figsize=(12, 4))\n",
403403
"plt.xlim(0, 1000)\n",
@@ -422,7 +422,7 @@
422422
"metadata": {
423423
"id": "11017009-f97e-4805-9cbb-6a9d4ddb68d3"
424424
},
425-
"outputs": [],
425+
"outputs": [{"output_type": "stream", "name": "stdout", "text": ["\n"]}],
426426
"source": [
427427
"def create_topic_if_not_exists(project_id:str, topic_name:str, enable_message_ordering=False):\n",
428428
" if enable_message_ordering:\n",
@@ -465,7 +465,7 @@
465465
"metadata": {
466466
"id": "66784c36-9f9e-410e-850b-3b8da29ff5ce"
467467
},
468-
"outputs": [],
468+
"outputs": [{"output_type": "stream", "name": "stdout", "text": ["\n"]}],
469469
"source": [
470470
"# for input data\n",
471471
"input_publisher = create_topic_if_not_exists(PROJECT_ID, INPUT_TOPIC, True)\n",
@@ -493,7 +493,7 @@
493493
"metadata": {
494494
"id": "907f2469-1687-4ef3-bafd-9c4ec963b7e9"
495495
},
496-
"outputs": [],
496+
"outputs": [{"output_type": "stream", "name": "stdout", "text": ["\n"]}],
497497
"source": [
498498
"def publish_data(publisher, project_id: str, topic: str, data: Iterable[Any], delay=0.01, enable_message_ordering=False) -> None:\n",
499499
" topic_path = publisher.topic_path(project_id, topic)\n",
@@ -534,7 +534,7 @@
534534
"scrolled": true,
535535
"id": "6e8b069d-9d94-4938-a87e-bd5f9f7620c0"
536536
},
537-
"outputs": [],
537+
"outputs": [{"output_type": "stream", "name": "stdout", "text": ["\n"]}],
538538
"source": [
539539
"def message_to_beam_row(msg: bytes) -> beam.Row:\n",
540540
" try:\n",
@@ -591,7 +591,7 @@
591591
"metadata": {
592592
"id": "e4ca8af3-d74c-4d95-aeba-c34cb791525f"
593593
},
594-
"outputs": [],
594+
"outputs": [{"output_type": "stream", "name": "stdout", "text": ["\n"]}],
595595
"source": [
596596
"x = []\n",
597597
"y = []\n",
@@ -605,7 +605,7 @@
605605
"metadata": {
606606
"id": "b6bf369f-2b20-4834-b457-e9b1f0a596ca"
607607
},
608-
"outputs": [],
608+
"outputs": [{"output_type": "stream", "name": "stdout", "text": ["\n"]}],
609609
"source": [
610610
"def collect_result(subscriber):\n",
611611
" subscription_path = pubsub_v1.SubscriberClient.subscription_path(PROJECT_ID, OUTPUT_SUB)\n",
@@ -646,7 +646,7 @@
646646
"metadata": {
647647
"id": "a3433ea1-70ae-408d-84b2-27118a3fd898"
648648
},
649-
"outputs": [],
649+
"outputs": [{"output_type": "stream", "name": "stdout", "text": ["\n"]}],
650650
"source": [
651651
"# Refresh this cell until we see results from the output pubsub\n",
652652
"print(len(x))"
@@ -659,7 +659,7 @@
659659
"metadata": {
660660
"id": "31f24bfc-b91d-4e67-b804-732dc65e7525"
661661
},
662-
"outputs": [],
662+
"outputs": [{"output_type": "stream", "name": "stdout", "text": ["\n"]}],
663663
"source": [
664664
"# When we see the output, run this cell. It will generate a plot every 5 seconds\n",
665665
"# to show how the data stream is processed.\n",
@@ -704,7 +704,7 @@
704704
"metadata": {
705705
"id": "350b8b1a-3010-4ecd-924f-010308bb5eb2"
706706
},
707-
"outputs": [],
707+
"outputs": [{"output_type": "stream", "name": "stdout", "text": ["\n"]}],
708708
"source": [
709709
"# deleting input and output subscriptions\n",
710710
"subscriber = pubsub_v1.SubscriberClient()\n",
@@ -731,7 +731,7 @@
731731
"metadata": {
732732
"id": "10dc95cf-94ab-4a51-882b-88559340d4d2"
733733
},
734-
"outputs": [],
734+
"outputs": [{"output_type": "stream", "name": "stdout", "text": ["\n"]}],
735735
"source": [
736736
"# deleting input and output topics\n",
737737
"publisher = pubsub_v1.PublisherClient()\n",
@@ -776,4 +776,4 @@
776776
},
777777
"nbformat": 4,
778778
"nbformat_minor": 5
779-
}
779+
}

0 commit comments

Comments
 (0)