๐Ÿ’ป 155

ํŒŒ์ด์ฌ venv๋ฅผ conda ์ฒ˜๋Ÿผ ์‚ฌ์šฉ

TL;DRUbuntu ๊ธฐ์ค€ venv๋ฅผ conda์™€ ๋น„์Šทํ•˜๊ฒŒ ์“ฐ๋Š” ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์ž‘์„ฑ.$HOME/~.venvs์— ํ™˜๊ฒฝ์„ ๋ชจ์•„์„œ ๊ด€๋ฆฌ.venv_create venv_activate venv_deactivate  ๋ฐฐ๊ฒฝ๊ฐœ์ธ์€ ์ƒ๊ด€์—†์ง€๋งŒ, conda๊ฐ€ ์œ ๋ฃŒํ™”๋˜์—ˆ๋‹ค.  Pricing | AnacondaAnaconda is the birthplace of Python data science. We are a movement of data scientists, data-driven enterprises, and open source communities.www.anaconda.com์ด ์ฐธ์— venv๋ฅผ ์จ๋ณด๊ธฐ๋กœ ํ•˜์˜€์œผ๋‚˜, ์™ ์ง€ ๋ถˆํŽธํ•ด conda์ฒ˜๋Ÿผ ์‚ฌ์šฉํ•˜๋„๋ก ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์ƒ์„ฑ(GPT)ํ–ˆ๋‹ค. ์Šคํฌ๋ฆฝํŠธ$HOME/.venvs/v..

ํŒŒ์ด์ฌ GIL : multithreading, multiprocessing

์•ˆ๋…•ํ•˜์„ธ์š”. ์ด ๋น„๋””์˜ค์—์„œ๋Š” Python์—์„œ ๋ฉ€ํ‹ฐํ”„๋กœ์„ธ์‹ฑ๊ณผ ๋ฉ€ํ‹ฐ์Šค๋ ˆ๋”ฉ์„ ๋น„๊ตํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. ์ด์ œ Python์˜ ๋ฉ€ํ‹ฐ์Šค๋ ˆ๋”ฉ๊ณผ ๊ด€๋ จํ•˜์—ฌ ๋‘ ๊ฐ€์ง€ ์ฃผ์žฅ์„ ๋งŽ์ด ๋“ฃ์Šต๋‹ˆ๋‹ค. ์ฒซ ๋ฒˆ์งธ๋Š” Python์ด ๋ฉ€ํ‹ฐ์Šค๋ ˆ๋“œ๋ฅผ ์ง€์›ํ•œ๋‹ค๋Š” ๊ฒƒ์ด๊ณ , ๋‘ ๋ฒˆ์งธ๋Š” Python์ด ๋ฉ€ํ‹ฐ์Šค๋ ˆ๋“œ๋ฅผ ์ง€์›ํ•˜์ง€ ์•Š๋Š”๋‹ค๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค. ๊ทธ๋ ‡๋‹ค๋ฉด ์–ด๋Š ๊ฒƒ์ด ๋งž์„๊นŒ์š”? ์ œ๊ฐ€ ์ƒ๊ฐํ•˜๊ธฐ์—๋Š” ์ •ํ™•ํ•œ ํ‘œํ˜„์€ Python์ด ๋ฉ€ํ‹ฐ์Šค๋ ˆ๋“œ๋ฅผ ์ง€์›ํ•˜์ง€๋งŒ ๋™์‹œ์— ์—ฌ๋Ÿฌ ์Šค๋ ˆ๋“œ๊ฐ€ ์‹คํ–‰๋  ์ˆ˜ ์—†๋‹ค๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค. ์ฆ‰, ๋‘ ๊ฐœ์˜ ์Šค๋ ˆ๋“œ๊ฐ€ ๋™์‹œ์— ์‹คํ–‰๋  ์ˆ˜๋Š” ์—†์Šต๋‹ˆ๋‹ค.๊ทธ๋ ‡๋‹ค๋ฉด ์Šค๋ ˆ๋“œ๋ž€ ๋ฌด์—‡์ผ๊นŒ์š”? ์ด๋ฅผ ์ดํ•ดํ•˜๊ธฐ ์œ„ํ•ด ๋จผ์ € ํ”„๋กœ์„ธ์Šค๊ฐ€ ๋ฌด์—‡์ธ์ง€ ์•Œ์•„์•ผ ํ•ฉ๋‹ˆ๋‹ค. ํ”„๋กœ์„ธ์Šค๋Š” ํ”„๋กœ๊ทธ๋žจ์˜ ์ธ์Šคํ„ด์Šค์ž…๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด, Firefox์˜ ์ธ์Šคํ„ด์Šค๋‚˜ ์—ฌ๋Ÿฌ ๊ฐœ์˜ Microsoft Word ์ธ์Šคํ„ด์Šค๊ฐ€ ์žˆ์„ ์ˆ˜..

