{"id":36888,"date":"2019-10-31T22:14:33","date_gmt":"2019-10-31T19:14:33","guid":{"rendered":"https:\/\/prohoster.info\/blog\/sozdaem-konvejer-potokovoj-obrabotki-dannyh-chast-2\/"},"modified":"2019-10-31T22:14:33","modified_gmt":"2019-10-31T19:14:33","slug":"sozdaem-konvejer-potokovoj-obrabotki-dannyh-chast-2","status":"publish","type":"post","link":"https:\/\/prohoster.info\/de\/blog\/administrirovanie\/sozdaem-konvejer-potokovoj-obrabotki-dannyh-chast-2","title":{"rendered":"Wir erstellen eine Datenstreamverarbeitungs-Pipeline. Teil 2","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<p>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442. \u0414\u0435\u043b\u0438\u043c\u0441\u044f \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u043e\u043c \u0437\u0430\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0442\u0430\u0442\u044c\u0438, \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u043e\u0432 \u043a\u0443\u0440\u0441\u0430 <noindex><a rel=\"nofollow\" href=\"https:\/\/otus.pw\/8dKc\/\">\u00abData Engineer\u00bb<\/a><\/noindex>. \u0421 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u044c\u044e \u043c\u043e\u0436\u043d\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f <noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/company\/otus\/blog\/454186\/\">\u0442\u0443\u0442<\/a><\/noindex>.<\/p>\n<p><b><i>Apache Beam \u0438 DataFlow \u0434\u043b\u044f \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u043e\u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438<\/i><\/b><\/p>\n<p><img decoding=\"async\" alt=\"\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440 \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u0427\u0430\u0441\u0442\u044c 2\" src=\"\/wp-content\/uploads\/2019\/08\/0c42ad708e93b6954aaeb3be97b0c8ad.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<\/p>\n<h2>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Google Cloud<\/h2>\n<p><\/p>\n<blockquote><p>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u0414\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430 \u0438 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u043b\u043e\u0433\u0430 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b Google Cloud Shell, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0443 \u043c\u0435\u043d\u044f \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430 \u043d\u0430 Python 3. Google Cloud Shell \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 Python 2, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043b\u0443\u0447\u0448\u0435 \u0441\u043e\u0433\u043b\u0430\u0441\u0443\u0435\u0442\u0441\u044f \u0441 Apache Beam.<\/p><\/blockquote>\n<p>\n\u0427\u0442\u043e\u0431\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043a\u043e\u043f\u0430\u0442\u044c\u0441\u044f \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445. \u0422\u0435\u043c \u0438\u0437 \u0432\u0430\u0441, \u043a\u0442\u043e \u0440\u0430\u043d\u044c\u0448\u0435 \u043d\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f GCP, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 6 \u0448\u0430\u0433\u043e\u0432, \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u043d\u0430 \u044d\u0442\u043e\u0439 <noindex><a rel=\"nofollow\" href=\"https:\/\/cloud.google.com\/dataflow\/docs\/quickstarts\/quickstart-python\">\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435<\/a><\/noindex>.<noindex><a rel=\"nofollow\" name=\"habracut\"><\/a><\/noindex><\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043d\u0430\u0448\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0432 \u043e\u0431\u043b\u0430\u0447\u043d\u043e\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 Google \u0438 \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u0432 \u043d\u0430\u0448\u0443 Google Cloud Shel. \u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0432 \u043e\u0431\u043b\u0430\u0447\u043d\u043e\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u0430 (\u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 <noindex><a rel=\"nofollow\" href=\"https:\/\/cloud.google.com\/storage\/docs\/uploading-objects\">\u0437\u0434\u0435\u0441\u044c<\/a><\/noindex>). \u0427\u0442\u043e\u0431\u044b \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0448\u0438 \u0444\u0430\u0439\u043b\u044b, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0442\u043a\u0440\u044b\u0442\u044c Google Cloud Shel \u0438\u0437 \u043f\u0430\u043d\u0435\u043b\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u0449\u0435\u043b\u043a\u043d\u0443\u0432 \u043f\u0435\u0440\u0432\u044b\u0439 \u0437\u043d\u0430\u0447\u043e\u043a \u0441\u043b\u0435\u0432\u0430 \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435 2 \u043d\u0438\u0436\u0435.<\/p>\n<p><img decoding=\"async\" alt=\"\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440 \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u0427\u0430\u0441\u0442\u044c 2\" src=\"\/wp-content\/uploads\/2019\/08\/16d0c8caab802ce2d07281ed5dd73aac.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<i>\u0420\u0438\u0441\u0443\u043d\u043e\u043a 2<\/i><\/p>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u044b \u0434\u043b\u044f \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432 \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u044b \u043d\u0438\u0436\u0435.<\/p>\n<pre><code class=\"python\"># Copy file from cloud storage\ngsutil cp gs:\/\/&lt;YOUR-BUCKET&gt;\/ * .\nsudo pip install apache-beam[gcp] oauth2client==3.0.0\nsudo pip install -U pip\nsudo pip install Faker==1.0.2\n# Environment variables\nBUCKET=&lt;YOUR-BUCKET&gt;\nPROJECT=&lt;YOUR-PROJECT&gt;<\/code><\/pre>\n<p><\/p>\n<h2>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u0430\u0448\u0435\u0439 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b<\/h2>\n<p>\n\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043b\u0438 \u0432\u0441\u0435 \u0448\u0430\u0433\u0438, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u043e\u0439, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u044d\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0432 BigQuery. \u0415\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e, \u043d\u043e \u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0441\u043e\u043b\u044c Google Cloud, \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0432 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 <noindex><a rel=\"nofollow\" href=\"https:\/\/cloud.google.com\/bigquery\/docs\/tables\">\u0441\u0441\u044b\u043b\u043a\u0435<\/a><\/noindex>, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0441\u043e \u0441\u0445\u0435\u043c\u043e\u0439. \u041d\u0430\u0448\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c <b>7 \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432<\/b>, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u043c \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u043b\u043e\u0433\u0430. \u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0432\u0441\u0435 \u0441\u0442\u043e\u043b\u0431\u0446\u044b \u043a\u0430\u043a \u0441\u0442\u0440\u043e\u043a\u0438 (\u0442\u0438\u043f string), \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 timelocal, \u0438 \u043d\u0430\u0437\u043e\u0432\u0435\u043c \u0438\u0445 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0440\u0430\u043d\u0435\u0435. \u0421\u0445\u0435\u043c\u0430 \u043d\u0430\u0448\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043a\u0430\u043a \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435 3.<\/p>\n<p><img decoding=\"async\" alt=\"\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440 \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u0427\u0430\u0441\u0442\u044c 2\" src=\"\/wp-content\/uploads\/2019\/08\/0b86faf8921f14476e311822f1e1a864.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<i>\u0420\u0438\u0441\u0443\u043d\u043e\u043a 3. \u0421\u0445\u0435\u043c\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b<\/i><\/p>\n<h2>\u041f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u043b\u043e\u0433\u0430<\/h2>\n<p>\nPub\/Sub \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0430\u0436\u043d\u044b\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u043c \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0434\u0440\u0443\u0433 \u0441 \u0434\u0440\u0443\u0433\u043e\u043c. \u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u0430\u043a \u043f\u043e\u0441\u0440\u0435\u0434\u043d\u0438\u043a, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u043d\u0430\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c\u0438. \u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u044d\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u0435\u043c\u0443 (topic). \u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u0432 Pub\/Sub \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0438 \u043d\u0430\u0436\u0430\u0442\u044c CREATE TOPIC.<\/p>\n<p>\u041f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u043d\u0438\u0436\u0435 \u043a\u043e\u0434 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430\u0448 \u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043b\u043e\u0433\u0430, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0432\u044b\u0448\u0435, \u0430 \u0437\u0430\u0442\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0436\u0443\u0440\u043d\u0430\u043b\u044b \u0432 Pub\/Sub. \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u2014 \u044d\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 <b>PublisherClient<\/b>, \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0443\u0442\u044c \u043a \u0442\u0435\u043c\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430<code> topic_path<\/code> \u0438 \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>publish<\/code> \u0441 <code>topic_path<\/code> \u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u043c\u044b \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c <code>generate_log_line<\/code> \u0438\u0437 \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430 <code>stream_logs<\/code>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u044d\u0442\u0438 \u0444\u0430\u0439\u043b\u044b \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u043e\u0434\u043d\u043e\u0439 \u043f\u0430\u043f\u043a\u0435, \u0438\u043d\u0430\u0447\u0435 \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u043e\u0448\u0438\u0431\u043a\u0443 \u0438\u043c\u043f\u043e\u0440\u0442\u0430. \u0417\u0430\u0442\u0435\u043c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u044d\u0442\u043e \u0447\u0435\u0440\u0435\u0437 \u043d\u0430\u0448\u0443 google-\u043a\u043e\u043d\u0441\u043e\u043b\u044c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f:<\/p>\n<pre><code class=\"python\">python publish.py<\/code><\/pre>\n<p><\/p>\n<pre><code class=\"python\">from stream_logs import generate_log_line\nimport logging\nfrom google.cloud import pubsub_v1\nimport random\nimport time\n\n\nPROJECT_ID=\"user-logs-237110\"\nTOPIC = \"userlogs\"\n\n\npublisher = pubsub_v1.PublisherClient()\ntopic_path = publisher.topic_path(PROJECT_ID, TOPIC)\n\ndef publish(publisher, topic, message):\n    data = message.encode('utf-8')\n    return publisher.publish(topic_path, data = data)\n\ndef callback(message_future):\n    # When timeout is unspecified, the exception method waits indefinitely.\n    if message_future.exception(timeout=30):\n        print('Publishing message on {} threw an Exception {}.'.format(\n            topic_name, message_future.exception()))\n    else:\n        print(message_future.result())\n\n\nif __name__ == '__main__':\n\n    while True:\n        line = generate_log_line()\n        print(line)\n        message_future = publish(publisher, topic_path, line)\n        message_future.add_done_callback(callback)\n\n        sleep_time = random.choice(range(1, 3, 1))\n        time.sleep(sleep_time)<\/code><\/pre>\n<p>\n\u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0444\u0430\u0439\u043b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0441\u044f, \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434 \u0434\u0430\u043d\u043d\u044b\u0445 \u043b\u043e\u0433\u0430 \u043d\u0430 \u043a\u043e\u043d\u0441\u043e\u043b\u044c, \u043a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435 \u043d\u0438\u0436\u0435. \u042d\u0442\u043e\u0442 \u0441\u043a\u0440\u0438\u043f\u0442 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u043c\u044b \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c <b>CTRL+C<\/b>, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u0435\u0433\u043e.<\/p>\n<p><img decoding=\"async\" alt=\"\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440 \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u0427\u0430\u0441\u0442\u044c 2\" src=\"\/wp-content\/uploads\/2019\/08\/188aeedb9605dd9d3ba8ed15a29fc7a3.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<i>\u0420\u0438\u0441\u0443\u043d\u043e\u043a 4. \u0412\u044b\u0432\u043e\u0434 <code>publish_logs.py<\/code><br \/>\n<\/i><\/p>\n<h2>\u041d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043a\u043e\u0434\u0430 \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430<\/h2>\n<p>\n\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0432\u0441\u0435 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043b\u0438, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u0441\u0430\u043c\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u2014 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u043a\u043e\u0434\u0430 \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Beam \u0438 Python. \u0427\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c Beam-\u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430 (p). \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043e\u0434\u043d\u0443 \u0437\u0430 \u0434\u0440\u0443\u0433\u043e\u0439, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 <code>pipe (|)<\/code>. \u0412 \u043e\u0431\u0449\u0435\u043c, \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043a\u0430\u043a \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435 \u043d\u0438\u0436\u0435.<\/p>\n<pre><code class=\"python\">[Final Output PCollection] = ([Initial Input PCollection] | [First Transform]\n             | [Second Transform]\n             | [Third Transform])<\/code><\/pre>\n<p>\n\u0412 \u043d\u0430\u0448\u0435\u043c \u043a\u043e\u0434\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0434\u0432\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u0424\u0443\u043d\u043a\u0446\u0438\u044e <code>regex_clean<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043a\u0430\u043d\u0438\u0440\u0443\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 PATTERNS, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>re.search<\/code>. \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u0437\u0430\u043f\u044f\u0442\u044b\u043c\u0438 \u0441\u0442\u0440\u043e\u043a\u0443. \u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0435\u0441\u044c \u044d\u043a\u0441\u043f\u0435\u0440\u0442\u043e\u043c \u043f\u043e \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u043c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c, \u044f \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u0441\u044f \u0441 \u044d\u0442\u0438\u043c <noindex><a rel=\"nofollow\" href=\"https:\/\/www.machinelearningplus.com\/python\/python-regex-tutorial-examples\/\">\u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u043e\u043c<\/a><\/noindex> \u0438 \u043f\u043e\u043f\u0440\u0430\u043a\u0442\u0438\u043a\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0431\u043b\u043e\u043a\u043d\u043e\u0442\u0435, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043a\u043e\u0434. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0443\u044e ParDo-\u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c <b>Split<\/b>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0430\u0440\u0438\u0430\u0446\u0438\u0435\u0439 Beam-\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u043b\u044f \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438. \u0412 Python \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u043e\u0441\u043e\u0431\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u2014 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442\u0441\u044f \u043e\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 DoFn Beam. \u0424\u0443\u043d\u043a\u0446\u0438\u044f Split \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0440\u0430\u0441\u043f\u0430\u0440\u0448\u0435\u043d\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043b\u043e\u0432\u0430\u0440\u0435\u0439 \u0441 \u043a\u043b\u044e\u0447\u0430\u043c\u0438, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c\u0438 \u0438\u043c\u0435\u043d\u0430\u043c \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432 \u0432 \u043d\u0430\u0448\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 BigQuery. \u0415\u0441\u0442\u044c \u043a\u043e\u0435-\u0447\u0442\u043e, \u0447\u0442\u043e \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c \u043f\u0440\u043e \u044d\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e: \u043c\u043d\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c <code>datetime<\/code> \u0432\u043d\u0443\u0442\u0440\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0430. \u042f \u043f\u043e\u043b\u0443\u0447\u0430\u043b \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435 \u043f\u0440\u0438 \u0438\u043c\u043f\u043e\u0440\u0442\u0435 \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0444\u0430\u0439\u043b\u0430, \u0447\u0442\u043e \u0431\u044b\u043b\u043e \u0441\u0442\u0440\u0430\u043d\u043d\u043e. \u042d\u0442\u043e\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0437\u0430\u0442\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e <b>WriteToBigQuery<\/b>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0430\u0448\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443. \u041a\u043e\u0434 \u0434\u043b\u044f Batch DataFlow Job \u0438 Streaming DataFlow Job \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043d\u0438\u0436\u0435. \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u043f\u0430\u043a\u0435\u0442\u043d\u044b\u043c \u0438 \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u044b\u043c \u043a\u043e\u0434\u043e\u043c \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432 \u043f\u0430\u043a\u0435\u0442\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043c\u044b \u0447\u0438\u0442\u0430\u0435\u043c CSV \u0438\u0437 <code>src_path<\/code>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>ReadFromText<\/code> \u0438\u0437 Beam.<\/p>\n<h2>Batch DataFlow Job (\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043f\u0430\u043a\u0435\u0442\u043e\u0432)<\/h2>\n<p><\/p>\n<pre><code class=\"python\">import apache_beam as beam\nfrom apache_beam.options.pipeline_options import PipelineOptions\nfrom google.cloud import bigquery\nimport re\nimport logging\nimport sys\n\nPROJECT='user-logs-237110'\nschema = 'remote_addr:STRING, timelocal:STRING, request_type:STRING, status:STRING, body_bytes_sent:STRING, http_referer:STRING, http_user_agent:STRING'\n\n\nsrc_path = \"user_log_fileC.txt\"\n\ndef regex_clean(data):\n\n    PATTERNS =  [r'(^S+.[S+.]+S+)s',r'(?&lt;=[).+?(?=])',\n           r'\"(S+)s(S+)s*(S*)\"',r's(d+)s',r\"(?&lt;=[).d+(?=])\",\n           r'\"[A-Z][a-z]+', r'\"(http|https):\/\/[a-z]+.[a-z]+.[a-z]+']\n    result = []\n    for match in PATTERNS:\n      try:\n        reg_match = re.search(match, data).group()\n        if reg_match:\n          result.append(reg_match)\n        else:\n          result.append(\" \")\n      except:\n        print(\"There was an error with the regex search\")\n    result = [x.strip() for x in result]\n    result = [x.replace('\"', \"\") for x in result]\n    res = ','.join(result)\n    return res\n\n\nclass Split(beam.DoFn):\n\n    def process(self, element):\n        from datetime import datetime\n        element = element.split(\",\")\n        d = datetime.strptime(element[1], \"%d\/%b\/%Y:%H:%M:%S\")\n        date_string = d.strftime(\"%Y-%m-%d %H:%M:%S\")\n\n        return [{ \n            'remote_addr': element[0],\n            'timelocal': date_string,\n            'request_type': element[2],\n            'status': element[3],\n            'body_bytes_sent': element[4],\n            'http_referer': element[5],\n            'http_user_agent': element[6]\n    \n        }]\n\ndef main():\n\n   p = beam.Pipeline(options=PipelineOptions())\n\n   (p\n      | 'ReadData' &gt;&gt; beam.io.textio.ReadFromText(src_path)\n      | \"clean address\" &gt;&gt; beam.Map(regex_clean)\n      | 'ParseCSV' &gt;&gt; beam.ParDo(Split())\n      | 'WriteToBigQuery' &gt;&gt; beam.io.WriteToBigQuery('{0}:userlogs.logdata'.format(PROJECT), schema=schema,\n        write_disposition=beam.io.BigQueryDisposition.WRITE_APPEND)\n   )\n\n   p.run()\n\nif __name__ == '__main__':\n  logger = logging.getLogger().setLevel(logging.INFO)\n  main()<\/code><\/pre>\n<h2>Streaming DataFlow Job (\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043f\u043e\u0442\u043e\u043a\u0430)<\/h2>\n<pre><code class=\"python\">from apache_beam.options.pipeline_options import PipelineOptions\nfrom google.cloud import pubsub_v1\nfrom google.cloud import bigquery\nimport apache_beam as beam\nimport logging\nimport argparse\nimport sys\nimport re\n\n\nPROJECT=\"user-logs-237110\"\nschema = 'remote_addr:STRING, timelocal:STRING, request_type:STRING, status:STRING, body_bytes_sent:STRING, http_referer:STRING, http_user_agent:STRING'\nTOPIC = \"projects\/user-logs-237110\/topics\/userlogs\"\n\n\ndef regex_clean(data):\n\n    PATTERNS =  [r'(^S+.[S+.]+S+)s',r'(?&lt;=[).+?(?=])',\n           r'\"(S+)s(S+)s*(S*)\"',r's(d+)s',r\"(?&lt;=[).d+(?=])\",\n           r'\"[A-Z][a-z]+', r'\"(http|https):\/\/[a-z]+.[a-z]+.[a-z]+']\n    result = []\n    for match in PATTERNS:\n      try:\n        reg_match = re.search(match, data).group()\n        if reg_match:\n          result.append(reg_match)\n        else:\n          result.append(\" \")\n      except:\n        print(\"There was an error with the regex search\")\n    result = [x.strip() for x in result]\n    result = [x.replace('\"', \"\") for x in result]\n    res = ','.join(result)\n    return res\n\n\nclass Split(beam.DoFn):\n\n    def process(self, element):\n        from datetime import datetime\n        element = element.split(\",\")\n        d = datetime.strptime(element[1], \"%d\/%b\/%Y:%H:%M:%S\")\n        date_string = d.strftime(\"%Y-%m-%d %H:%M:%S\")\n        \n        return [{ \n            'remote_addr': element[0],\n            'timelocal': date_string,\n            'request_type': element[2],\n            'body_bytes_sent': element[3],\n            'status': element[4],\n            'http_referer': element[5],\n            'http_user_agent': element[6]\n    \n        }]\n\ndef main(argv=None):\n\n   parser = argparse.ArgumentParser()\n   parser.add_argument(\"--input_topic\")\n   parser.add_argument(\"--output\")\n   known_args = parser.parse_known_args(argv)\n\n\n   p = beam.Pipeline(options=PipelineOptions())\n\n   (p\n      | 'ReadData' &gt;&gt; beam.io.ReadFromPubSub(topic=TOPIC).with_output_types(bytes)\n      | \"Decode\" &gt;&gt; beam.Map(lambda x: x.decode('utf-8'))\n      | \"Clean Data\" &gt;&gt; beam.Map(regex_clean)\n      | 'ParseCSV' &gt;&gt; beam.ParDo(Split())\n      | 'WriteToBigQuery' &gt;&gt; beam.io.WriteToBigQuery('{0}:userlogs.logdata'.format(PROJECT), schema=schema,\n        write_disposition=beam.io.BigQueryDisposition.WRITE_APPEND)\n   )\n   result = p.run()\n   result.wait_until_finish()\n\nif __name__ == '__main__':\n  logger = logging.getLogger().setLevel(logging.INFO)\n  main()\n<\/code><\/pre>\n<p><\/p>\n<h2>\u0417\u0430\u043f\u0443\u0441\u043a \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430<\/h2>\n<p>\n\u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438. \u0415\u0441\u043b\u0438 \u0431\u044b \u043c\u044b \u0437\u0430\u0445\u043e\u0442\u0435\u043b\u0438, \u043c\u044b \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0435\u0433\u043e \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e \u0441 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430, \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e \u0432\u043e\u0439\u0434\u044f \u0432 GCP.<\/p>\n<pre><code class=\"python\">python -m main_pipeline_stream.py \n --input_topic \"projects\/user-logs-237110\/topics\/userlogs\" \n --streaming<\/code><\/pre>\n<p>\n\u041e\u0434\u043d\u0430\u043a\u043e \u043c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0435\u0433\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e DataFlow. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0438\u0436\u0435\u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b.<\/p>\n<ul>\n<li><code>project<\/code> \u2014 ID \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 GCP.<\/li>\n<li><code>runner<\/code> \u2014 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0432\u0430\u0448\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0438 \u0441\u043a\u043e\u043d\u0441\u0442\u0440\u0443\u0438\u0440\u0443\u0435\u0442 \u0432\u0430\u0448 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440. \u0414\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0432 \u043e\u0431\u043b\u0430\u043a\u0435 \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u043a\u0430\u0437\u0430\u0442\u044c DataflowRunner.<\/li>\n<li><code>staging_location<\/code> \u2014 \u043f\u0443\u0442\u044c \u043a \u043e\u0431\u043b\u0430\u0447\u043d\u043e\u043c\u0443 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0443 Cloud Dataflow \u0434\u043b\u044f \u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0438 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u043a\u043e\u0434\u0430, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u0443.<\/li>\n<li><code>temp_location<\/code> \u2014 \u043f\u0443\u0442\u044c \u043a \u043e\u0431\u043b\u0430\u0447\u043d\u043e\u043c\u0443 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0443 Cloud Dataflow \u0434\u043b\u044f \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u0437\u0430\u0434\u0430\u043d\u0438\u0439, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430.<\/li>\n<li><code>streaming<\/code><\/li>\n<\/ul>\n<p><\/p>\n<pre><code class=\"python\">python main_pipeline_stream.py \n--runner DataFlow \n--project $PROJECT \n--temp_location $BUCKET\/tmp \n--staging_location $BUCKET\/staging\n--streaming\n<\/code><\/pre>\n<p>\n\u041f\u043e\u043a\u0430 \u044d\u0442\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 \u0432\u043a\u043b\u0430\u0434\u043a\u0443 DataFlow \u0432 google-\u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0438 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430\u0448 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440. \u041a\u043b\u0438\u043a\u043d\u0443\u0432 \u043f\u043e \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0443, \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u0445\u043e\u0436\u0435\u0435 \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043e\u043a 4. \u0412 \u0446\u0435\u043b\u044f\u0445 \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u0432 \u043b\u043e\u0433\u0438, \u0430 \u0437\u0430\u0442\u0435\u043c \u0432 Stackdriver \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u044b\u0445 \u043b\u043e\u0433\u043e\u0432. \u042d\u0442\u043e \u043f\u043e\u043c\u043e\u0433\u043b\u043e \u043c\u043d\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u043e\u043c \u0432 \u0440\u044f\u0434\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432.<\/p>\n<p><img decoding=\"async\" alt=\"\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440 \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u0427\u0430\u0441\u0442\u044c 2\" src=\"\/wp-content\/uploads\/2019\/08\/e7e7796515d069a4db0b10faab763f86.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<i>\u0420\u0438\u0441\u0443\u043d\u043e\u043a 4: Beam-\u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440<\/i><\/p>\n<h2>\u0414\u043e\u0441\u0442\u0443\u043f \u043a \u043d\u0430\u0448\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u043c \u0432 BigQuery<\/h2>\n<p>\n\u0418\u0442\u0430\u043a, \u0443 \u043d\u0430\u0441 \u0443\u0436\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0437\u0430\u043f\u0443\u0449\u0435\u043d \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u044e\u0449\u0438\u043c\u0438 \u0432 \u043d\u0430\u0448\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u0443. \u0427\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u044d\u0442\u043e, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a BigQuery \u0438 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435. \u041f\u043e\u0441\u043b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043d\u0438\u0436\u0435 \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043f\u0435\u0440\u0432\u044b\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u043e\u043a \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445. \u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435, \u0445\u0440\u0430\u043d\u044f\u0449\u0438\u0435\u0441\u044f \u0432 BigQuery, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0441 \u043a\u043e\u043b\u043b\u0435\u0433\u0430\u043c\u0438 \u0438 \u043d\u0430\u0447\u0430\u0442\u044c \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u043d\u0430 \u0431\u0438\u0437\u043d\u0435\u0441-\u0432\u043e\u043f\u0440\u043e\u0441\u044b.<\/p>\n<pre><code class=\"python\">SELECT * FROM `user-logs-237110.userlogs.logdata` LIMIT 10;<\/code><\/pre>\n<p>\n<img decoding=\"async\" alt=\"\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440 \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u0427\u0430\u0441\u0442\u044c 2\" src=\"\/wp-content\/uploads\/2019\/08\/9bdbcfc62043e1d718e3d16d8c36e72d.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<i>\u0420\u0438\u0441\u0443\u043d\u043e\u043a 5: BigQuery<\/i><\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\n\u041d\u0430\u0434\u0435\u0435\u043c\u0441\u044f, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u043f\u043e\u0441\u0442 \u043f\u043e\u0441\u043b\u0443\u0436\u0438\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0438\u0441\u043a\u0430 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u043e\u043b\u0435\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c\u0438. \u0425\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0442\u0430\u043a\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u0434\u0430\u0435\u0442 \u043d\u0430\u043c \u043c\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432. \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u0447\u0430\u0442\u044c \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u043d\u0430 \u0432\u0430\u0436\u043d\u044b\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043b\u044e\u0434\u0435\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043d\u0430\u0448 \u043f\u0440\u043e\u0434\u0443\u043a\u0442? \u0420\u0430\u0441\u0442\u0435\u0442 \u043b\u0438 \u0441\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u0431\u0430\u0437\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439? \u0421 \u043a\u0430\u043a\u0438\u043c\u0438 \u0430\u0441\u043f\u0435\u043a\u0442\u0430\u043c\u0438 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430 \u043b\u044e\u0434\u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e? \u0418 \u0435\u0441\u0442\u044c \u043b\u0438 \u043e\u0448\u0438\u0431\u043a\u0438, \u0442\u0430\u043c \u0433\u0434\u0435 \u0438\u0445 \u0431\u044b\u0442\u044c \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e? \u042d\u0442\u043e \u0442\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b \u0434\u043b\u044f \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438. \u041d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0438\u0434\u0435\u0439, \u0432\u044b\u0442\u0435\u043a\u0430\u044e\u0449\u0438\u0445 \u0438\u0437 \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u043d\u0430 \u044d\u0442\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u044b, \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u0443\u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0434\u0443\u043a\u0442 \u0438 \u043f\u043e\u0432\u044b\u0441\u0438\u0442\u044c \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043d\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439.<\/p>\n<p>Beam \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u043b\u0435\u0437\u0435\u043d \u0434\u043b\u044f \u0442\u0430\u043a\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0443\u043f\u0440\u0430\u0436\u043d\u0435\u043d\u0438\u0439, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0438\u043c\u0435\u0435\u0442 \u0440\u044f\u0434 \u0434\u0440\u0443\u0433\u0438\u0445 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u0431\u0438\u0440\u0436\u0435\u0432\u044b\u043c \u0442\u0438\u043a\u0430\u043c \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0438 \u0441\u043e\u0432\u0435\u0440\u0448\u0430\u0442\u044c \u0441\u0434\u0435\u043b\u043a\u0438 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u0432, \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u044e\u0449\u0438\u0435 \u0441 \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u043d\u044b\u0445 \u0441\u0440\u0435\u0434\u0441\u0442\u0432, \u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0440\u0430\u0441\u0447\u0435\u0442 \u0443\u0440\u043e\u0432\u043d\u044f \u0442\u0440\u0430\u0444\u0438\u043a\u0430. \u0412\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0431\u044b\u0442\u044c \u0438\u0433\u0440\u043e\u0432\u043e\u0439 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0435\u0439, \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0449\u0435\u0439 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u0445 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0435\u0439 \u0435\u0435 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u043f\u0430\u043d\u0435\u043b\u0435\u0439 \u0434\u043b\u044f \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439. \u041b\u0430\u0434\u043d\u043e, \u0433\u043e\u0441\u043f\u043e\u0434\u0430, \u044d\u0442\u043e \u0442\u0435\u043c\u0430 \u0443\u0436\u0435 \u0434\u043b\u044f \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043f\u043e\u0441\u0442\u0430, \u0441\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0447\u0442\u0435\u043d\u0438\u0435, \u0430 \u0434\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u0445\u043e\u0447\u0435\u0442 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434, \u043d\u0438\u0436\u0435 \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043c\u043e\u0439 GitHub.<\/p>\n<p><noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/DFoly\/User_log_pipeline\">https:\/\/github.com\/DFoly\/User_log_pipeline<br \/>\n<\/a><\/noindex><\/p>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u0432\u0441\u0435. <noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/company\/otus\/blog\/454186\/\">\u0427\u0438\u0442\u0430\u0442\u044c \u043f\u0435\u0440\u0432\u0443\u044e \u0447\u0430\u0441\u0442\u044c<\/a><\/noindex>.<br \/>\n<br \/>\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a: <a content=\"nofollow\" rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/company\/otus\/blog\/462589\/\">habr.com<\/a><\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"excerpt":{"rendered":"<p>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442. \u0414\u0435\u043b\u0438\u043c\u0441\u044f \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u043e\u043c \u0437\u0430\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0442\u0430\u0442\u044c\u0438, \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u043e\u0432 \u043a\u0443\u0440\u0441\u0430 \u00abData Engineer\u00bb. \u0421 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u044c\u044e \u043c\u043e\u0436\u043d\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0442\u0443\u0442. Apache Beam \u0438 DataFlow \u0434\u043b\u044f \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u043e\u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Google Cloud \u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u0414\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430 \u0438 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u043b\u043e\u0433\u0430 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b Google Cloud Shell, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0443 \u043c\u0435\u043d\u044f \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430 \u043d\u0430 Python [&hellip;]<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"author":1,"featured_media":27638,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[688],"tags":[],"class_list":["post-36888","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-administrirovanie"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.10 - aioseo.com -->\n\t<meta name=\"description\" content=\"\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442. \u0414\u0435\u043b\u0438\u043c\u0441\u044f \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u043e\u043c \u0437\u0430\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0442\u0430\u0442\u044c\u0438, \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u043e\u0432 \u043a\u0443\u0440\u0441\u0430 \u00abData Engineer\u00bb. \u0421 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u044c\u044e \u043c\u043e\u0436\u043d\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0442\u0443\u0442. Apache Beam \u0438 DataFlow \u0434\u043b\u044f \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u043e\u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Google Cloud \u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u0414\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430 \u0438 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u043b\u043e\u0433\u0430 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b Google Cloud Shell, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0443 \u043c\u0435\u043d\u044f \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430 \u043d\u0430 Python\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Yuri Gagarin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/prohoster.info\/de\/blog\/administrirovanie\/sozdaem-konvejer-potokovoj-obrabotki-dannyh-chast-2\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.10\" \/>\n\t\t<meta property=\"og:locale\" content=\"de_DE\" \/>\n\t\t<meta property=\"og:site_name\" content=\"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"\ud83e\udd47\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440 \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u0427\u0430\u0441\u0442\u044c 2 | ProHoster\" \/>\n\t\t<meta property=\"og:description\" content=\"\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442. \u0414\u0435\u043b\u0438\u043c\u0441\u044f \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u043e\u043c \u0437\u0430\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0442\u0430\u0442\u044c\u0438, \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u043e\u0432 \u043a\u0443\u0440\u0441\u0430 \u00abData Engineer\u00bb. \u0421 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u044c\u044e \u043c\u043e\u0436\u043d\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0442\u0443\u0442. Apache Beam \u0438 DataFlow \u0434\u043b\u044f \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u043e\u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Google Cloud \u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u0414\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430 \u0438 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u043b\u043e\u0433\u0430 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b Google Cloud Shell, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0443 \u043c\u0435\u043d\u044f \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430 \u043d\u0430 Python\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/prohoster.info\/de\/blog\/administrirovanie\/sozdaem-konvejer-potokovoj-obrabotki-dannyh-chast-2\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"350\" \/>\n\t\t<meta property=\"og:image:height\" content=\"350\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2019-10-31T19:14:33+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2019-10-31T19:14:33+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"\ud83e\udd47Erstellen einer Datenstromverarbeitungs-Pipeline. Teil 2 | ProHoster","description":"Hallo zusammen. Wir teilen die \u00dcbersetzung des letzten Teils eines Artikels, der speziell f\u00fcr die Studenten des Kurses \"Data Engineer\" erstellt wurde. Den ersten Teil finden Sie hier. Apache Beam und DataFlow f\u00fcr Echtzeit-Pipelines Google Cloud einrichten Hinweis: Um die Pipeline zu starten und die Daten des benutzerdefinierten Logs zu ver\u00f6ffentlichen, habe ich Google Cloud Shell verwendet, da ich Probleme mit dem Start der Pipeline in Python hatte.","canonical_url":"https:\/\/prohoster.info\/de\/blog\/administrirovanie\/sozdaem-konvejer-potokovoj-obrabotki-dannyh-chast-2","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"de_DE","og:site_name":"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b","og:type":"article","og:title":"\ud83e\udd47\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440 \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u0427\u0430\u0441\u0442\u044c 2 | ProHoster","og:description":"\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442. \u0414\u0435\u043b\u0438\u043c\u0441\u044f \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u043e\u043c \u0437\u0430\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0442\u0430\u0442\u044c\u0438, \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u043e\u0432 \u043a\u0443\u0440\u0441\u0430 \u00abData Engineer\u00bb. \u0421 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u044c\u044e \u043c\u043e\u0436\u043d\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0442\u0443\u0442. Apache Beam \u0438 DataFlow \u0434\u043b\u044f \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u043e\u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Google Cloud \u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u0414\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430 \u0438 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u043b\u043e\u0433\u0430 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b Google Cloud Shell, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0443 \u043c\u0435\u043d\u044f \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430 \u043d\u0430 Python","og:url":"https:\/\/prohoster.info\/de\/blog\/administrirovanie\/sozdaem-konvejer-potokovoj-obrabotki-dannyh-chast-2","og:image":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:secure_url":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:width":350,"og:image:height":350,"article:published_time":"2019-10-31T19:14:33+00:00","article:modified_time":"2019-10-31T19:14:33+00:00","article:publisher":"https:\/\/www.facebook.com\/prohoster","article:author":"https:\/\/www.facebook.com\/prohoster"},"aioseo_meta_data":{"post_id":"36888","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"seo_analyzer_scan_date":"2026-01-22 05:12:20","breadcrumb_settings":null,"limit_modified_date":false,"reviewed_by":null,"ai":null,"created":"2021-03-01 01:37:22","updated":"2026-01-22 05:12:20"},"gt_translate_keys":[{"key":"link","format":"url"}],"_links":{"self":[{"href":"https:\/\/prohoster.info\/de\/wp-json\/wp\/v2\/posts\/36888","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/de\/wp-json\/wp\/v2\/comments?post=36888"}],"version-history":[{"count":0,"href":"https:\/\/prohoster.info\/de\/wp-json\/wp\/v2\/posts\/36888\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/prohoster.info\/de\/wp-json\/wp\/v2\/media\/27638"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/de\/wp-json\/wp\/v2\/media?parent=36888"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/de\/wp-json\/wp\/v2\/categories?post=36888"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/de\/wp-json\/wp\/v2\/tags?post=36888"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}