Foreverly

メモ帳

PyCon2017 一日目のれぽーと

PyCon2017 一日目

後日に動画とslideがまとまってくれると嬉しい。

英語のセッションばかり聴いていたらとっても難しかった。 VOES 稼働後 after VOES launchが一番おもしろかったです。 VOESという音ゲーを開発している台湾の人のセッションで ゲームのbackend開発でDB周りやCDN、キャッシュ周りの話をしてくれました。 メンテナンスの話ではF○Oの48時間メンテナンスをネタにしたりもしていました。

Industrial Test Automation with Asyncioでは asyncioの実装例周りを実際に書いておきたいと思います。 3.6系を勉強するならnon-blockingIOとか使いたい。。 以外とpyramid使いがいた気がします。人数としてはすくないですが。 Tornadoの話は特に聞かなかったです。

そういえばアンケートではPythonでWEBアプリを書いている人は3割ほどでした。 PyConはデータサイエンティストの集まりと化しているようです。 そもそもプロダクション環境でPythonでアプリをリリースしている企業が少ないということなんでしょう。 PHPRubyでアプリを書いて、分析基盤をPythonを使うという使い分けなのが多そう。

Keynote

Pythonは教育として使われる言語で、いろんな分野の人が使う共通言語になる データサイエンスはソフトウェア開発ではない。 解析に使うのはsoftware(ソフトウェア)なく、thoughtware(思考)である。 予測できることはほとんどない。「未来を予測する最もよい方法は、それを発明すること」byアランケイ ビジネスがオープンソースを好む理由。ベンダーロックインを防ぐ(特にデータ)。 また、自分たちの都合に合わせて変更、機能追加できる。 Pythonはレゴのようなもので組み立てていろんなものを作り上げることができる。

  • Peter Wang
    • Anacondaデータサイエンスエコシステムの製品エンジニアリングチームを率いている人。
  • Over 20 Million Downloards
  • Other Problebms in 2012
  • Pythonは人気がある
    • イブサンローランの香水のCMでIPython のプロンプトが出てくる
  • Why Python for Data
    • not system language but intended to teaching language for prototype
  • Pythonにはいくつかの部族がある
    • Analyst,Data Developer,programmerも使える共通言語
  • Data Science !=Software Development
  • Era of Data Literacy
  • A Few Predictions
    • 未来を予測する最もよい方法は、それを発明すること
  • Open Source and Developers
    • Pythonはレゴのようなもの
  • ビジネスがオープンソースを好む理由。ベンダーロックインを防ぐ(特にデータ)。また、自分たちの都合に合わせて変更、機能追加できる。
  • 解析に使う言語は'thoughtware'で'software'ではない

セッション

Industrial Test Automation with Asyncio

asyncio

  • Industry use
    • Railway Test Automation Project
    • Communication via TCP and UDP based protocals
  • How to talk to N computers at the same time?
  • Trying without Asyncio
  • import socket
  • とても長い、
  • Since the network is the bottleneck
  • and we only talk to
  • The Splution
  • socketモジュール使うより短く書けるよ
import asyncio

tasks - {
     machine.sya("Hello, hoe are you?")
     for maching is machines
}

await asyncio.wait(tasks)
  • The difference
    • In the second ecample ,there is no immediate ececution
    • Only promise creates"please
    • Calling asyncio,wait forces runtime ri ewaolce taskas
  • How do N things at the same time
    • Missing ingeedient Non-blocking IO
    • Many implementations pthread,libuOS level"kqueue,select,epoll
    • How t do N things at the same time
    • リクエスト⇔レスポンスを一台ずつやるのがblocking-IO
    • 一気に複数にリクエストを投げつけるのがnon-blockingIO
    • asyncioの使用例