ํŒŒ์ด์ฌ ๋น„๋™๊ธฐ ํ”„๋กœ๊ทธ๋ž˜๋ฐ

ํŒŒ์ด์ฌ Generator Generators - Python WikiGenerator functions allow you to declare a function that behaves like an iterator, i.e. it can be used in a for loop. Simplified Code The simplification of code is a result of generator function and generator expression support provided by Python. To illuswiki.python.org Coroutine ์ฝ”๋ฃจํ‹ด - ์œ„ํ‚ค๋ฐฑ๊ณผ, ์šฐ๋ฆฌ ๋ชจ๋‘์˜ ๋ฐฑ๊ณผ์‚ฌ์ „์œ„ํ‚ค๋ฐฑ๊ณผ, ์šฐ๋ฆฌ ๋ชจ๋‘์˜ ๋ฐฑ๊ณผ์‚ฌ์ „. ์ฝ”๋ฃจํ‹ด(coroutine)์€ ๋ฃจํ‹ด์˜ ์ผ์ข…์œผ๋กœ์„œ, ํ˜‘๋™ ๋ฃจํ‹ด์ด๋ผ ํ• ..

Finagle & Thrift

RPC๋ž€?์›๊ฒฉ ํ”„๋กœ์‹œ์ € ํ˜ธ์ถœ(remote procedure call, RPC)์€ ๋ณ„๋„์˜ ์›๊ฒฉ ์ œ์–ด๋ฅผ ์œ„ํ•œ ์ฝ”๋”ฉ ์—†์ด ๋‹ค๋ฅธ ์ฃผ์†Œ ๊ณต๊ฐ„์—์„œ ํ•จ์ˆ˜๋‚˜ ํ”„๋กœ์‹œ์ €๋ฅผ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ๊ฒŒํ•˜๋Š” ํ”„๋กœ์„ธ์Šค ๊ฐ„ ํ†ต์‹  ๊ธฐ์ˆ ์ด๋‹ค. ๋‹ค์‹œ ๋งํ•ด, ์›๊ฒฉ ํ”„๋กœ์‹œ์ € ํ˜ธ์ถœ์„ ์ด์šฉํ•˜๋ฉด ํ”„๋กœ๊ทธ๋ž˜๋จธ๋Š” ํ•จ์ˆ˜๊ฐ€ ์‹คํ–‰ ํ”„๋กœ๊ทธ๋žจ์— ๋กœ์ปฌ ์œ„์น˜์— ์žˆ๋“  ์›๊ฒฉ ์œ„์น˜์— ์žˆ๋“  ๋™์ผํ•œ ์ฝ”๋“œ๋ฅผ ์ด์šฉํ•  ์ˆ˜ ์žˆ๋‹ค.๊ฐ์ฒด ์ง€ํ–ฅ์˜ ์›์น™์„ ์‚ฌ์šฉํ•˜๋Š” ์†Œํ”„ํŠธ์›จ์–ด์˜ ๊ฒฝ์šฐ ์›๊ฒฉ ํ”„๋กœ์‹œ์ € ํ˜ธ์ถœ์„ ์›๊ฒฉ ํ˜ธ์ถœ(remote invocation) ๋˜๋Š” ์›๊ฒฉ ๋ฉ”์†Œ๋“œ ํ˜ธ์ถœ(remote method invocation)์ด๋ผ๊ณ  ์ผ์ปซ๋Š”๋‹ค.์ถœ์ฒ˜: ์œ„ํ‚ค๋ฐฑ๊ณผ RPC vs REST RPC์™€ REST ๋น„๊ต - API ์•„ํ‚คํ…์ฒ˜ ๊ฐ„์˜ ์ฐจ์ด์  - AWS์›๊ฒฉ ํ”„๋กœ์‹œ์ € ํ˜ธ์ถœ(RPC)๊ณผ REST๋Š” ๋ชจ๋‘ ์ธํ„ฐ๋„ท ํ†ต์‹ ์„ ์œ„ํ•ด ..

