Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
PyQではじめるPython
Search
Shuhei Ozawa
January 15, 2018
Technology
500
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
280
production_ready_envoy
ozashu
2
1.2k
ログ・係数集約と可視化・分析
ozashu
0
170
Python for web architectures
ozashu
0
1k
インフラエンジニアのWEBアプリ入門
ozashu
1
8.1k
Other Decks in Technology
See All in Technology
IoTデバイスを繋げるプロトコルMatterをAndroidで使用する方法
harutiro
0
120
MCPゲートウェイを作って運用してわかったこと — Agent時代の権限管理の現在地
mtpooh
10
3.3k
事業活動を AI Ready にする攻めと守りのデータエンジニアリング / data-engineering-for-ai-ready-business
pei0804
6
2.3k
「事実」を「計測」して、「解釈」する 〜AWS Lambdaのメモリ最適解の見つけ方〜
maimyyym
0
120
あなたの知らないAmazon VPC Route Server/Amazon VPC Route Server you don't know about
masakiokuda
2
240
実践! SRE × AI - ABEMA における AIOps -
tetsuya28
7
2.5k
オブザーバビリティを高める AI エージェント体験を考える / Designing AI Agent Experiences That Enhance Observability
aoto
PRO
2
320
並行性の問題を防げ!実践トランザクション入門
occhi
0
280
Snapshot Testing in Practice: Predictable and Reliable SwiftUI Views
fespinoza
0
160
自律型 AI をセキュアに実装!Gemini と MIG で作る動的コード実行環境
recruitengineers
PRO
1
230
AI時代のAPI開発を加速する品質ガードレール / API Quality Guardrails in the AI Era
yokawasa
0
170
「Docker Desktop不要の時代」は 来たのか?
ueponx
0
350
Featured
See All Featured
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.2k
Building AI with AI
inesmontani
PRO
1
1.3k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
610
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
2
2k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
970
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
How to Think Like a Performance Engineer
csswizardry
28
2.9k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
56
3.5k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2.2k
Designing Experiences People Love
moore
143
24k
Optimizing for Happiness
mojombo
378
71k
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