Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
PyQではじめるPython
Search
Shuhei Ozawa
January 15, 2018
Technology
480
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
PyQではじめるPython
LT資料
https://python-nyumon.connpass.com/event/71516/
Shuhei Ozawa
January 15, 2018
More Decks by Shuhei Ozawa
See All by Shuhei Ozawa
Amebaアフィリエイト基盤の GKEアーキテクチャと マイクロサービス
ozashu
0
260
production_ready_envoy
ozashu
2
1.2k
ログ・係数集約と可視化・分析
ozashu
0
160
Python for web architectures
ozashu
0
1k
インフラエンジニアのWEBアプリ入門
ozashu
1
8.1k
Other Decks in Technology
See All in Technology
気軽に使える"情報のハブ"としてのNotion活用 〜フロー情報の集積点 と、 Claude Code × Notion AI〜
syucream
1
200
AIネイティブな開発のサプライチェーンリスク対策 〜激動の開発現場でリスクに立ち向かう〜【ZennFes】
cscengineer
PRO
2
160
徹底討論!ECS vs EKS!
daitak
3
1.7k
Flow 不死:AI 時代 DevOps 的不變本質
cheng_wei_chen
2
510
MUSUBI 田中裕一『AIと共に行う「しごとのリデザイン」- スモールバックオフィス編』AI Ops Lab #4
musubi
0
310
LayerX コーポレートエンジニアリング室におけるサプライチェーンセキュリティへの取り組み / Supply Chain Security at LayerX Corporate Engineering
yuyatakeyama
3
840
本当の”仕事”を手放せる未来が見えた
mu7889yoon
0
130
AIに障害切り分けを全部やってもらった。 。 。 。
estie
0
150
WebGIS AI Agentの紹介
_shimizu
0
560
AIチャット検索改善の3週間
kworkdev
PRO
2
170
【FinOps】データドリブンな意思決定を目指して
z63d
0
350
5分でわかるDuckDB Quack
chanyou0311
3
250
Featured
See All Featured
Speed Design
sergeychernyshev
33
1.9k
Raft: Consensus for Rubyists
vanstee
141
7.6k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
170
Between Models and Reality
mayunak
4
350
Building the Perfect Custom Keyboard
takai
2
800
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
240
Tell your own story through comics
letsgokoyo
1
960
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.9k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Transcript
PyQͰ͡ΊΔPython Pythonೖऀͷू͍ #6 2018/01/16 - Ozawa Shuhei ( @oza_shu )
1
ࣗݾհ — খपฏ — @oza_shu — MSPۀք WEBαʔϏεͷαʔόӡ༻ Pythonೖऀͷू͍ #6
2018/01/16 - Ozawa Shuhei ( @oza_shu ) 2
PyQͱ — ࣸܦϕʔεͰ՝Λղ͍֮ͯ͑Δ — աڈͷ՝Ͱशͬͨจ๏෮ֶͯ͠शͰ͖Δ — ֶशΧϨϯμʔ͕Ͱ͖ͨ Pythonೖऀͷू͍ #6 2018/01/16
- Ozawa Shuhei ( @oza_shu ) 3
ֶशͰ͖Δ༰ — جຊతͳจ๏ — WebΞϓϦ(Django) — σʔλॲཧ(pandas) — ػցֶश Pythonೖऀͷू͍
#6 2018/01/16 - Ozawa Shuhei ( @oza_shu ) 4
PythonͰLinuxαʔόͱྑ͘ͳΔ — ΞϓϦΛಈ͔͍ͯ͠Δϓϩηεʹ͍ͭͯͬͱΓ͍ͨ — Ͳ͏ͬͯΞϓϦʹΞΫηε͍ͯ͠Δͷ͔Γ͍ͨ Pythonೖऀͷू͍ #6 2018/01/16 - Ozawa
Shuhei ( @oza_shu ) 5
ΞϓϦΛಈ͔͍ͯ͠Δϓϩηεʹ͍ͭͯͬͱΓ͍ͨ — OSϓϩηεΛɺϓϩηεʹׂΓৼΒΕͨPIDΛΈͯ ͱͯ͠ѻ͏ — ϓϩηε͕։͍ͨϑΝΠϧʹϑΝΠϧσΟεΫϦϓλׂ͕ ΓͯΒΕΔ Pythonೖऀͷू͍ #6 2018/01/16
- Ozawa Shuhei ( @oza_shu ) 6
ίʔυྫ(1) PIDΛΈͯΈΑ͏ # ݱࡏͷϓϩηεΛฦ͢ import os print ("My pid:", os.getpid())
$ python3 3_processes_have_pid.py My pid: 10592 Pythonೖऀͷू͍ #6 2018/01/16 - Ozawa Shuhei ( @oza_shu ) 7
psίϚϯυͰ֬ೝͰ͖Δ ps aux |grep zsh USER PID %CPU %MEM VSZ
RSS TT STAT STARTED TIME COMMAND root 74749 0.0 0.0 4296948 3016 s005 Ss 2:39AM 0:00.11 -zsh root 73439 0.0 0.0 4296948 3028 s003 Ss 2:19AM 0:00.11 -zsh root 63923 0.0 0.0 4296948 2980 s001 Ss+ 11:15PM 0:00.10 -zsh PID͔ΒSWAP༻ྔ͕ଟ͍ϓϩηεΛಛఆ $ grep VmSwap /proc/*/status |sort -k2 -r |head -n /proc/2121/status:VmSwap: 158284 kB /proc/16520/status:VmSwap: 154516 kB /proc/18192/status:VmSwap: 141116 kB Pythonೖऀͷू͍ #6 2018/01/16 - Ozawa Shuhei ( @oza_shu ) 8
ίʔυྫ(2) ϑΝΠϧσΟεΫϦϓλ # ϑΝΠϧσΟεΫϦϓλׂ͕ΓͯΒΕ͍ͯΔ͔ΈͯΈΑ͏ if __name__ == "__main__": with open("/etc/passwd")
as passwd: print(passwd.fileno()) # ϑΝΠϧΛด͡Δͱফ͑Δ $ python3 file_descriptors.py 3 Pythonೖऀͷू͍ #6 2018/01/16 - Ozawa Shuhei ( @oza_shu ) 9
ಛผͳϑΝΠϧσΟεΫϦϓλ — ඪ४ೖྗ → 0 — ඪ४ग़ྗ → 1 —
ඪ४Τϥʔग़ྗ → 2 >>> sys.stdin.fileno() 0 >>> sys.stdout.fileno() 1 >>> sys.stderr.fileno() 2 Pythonೖऀͷू͍ #6 2018/01/16 - Ozawa Shuhei ( @oza_shu ) 10
ᐆດͩͬͨॻ͖ํΛཧղͰ͖ΔΑ͏ʹͳͬͨ ! command >/dev/null 2>&1 ! command 2>&1 >/dev/null Pythonೖऀͷू͍
#6 2018/01/16 - Ozawa Shuhei ( @oza_shu ) 11
fork()ؾʹͳͬͯ͘Δ ϓϩηε͕Fork͞ΕΔͬͯͲ͏͍͏͜ͱ͚ͩͬ? ࢠϓϩηεϓϩηεͰΘΕ͍ͯΔશͯͷϝϞϦͷίϐʔΛҾ͖ܧ͙ ϑΝΠϧσΟεΫϦϓλ(ιέοτ) — socket,osϞδϡʔϧͳͲͰpreforkαʔόॻ͚Δ — ίϐʔɾΦϯɾϥΠτʢCoWɺCopy on Writeʣ
— ԿͰκϯϏϓϩηεͬͯͳΔΜ͚ͩͬ — ϓϩηεؒ௨৴ — ύΠϓॲཧ,ετϦʔϜ,ϝοηʔδ — γάφϧॲཧ — ϓϩηεάϧʔϓ,ηογϣϯάϧʔϓ Pythonೖऀͷू͍ #6 2018/01/16 - Ozawa Shuhei ( @oza_shu ) 12
·ͱΊ — PyQࣸܦΛ௨ͯ͠ͷֶशͳͷͰɺϓϩάϥϛϯάॳΊͨ ͔ΓͷਓʹΑͦ͞͏ — PythonΛ௨ͯ͡Linuxͱྑ͘ͳΕΔ — ϓϩηε͕Ͳ͏࣮ߦ͞Ε͍ͯΔͷ͔ͪΌΜͱཧղ͢Δॿ͚ ʹͳΔ Pythonೖऀͷू͍
#6 2018/01/16 - Ozawa Shuhei ( @oza_shu ) 13