๐Ÿ’ป/MLOps 2024.05.09

Kubernetes API ํด๋ผ์ด์–ธํŠธ ์‚ฌ์šฉ

์ตœ๊ทผ ๋งŽ์€ ํŒ€์›๋“ค์ด ์„œ๋น„์Šค, ํŒŒ์ดํ”„๋ผ์ธ ๋‚ด์—์„œ k8s ํด๋Ÿฌ์Šคํ„ฐ์—์„œ ์ •๋ณด๋ฅผ ์–ป์–ด์™€์•ผ ํ•˜๋Š” ๊ฒฝ์šฐ, ์ด๋ฏธ์ง€ ๋‚ด์— kubectl์„ ์„ค์น˜ํ•˜๊ณ  ์ฝ”๋“œ์—์„œ kubectl ์ปค๋งจ๋“œ๋ฅผ string์œผ๋กœ ์ €์žฅํ•ด ์‚ฌ์šฉํ•˜๊ฑฐ๋‚˜(?) ์‹ฌ์ง€์–ด token๊ฐ’์„ string์œผ๋กœ ๋ฐ•์•„ ๋„ฃ์œผ๋ ค๋Š”(!) ์‹œ๋„๋ฅผ ํ•˜๊ณ  ์žˆ์Œ์„ ๊นจ๋‹ฌ์•˜๋‹ค. ์ด ๋ถ€๋ถ„์„ ๋ฐ”๋กœ ์žก์œผ๋ฉฐ, ์‚ฌ๋žŒ๋“ค์—๊ฒŒ ์–ด๋–ค ๋ฌธ์˜๋ฅผ ๋งŽ์ด ๋ฐ›์•˜๋Š”์ง€๋ฅผ ๋ฐ”ํƒ•์œผ๋กœ ์ •๋ฆฌํ•ด๋ณด๊ณ ์ž ํ•œ๋‹ค. kubectl์„ ์ด๋ฏธ์ง€ ๋‚ด ์„ค์น˜ํ•œ๋‹ค(?) ์‚ฌ์‹ค ๋ถˆ๊ฐ€๋Šฅํ•œ ๋ฐฉ๋ฒ•์€ ์•„๋‹ˆ๋‹ค. ์ด๋ฏธ์ง€ ๋‚ด kubectl ๋ฐ”์ด๋„ˆ๋ฆฌ๋ฅผ ์„ค์น˜ํ•ด๋‘”๋‹ค. ์„œ๋น„์Šค๊ฐ€ ์‚ฌ์šฉํ•  ์ ์ ˆํ•œ ๊ถŒํ•œ์˜ ๊ณ„์ •์„ ์ถ”๊ฐ€ํ•˜๊ณ , kubeconfig๋ฅผ ์ƒ์„ฑํ•œ๋‹ค. configmap์œผ๋กœ kubeconfig๋ฅผ ๋งˆ์šดํŠธํ•œ๋‹ค. ์ด ๊ฒฝ์šฐ, ์ฝ”๋“œ ์—์„œ ์‹œ์Šคํ…œ ์ปค๋งจ๋“œ๋ฅผ ์‹คํ–‰ํ•˜๊ณ  ๊ฒฐ๊ณผ๋ฅผ ํŒŒ์‹ฑํ•ด์„œ ์‚ฌ์šฉํ•˜๊ฒŒ..

๐Ÿ’ป/MLOps 2024.02.23

