ミニ四駆でPython on Windows Azure

53
PyConJP 2012 藤原 敬弘/高橋 道也/武田 正樹

description

PyConJP 2012の発表資料です。ミニ四駆とWindows Azureを繋げて、ラップタイムを取ってみました。

Transcript of ミニ四駆でPython on Windows Azure

Page 1: ミニ四駆でPython on Windows Azure

PyConJP 2012

藤原 敬弘/高橋 道也/武田 正樹

Page 2: ミニ四駆でPython on Windows Azure

ミニ四駆の作り方

Takahiro Fujiwara

Page 3: ミニ四駆でPython on Windows Azure

お前だれよ

• 名前o 藤原敬弘 (Takahiro Fujiwara)

• 仕事

o Fuller, Inc. CMO

• 作ってるサービスo ぼく、スマホ

o KINECTミニ四駆

• 使ってるライブラリ

o Python

Pyramid / Fabric / Cornice / Cuisine / Scrapy /

Gunicorn ...etc

Page 4: ミニ四駆でPython on Windows Azure

ミニ四駆に必要なもの

Page 5: ミニ四駆でPython on Windows Azure

それは

Page 6: ミニ四駆でPython on Windows Azure

グレードアップパーツ!

Page 7: ミニ四駆でPython on Windows Azure

グレードアップパーツの紹介

Page 8: ミニ四駆でPython on Windows Azure

KINECTミニ四駆グレードアップパーツ

Page 9: ミニ四駆でPython on Windows Azure

ミニ四駆PRO x1

¥700

Page 10: ミニ四駆でPython on Windows Azure

Arduino Pro Mini x1

¥2,500

Page 11: ミニ四駆でPython on Windows Azure

Hブリッジモジュール x1

¥300

Page 12: ミニ四駆でPython on Windows Azure

Bluetoothモジュール x1

¥6,000

Page 13: ミニ四駆でPython on Windows Azure

カメラ用リチウム電池 x2

¥400

Page 14: ミニ四駆でPython on Windows Azure

KINECT

¥12,000

Page 15: ミニ四駆でPython on Windows Azure

ネットワークラップタイマーグレードアップパーツ

Page 16: ミニ四駆でPython on Windows Azure

Arduino UNO x1

¥2,500

Page 17: ミニ四駆でPython on Windows Azure

赤外線LED

¥100

Page 18: ミニ四駆でPython on Windows Azure

赤外線センサー x1

¥500

Page 19: ミニ四駆でPython on Windows Azure

Ethernetモジュール x1

¥3,500

Page 20: ミニ四駆でPython on Windows Azure

ミニ四魂

priceless

Page 21: ミニ四駆でPython on Windows Azure

ミニ四魂priceless

Page 22: ミニ四駆でPython on Windows Azure

大事なことなので二回言いました

Page 23: ミニ四駆でPython on Windows Azure

ミニ四駆 Python on

Azureアーキテクチャ

Page 24: ミニ四駆でPython on Windows Azure

ミニ四駆 Python on Azure アーキテクチャ

Page 25: ミニ四駆でPython on Windows Azure

KINNECT ミニ四駆

Page 26: ミニ四駆でPython on Windows Azure

ソースコード

https://github.com/wutali/mini4wd_motor_drive

Page 27: ミニ四駆でPython on Windows Azure

ネットワークラップタイマー

Page 28: ミニ四駆でPython on Windows Azure

https://github.com/wutali/mini4wd_lap_timer

ソースコード

Page 29: ミニ四駆でPython on Windows Azure

使用上のご注意

• この改造はミニ四駆のスピードアップを目的としていません。o ミニ四駆のスピードはモーターと電池、ガイドロー

ラー、タイヤに依存します。

• 公式大会には出場できません。o ArduinoとHブリッジモジュールがタミヤから発売さ

れれば、出場できる可能性があります。

• 隠し機能が搭載されています。o ソースコードを読むとわかりますが、無駄にバック

出来ます。

• 組立には高度なテクニックが必要です。o Arduino Pro Miniを埋め込むために肉抜きのテクニ

ックが必要です。

Page 30: ミニ四駆でPython on Windows Azure

Sep. 2012

高橋 道也

Page 31: ミニ四駆でPython on Windows Azure

お前だれよ

名前: 高橋 道也

勤務先: 東洋ソフトウェアエンジニアリング株式会社

Twitter: @michiyata

Page 32: ミニ四駆でPython on Windows Azure

Windows AzureでPython

今年6月よりWindows Azureのサポート言語にPythonが正式に追加、今のところ2つの実行方法がある

1. Virtual Machines (IaaS)初期状態のLinux/Windows Serverに対し、必要なソフトウェアのセットアップとアプリ配置を自力で行う

2. Cloud Services (PaaS)専用のSDKでパッケージングしたアプリをクラウド専用構成のWindows Server上に配布

