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
510
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
Transcript
13 slides
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
More Decks by Shuhei Ozawa
See All by Shuhei Ozawa
Amebaアフィリエイト基盤の GKEアーキテクチャと マイクロサービス
ozashu
0
290
production_ready_envoy
ozashu
2
1.2k
ログ・係数集約と可視化・分析
ozashu
0
170
Python for web architectures
ozashu
0
1k
インフラエンジニアのWEBアプリ入門
ozashu
1
8.2k
Other Decks in Technology
See All in Technology
Terraform 0 to 100:100個以上のリポジトリを常に最新にし続けるための自動化
sue445
3
1.4k
認知の質も文化醸成も。数年取り組んで見えてきた技術広報のKPI設計 / Tech PR KPIs: Lessons on Awareness Quality and Culture After Several Years
bitkey
PRO
0
230
クラウドでも使えるNetApp -現場目線での設計とクラウドバックアップの活用
ryutakondo
1
340
20261119_AgentCore
takuyay0ne
2
310
攻撃と守りは何が変わり、何が変わらないのか~最近の不正アクセスから考える、リスク評価と標準の使いどころ
oidfj
2
340
kubellの最新データ分析環境
kubell_hr
2
280
実測データからサービスの成長余力を測る。負荷シナリオ・テストデータ・限界値の設計
kazatohiei
1
190
Libérez Firefox et Thunderbird avec nos astuces
hellosct1
0
200
IP重複は"ランディングVPC"で受け止める ― PrivateLink と Transit Gatewayによるマルチテナント接続基盤の設計
hatahata021
3
280
Is the Website Dying?
miriamschwab
0
220
AI-DLCでソフトウェア開発の速さは 上がったのか?
rfdnxbro
0
170
ポケモンバトルのAIエージェント
koji_kawamura
0
270
Featured
See All Featured
Statistics for Hackers
jakevdp
799
230k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
970
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
350
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
580
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
850
Marketing to machines
jonoalderson
1
6k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
390
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Automating Front-end Workflow
addyosmani
1370
210k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Code Reviewing Like a Champion
maltzj
529
40k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k