stern : ๋ถ„์‚ฐ ์ฒ˜๋ฆฌ ํ”Œ๋žซํผ ๋ชจ๋‹ˆํ„ฐ๋ง

Stern GitHub - stern/stern: โŽˆ Multi pod and container log tailing for Kubernetes -- Friendly fork of https://github.com/wercker/ster โŽˆ Multi pod and container log tailing for Kubernetes -- Friendly fork of https://github.com/wercker/stern - stern/stern github.com Stern์€ ์—ฌ๋Ÿฌ ๊ฐœ์˜ Kubernetes ํŒŒ๋“œ ๋ฐ ํŒŒ๋“œ ๋‚ด์˜ ์—ฌ๋Ÿฌ ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์ถ”์ ํ•  ์ˆ˜ ์žˆ๋‹ค. ๊ฐ ๊ฒฐ๊ณผ๋Š” ๋น ๋ฅธ ๋””๋ฒ„๊น…์„ ์œ„ํ•ด ์ƒ‰์œผ๋กœ ๊ตฌ๋ถ„๋œ๋‹ค. ์—ฌ๋Ÿฌ ๊ฐœ์˜ ์ปดํฌ๋„ŒํŠธ๋ฅผ ๊ฐ€์ง„ ์„œ๋น„์Šค๋‚˜, ๋ถ„์‚ฐ ์ฒ˜๋ฆฌ ํ”Œ๋žซํผ์„ ๋ชจ๋‹ˆํ„ฐ๋งํ•  ๋•Œ ์œ ์šฉํ•˜๊ฒŒ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ..

๐Ÿ’ป/MLOps 2024.02.23

[k8s] `kubectl top`

`kubectl top` kubectl top pods -n spark kubectl top nodes ์œ„ ๋ช…๋ น์–ด๋กœ ํ•œ ๋ˆˆ์— ํŒŒ๋“œ๋ณ„๋กœ cpu, mem์„ ์–ผ๋งˆ๋‚˜ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๋Š”์ง€ ํ™•์ธ์ด ๊ฐ€๋Šฅํ•˜๋ฉฐ, ๋…ธ๋“œ๋ณ„๋กœ๋„ ์–ผ๋งˆ๋‚˜ ์ž์›์ด ์‚ฌ์šฉ์ค‘์ธ์ง€ ํ™•์ธ์ด ๊ฐ€๋Šฅํ•˜๋‹ค. ํด๋Ÿฌ์Šคํ„ฐ์— ๊ฒฝ๊ณ ๋‚˜ ์žฅ์• ๊ฐ€ ๋‚˜๋ฉด, Grafana์— ๋“ค์–ด๊ฐ€์ง€ ์•Š๊ณ  ํ˜ธ๋‹ค๋‹ฅ ํ„ฐ๋ฏธ๋„์„์ผœ '๋ˆ„๊ฐ€ spark์œผ๋กœ ์ž์›์„ ์–ผ๋งˆ๋‚˜ ํ• ๋‹นํ•ด ์“ฐ๊ณ  ์žˆ๋‚˜'ํ™•์ธํ•˜๋Š” ๋ฐ์— ์ž์ฃผ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๋‹ค. Kubernetes Metrics API Resource metrics pipeline For Kubernetes, the Metrics API offers a basic set of metrics to support automatic scaling and similar use cases. T..

๐Ÿ’ป/MLOps 2024.01.02

[programming in Scala] 01. ์Šค์นผ๋ผ ํ™˜๊ฒฝ ์„ค์ •

# 0. jdk ์„ค์น˜ sudo apt install openjdk-11-jdk # 1. Scala ์„ค์น˜ (cs setup) curl -fL https://github.com/coursier/coursier/releases/latest/download/cs-x86_64-pc-linux.gz | gzip -d > cs && chmod +x cs && ./cs setup # 2. IntelliJ Scala Plugin ์„ค์น˜ # 3. IntelliJ ์—์„œ, Settings > Build, Execution, Deployment > Build Tools > sbt > sbt project: sbt shell > Allow overring sbt version ์„ uncheck. build.properties์— ๋ฒ„..