전체 글 45

[Python 문법] 파이썬 입력 받기 (sys.stdin.readline)

백준 15552번 : 빠른 A+B 알고리즘 문제를 풀 때, 사용자의 입력을 받기 위해 input() 과 sys.stdin.readline() 을 사용한다.이 때, 반복문으로 여러줄을 입력 받아야 할 때 input() 으로 입력 받으면 시간초과가 발생할 수 있다. 시간초과가 나타나는 input() 코드num = int(input())for i in range(num): a, b = map(int, input().split()) print(a+b) sys.stdin 코드import sysinput = sys.stdin.readline()num = int(input())for i in range(num): a, b = map(int, input().split()) print(a+b) 1...

Python/백준 2025.01.26

k3s

ngrinder (server) / blog (agent)1. 서버에 kube installcurl -sfL https://get.k3s.io | sh - sudo k3s kubectl get node  2. 서버에서 token url 조회sudo cat /var/lib/rancher/k3s/server/node-tokensudo kubectl get node 3. Agent에서 run agentcurl -sfL https://get.k3s.io | K3S_URL=https://:6443 K3S_TOKEN= sh - +) 혹시 안될때 uninstall 실행 후 재실행하기/usr/local/bin/k3s-agent-uninstall.sh 4. 서버에서 잘 띄워졌는지 확인sudo kubectl get nod..

[SPARK] json형식 pyspark 에서 파싱하기

1. JSON 파일 불러오기%spark.pysparkimport osinput_path = os.path.expanduser('~/data/movbotdata/movieList.json')jdf = spark.read.option("multiline", "true").json(input_path)#jdf = spark.read.option("multiline","true").json('/home/odsummer/data/movbotdata/movieList.json') json파일 안에 데이터 형식 단일이 아닌 여러줄로 구성되어 있는 경우, multiline 값을 true로 주는 옵션을 줘야한다.2. JSON 파일 스키마 확인%spark.pysparkjdf.printSchema()root |-- comp..

플레이데이터 데이터 엔지니어링 32기 8월 3주차 회고록

FACTSdynamic jsonline notifykafka https://oddsummer.tistory.com/50 8월 3주차 (8/19~8/23)0819dynamic json 자습^^.. (0820에서 이어짐)08201. git merge 충돌해결1) git push 실행 Updates were rejected because the remote contains work that you do not have locally 에러. 즉 git pull 하라는 뜻2) git pull 실행merge strategy 설정oddsummer.tistory.com 1. dynamic json 실습https://oddsummer.tistory.com/49 movies-dynamic-jsonGITHUBhttps://..

8월 3주차 (8/19~8/23)

0819dynamic json 자습^^.. (0820에서 이어짐)08201. git merge 충돌해결1) git push 실행 Updates were rejected because the remote contains work that you do not have locally 에러. 즉 git pull 하라는 뜻2) git pull 실행merge strategy 설정하라고 뜸.  git config pull.rebase false 으로 설정3) 다시 git pull Automatic merge failed; fix conflicts and then commit the result. 병합충돌 해결하라는 에러 뜸 4) 충돌된 파일 열면 이런식으로 표시                 현재 branch의 충돌 ..

[실습] movdata : 영화데이터 수집 프로그램

https://github.com/pladata-encore/DE32_101/issues/65 v0.2 : 영화목록API를 호출해서 연도별 영화목록 추출하기이미 다운받은 연도의 영화목록은 SKIP 하도록 설정import requestsimport osimport jsonimport timefrom tqdm import tqdmAPI_KEY = os.getenv('MOVIE_API_KEY')def save_json(data, file_path): # 파일저장 경로 MKDIR os.makedirs(os.path.dirname(file_path), exist_ok=True) with open(file_path, 'w', encoding='utf-8') as f: json.dump(..

플레이데이터 데이터 엔지니어링 32기 8월 2주차 회고록

FACTS부하/성능 테스트 복습fast api 동작, 성능 테스트spark clusterspark-submitmovdata 광고데이터 분석 (zeppelin) https://oddsummer.tistory.com/44 8월 2주차 (8/12~8/16)8/12 (월)서버 부하 테스트 실습 fastapi 1.  지난 주 리뷰1)  ngrinder, ngnix- ngrinder : 부하 테스트와 성능 테스트를 위한 툴. Nginx와 같은 로드 밸런서와 함께 사용하면, 다양한 부하 조건에서의 성능oddsummer.tistory.com1. ngrinder, ngnix- ngrinder : 부하 테스트와 성능 테스트를 위한 툴. Nginx와 같은 로드 밸런서와 함께 사용하면, 다양한 부하 조건에서의 성능을 테스트하..