Page 33: ミニ四駆でPython on Windows Azure

Virtual Machines (IaaS)

• Linux OSを選択した場合はおそらく多くのPythonエンジニアにとってお馴染みの方法

• 複数インスタンスへのアプリ配置の仕組みなどは必要に応じて自作する必要あり

Page 34: ミニ四駆でPython on Windows Azure

Cloud Services (PaaS)

• 独特の世界、ある程度の慣れが必要

–インスタンスの構成、設定ファイル、ツール

• 複数インスタンスへのアプリ配布やOSセキュリティパッチ適用は自動で行われる

Page 35: ミニ四駆でPython on Windows Azure

開発用端末について

• PaaS用アプリのパッケージングにWindows Azure SDK(無償)が必要なため、PaaSの場合はWindows端末が必須

• Azure SQL DatabaseやAzure Storage等の周辺サービスを使う場合はWindows専用のツール類が使えると便利だが、Mac/Linuxの場合でもWebベースのツールが利用可能

• サービス管理用のCUIツールはMac/Linux用向けにも提供されている

Page 36: ミニ四駆でPython on Windows Azure

Python Tools for Visual Studio

• Visual Studio開発チームが作成・公開している、VS 2010にPython IDEとしての機能を追加するためのアドオン

• Windows Azure関連のアプリ設定やデプロイもVS上で行える

• 無償のIntegrated Shell版VS+PTVSをWeb Platfrom Installerより入手可能

Page 37: ミニ四駆でPython on Windows Azure

今回のデモアプリの構成

• PaaSで構築

• Python 2.7

• Django 1.4

• IIS 7.5

• Windows Azure SQL Database

• Windows Azure Storage

Page 38: ミニ四駆でPython on Windows Azure

PTVSでPaaS用Pythonアプリを作る際の注意点

• Djangoアプリのみ作成可能

• Python2.7(32bit)、Django1.4固定

• Djangoプロジェクトのフォルダ構成がなぜか古い

• インスタンス上にデフォルト導入されているSQL Serverドライバが古い

など

Page 39: ミニ四駆でPython on Windows Azure

VSなしでPaaS版Pythonを使いたい場合

Django用のパッケージ雛形をGitHubで公開していますのでご興味のある方はどうぞ

https://github.com/michiya/azure-django-role

• VS不要、ただしWindows Azure SDKは別途必要

• インスタンス上でのフォルダ構成が多少異なる以外、VS+PTVSを使った場合とほぼ同一の構成で動作

• パッケージを少しカスタマイズすればWSGI準拠フレームワークは動く(はず)

Page 40: ミニ四駆でPython on Windows Azure

まとめ

• IaaSでLinuxを使う場合はWindows Azureだからといって特別なことはほとんどない

• PaaSを使う場合は多少の慣れが必要かも

Page 41: ミニ四駆でPython on Windows Azure

「Windows AzureでPython」ハンズオン

9/17 Sprintにて行います!• 所要時間は1〜2時間程度です• 全3回、各回10人程度まで• Windows Azure初心者の方向けの内容です• サブスクリプションの準備は不要です• Macの方でも参加頂ける内容です

お気軽にお越しください!

Page 42: ミニ四駆でPython on Windows Azure

Thank you!

• ご興味のある方はぜひこの機会にWindows Azureを試してみてください!

Page 43: ミニ四駆でPython on Windows Azure

お前、誰よ

武田 正樹(たけだ まさき)

日本マイクロソフト株式会社

@masakit555

Windows Azure エバンジェリスト

Page 44: ミニ四駆でPython on Windows Azure
Page 45: ミニ四駆でPython on Windows Azure

Windows Azure のデータセンター

Page 46: ミニ四駆でPython on Windows Azure

Windows Azure

大規模〜小規模の様々なニーズに対応可能

Page 47: ミニ四駆でPython on Windows Azure

VM with persistent drive

データの可用性

Page 48: ミニ四駆でPython on Windows Azure

VM with persistent drive

Page 49: ミニ四駆でPython on Windows Azure

VM with persistent drive

Page 50: ミニ四駆でPython on Windows Azure

> 500 miles

Page 51: ミニ四駆でPython on Windows Azure

スケーラビリティ- スケールアップ -

VMサイズ CPU コア数 メモリ 帯域 データディスク

Extra Small 共有 768MB 5Mbps 1

Small 1 1.75GB 100Mbps 2

Medium 2 3.5GB 200Mbps 4

Large 4 7GB 400Mbps 8

Extra Large 8 14GB 800Mbps 16

Page 52: ミニ四駆でPython on Windows Azure

スケーラビリティ- スケールアウト -

Page 53: ミニ四駆でPython on Windows Azure

学びの秋はハンズオンでスキルアップ♪