Python asyncio sockets
reader, wtiter = loop.open_connvtion()
writer.senf(b'Hello, World)
awsit wruterr,drain(
  anser - await reader,read(199)
    )
  • Test Usage
    • シナリオ例
    • ABCからDへ同じパケットを送る
    • DhaAkaradakeケットを受け取るか、
  • slow and incorrect eith blocking I/O
    • In the eqal world
    • network devices do not wait
    • Now with non-blockingI/O
  • 正しい振る舞いだけでなく、テスト実行が3倍早くなった
  • Ecaluation
    • think about use cascadefind tools,and learng about best practices
    • apply,improce,share
  • Synchronoously
    • Code is easy to understand
    • No mental overhead for locking/transactions
    • Easy oo interface with existing
  • Asynchtronously
    • Specian sysntax needed asunc awaot
    • locking always necesary,even though single threaded
    • necessary for teatm to learn new programmin paradigm
  • What you should avoid
    • Using asyncio because It is fast I/ve been thereSpeedup onluy observable in I/O biund
    • If you mix COU and I/O bound rasks and need adcice taks to me
  • Why I like asyncio
    • Incerediblu powerful standard library
    • Easy to implement protocals o n TCP useing OOP:asyncoo.protocalo
    • Context managers for locking promitives
  • If you create something aweasome write a blof post
  • Got o your local python meetio and tals aavuoit Asynip
  • Contribute back to ppen souece :Rreport Bugs,Help Beginners,Write

Pythonで大量データ処理!PySparkを用いたデータ処理と分析のきほん

  • Apache Sparkの紹介
  • PythonといえばPyDataというくらいライブラリがそろっている
  • 大規模データを扱いたい、データ量がスケールしても動く仕組みがほしい
  • SparkはOSSの並列分散処理フレームワーク
    • 処理が失敗してもリカバリフレームワークがやってくれる
    • タスクのスケジューリングもやってくれる
    • サーバのスケールアウトによって、スループットが線形に近い形で向上する
    • リソース値用最適化ノク婦がされている
    • オンメモリベースの処理
    • JVMのオーバヘッドを改善sるProject Tungsten
    • キャッシュ、遅延評価
    • S[ark2.2だと3.4以上に対応
    • 機械学習やストリーム処理、処理の流れが見えるUI
    • サーバ一台でも動く
    • Spark2.2.0からpipでもインストールできたけど、localのみで分散処理はできない
    • Dockerでもお試しできる
  • Hadoopクラスタ上で動作する、Amazon EMRやGoogle DataProcなどのマネージドサービスを使うと楽
  • Sparkの3つのプログラミングモデル
  • RDDとDataframe
    • RDD,コレクション操作のように処理を記述する
    • DataframehaSQLライクに処理を記述する
    • Dataframeはオプティマいさによる最適化
    • Dataframenoオプティマイザによる最適化
    • 高地的な処理の順番に入れ替えれ実行してくれる
    • データソースによててはギル田処理をデータ・ソース側d行い必要なデータのみを読み込むようにする
  • RDD
    • ワーカーノードでの処理ではPythonプロセスで行われる
  • Dataframe
    • ワーカーノードでの処理はJVM上で行われる
    • ただしUDHはPytohonプロセスで実行される
  • パフォーマンス上の問題点
    • Iterator単位でのserializationとpythonプロセスへのパイプが発生
  • RDDPythonは遅い
  • DFだったらScalaと同じくらい
  • RDDの中でNumpyやScipyを使う
  • 集計結果をPandas DataFrameに変換してMatplitlibで可視化する
  • PySParkではppandas DataFrameとDparkDataFtaneの相互変換可能

  • Apache Arrow

    • データフォーマットの仕様とそれをりようするためのライブラリ
    • 異なる言語プロダクト感でのデータ連携コストを下げる
  • Apache Zeppelom
    • レコメンデーション、異常検知とか
  • DAたFrameをつかう 
  • 処理するデータ量を減らす
  • ストレージの利用
    • D3,HDFA
  • データフォーマットはParwuetを利用
  • メモリ
  • yarnによってコンテナが きっlareruera-ga
  • okiyasui

VOES 稼働後 after VOES launch

Hsueh-Tsung Kuo

how to resolve problems of mobile game server development and service maintenance

  • VOES
  • DBのアトミックを守る
  • database chache mechanism
    • redis or memchached in RAM:fast
  • AからBへのサーバへデータを移すとき
  • database server reliableを保つ
  • def gacha
  • FGOメンテナンス48時間突破
  • Python is so slow
  • from database to static failures
  • statistics
    • crontabでBigQueryを叩いて結果を初滅
    • 結果はGoogle Cloug Storageなどに突っ込む
  • Server operation with CSB
    • CDNでキャッシュミスしたらServerにリクエストを投げる
    • CDNのCache invalidationは不毛だしrevisionごとにURL作ろう
  • service downtime and update
  • timezone
    • TZ=Asia/Taipei
    • イベント処理には困らないからUTC使わない

Why you should do text analysis in python

Bhargav Srinivasa Desikan

https://github.com/hari-allamraju/pycon-talk-taxidata/tree/master/slides

  • why python
    • ease of use
    • regex,parsing, adn generators(pipeline text)
    • incredible suport in form of libraries
    • awesome community
  • why text proxessing
    • data everywhere
    • with machine learning,deep insights
    • fun - from a personal point of view
    • employability - from a progessinal point of view
  • so what can you do?
    • glean insights from your own text
    • chatbots
    • language translation
      • machine learning,deep learnings,tenserflow
    • research - especially in the humanities
  • where is the data
  • pre-processing
    • garbage in , garbage out
    • ease of reading and writing to files
    • also - libraried for pre-processing
  • machine learnng in text
    • gensim
      • トピック分析できるライブラリ
    • scikit- learn
    • keras/tensorflow
  • world embeddings
    • king - man + woman = Queen
  • computational linguitstics
    • Part of Speech tagging
    • Named Entity Recognition
  • Japanse relevance
    • spaCy has started alpha suppprt for Japanese
    • you can contribute and help expand it
    • as for ML, it is largely language agnostic
  • so now
    • python is great at quick and dirty text pre-processing
    • and has a great ,great library support
    • and woth data everywhere

PythonでOauthサーバを構築した話

設定やパラメータの話 規約があるので、規約どおりに実装しようという話

  • Tech bureau Coap.で働いている
  • APIの話
    • secret & key を利用する場合
    • OAuth(token)を利用する場合
  • OAuthサーバの作り方
  • OAuthとは
  • OAuth2.0の話
    • 日本語で規約がある
    • 全て規約が決まっている
  • 使ったもの
    • Python3
    • Pyramid
    • SQLArchemy
    • Nginx
  • トークン発行、利用、再発行
  • 名称、サービス名称
  • cliend_id
    • どのサーバに紐付ければいいのか
  • responce_type
  • state
    • なりすまし対策
  • redirect_url
    • リダイレクト用のURL必須ではない
  • 認証が通ったあと

How (and Why) We speak in Unicord

Devon Peticolas

  • Morse
    • Encording
  • Baudot
    • パンチカード
  • ASCⅡ
  • The 8th bit
    • Latin-1
    • Hebrew
    • Meanwhile in Japan
    • Kanji
    • Katakarna
    • AA
  • Japanese Encodeiisa
  • Unicodeはどの言語でもつかる
  • utf-8
  • utf-16
  • utf-32

Secrets of a WSGI master

Graham Dumpletonさん

  • WGSI == Web Server Gateway Interfaces
    • Webサーバとアプリをつなぐもの
  • WSGI is a specification for an Application Programming Interface
  • Friends don’t let friends use raw WSGI
  • django,Flask,Bottle,などなど
  • You still need a way to host a WSGI Application
  • The development servers builtin to a framework are not good enough
  • Installing mod_wsgi the easy way
    • pip install mod_wsgi
  • Run mod_wsgi from the command Line
    • mod_wsgi-express start-server wsgi.py
    • No Apache configuration required
  • Automatic code reloading
    • python manage.pu runmodwsgi –reload-on-changes
  • Friends don’t let friends use Python without a Python virtual enviroment
  • warpdrive
  • Same tools for development
    • warpdrive project mypyapp
    • warpdrive build
    • warpdrive start
  • Generate image with no Dockerfile
    • warpdrive image mypyapp
    • docker run –rm -p 80:8080 mypyapp
  • Source-to-Image
  • Embedded mode
  • Daemon mode
  • Request monitoring
  • Openshift
  • Friends don’t let friends use Windows for running Python web Applications
  • Friends don’t let friends use the mod_wsgi which comes packaged with the operating system
  • Friends don’t let friends use those other WSGI servers
  • Friends don’t let friends make things too complicated,simple is good

LT

ギャル語翻訳

  • pyladiesの人たちのプロジェクト
  • hack-a-thon
  • ニュースサイトをギャル語にした
  • Mecab,Tornado,Azure,Data ScirnceVM,Azure Redis cache
  • 辞書は手書き
  • Cheomeの拡張機能で設定
  • 辞書をディープラーニング化したい
  • ギャル語の情報を取得したい

ymyzk

  • 計測する
  • profileをつかう
  • wsgi_lineprof
  • PythonでISUCONかちましょう

Respect is built-in names

  • sum,idに代入しない
  • list に listを突っ込まない
  • dictにdictを突っ込まない
  • jsonjsonをつっこまない

誰でも簡単に暗号取引botができるライブラリを作った

  • Zaifbot

OSSFriday

  • OSSに貢献しよう

ローカル環境でもDockerをドカドカ使う

  • builderscon来年もやるらしい
  • テスト環境でも使うのはよい

Pythonの実装をみる

カラオケおじさん

  • 英日中の歌詞判別

ジョブフェア

  • モノタロウ
    • 東京オフィス作る
    • データ分析に基づき仕事をしている
  • Line
    • サーバレスでLINE botつくれる
  • Retty
  • iRidge
    • 何やっているかよくわからない会社

Closing

Pyconのスタッフ多い。40人ぐらい? 1クラス分以上いた気がする。