전체 글
-
[회고] 글또 8기를 마치며Extracurricular Activites/글또 2023. 7. 16. 23:53
글또를 시작한지 벌써 6개월이 되었다. 글또 8기를 통해 얻은 가장 큰 변화는 막막하기만 했던 글쓰기와 조금은 친해졌다는 것이다. 12개의 글을 모두 제출하는 것이 목표였지만 이번 회고 글까지 10개의 글을 제출한다. 사정이 있었지만 어디까지나 핑계임을 부정할 수는 없다. 목표가 12개 글을 모두 제출하는 것 뿐이었던 게 아쉽다. 더 큰 목표를 가지고 있었다면 더 많이 노력하지 않았을까? 아쉬움은 뒤로 하고 글또 8기 동안의 타임라인을 간략하게 짚어보며 앞으로 취해야 할 액션에 대해서 KPT 방법론으로 정리해보려고 한다. 1월 24일: 글또 8기 합격자 공지공부한 내용을 글로 정리함으로써 진짜 내 것으로 만드는 습관을 들이고 싶었다. 간절한 마음을 담은 지원서가 통과되어 글또에 참여할 수 있게 되었다..
-
asyncio.Task 소스코드 분석 및 오버라이딩을 통해 원하는 기능 구현하기Python/Library 2023. 5. 21. 16:43
이번주는 회사에서 SNMP Trap을 수신하는 NMS(Network Management System) 제품에 대한 보수 요청이 들어와 비동기 라이브러리 asyncio를 뜯어보고 오버라이딩을 통해 원하는 기능을 추가한 경험에 대해서 써보려고 합니다.요청사항이벤트 중복 발생 시 이벤트 자동 해제 시간을 최신 발생시점으로 갱신해야 함 우선, Trap이란 간단히 말해서 SNMP 프로토콜에서 제공하는 '단방향' 이벤트 전달방식을 말합니다. SNMP(Simple Network Management Protocol)는 네트워크 장비 관리 프로토콜로서 Manager와 Agent간에 주고받는 메세지 패킷의 형식을 정의하며 Manager와 Agent의 상호 데이터 교환을 가능하게 합니다. SNMP 메세지는 네트워크 관리..
-
[python] RuntimeError(There is no current event loop in thread 'ThreadPoolExecutor-0_0') 해결 - ensure_future()와 create_task()의 차이점Trouble Shooting/Structural Error 2023. 5. 7. 11:58
저는 파이썬을 사용하는 서버 개발자로서 회사에서 주로 asyncio를 활용한 비동기 프로그래밍을 하고 있습니다. 저번주 업무는 여러 개의 oid에 대해서 snmp walk를 비동기로 수행하는 엔진을 만드는 것이었는데 작업 중 예상치 못한 에러를 만났습니다. 이것저것 시도해보다 에러는 잡았는데 이유가 이해되지 않아 거의 1주일을 고민했습니다. context switching, thread, coroutine등의 개념을 알고 나서야 어느 정도 이해가 되어 그 과정을 공유하고자 합니다. 에러가 발생한 부분은 async def로 정의한 코루틴 함수(table_task)를 asyncio.ensure_future()의 인자로 전달해 task로 반환시켜 task list(vendor_tasks)에 추가하는 코드였고..
-
[회고] 글또 8기 6회차Extracurricular Activites/글또 2023. 4. 23. 14:27
1회차: 글또를 시작하며한 다짐(feat.big5 성격검사) (공백 제외 623자; 글쓰기 1시간 소요)https://gencomi.tistory.com/entry/0-%EA%B8%80%EB%98%90-%EC%8B%9C%EC%9E%912회차: 레디스 복제 (공백 제외 2252자; 공부 1주일, 글쓰기 3시간 소요) https://gencomi.tistory.com/entry/Redis-%EB%B3%B5%EC%A0%9C3회차: 레디스 백업 (공백 제외 2923자; 공부 1주일, 글쓰기 3시간 40분 소요)https://gencomi.tistory.com/entry/Redis-%EB%B0%B1%EC%97%854회차: I/O multiplexing이 가능한 채팅 프로그램 (공백제외 1216자; 2주 프로젝트로..
-
점심 메뉴 추천 프로그램Side Project 2023. 4. 9. 15:43
회사에서 점심 메뉴를 정하는 것도 일이다. 나를 포함한 막내 포지션 3인이 요일을 정해서 메뉴를 정하기로 했으나... 실행이 잘 안 되었고 "스트레스 받을 바에는 프로그램을 만들자!" 해서 점심 메뉴 추천 프로그램을 만들게 되었다. 웹은 추후에 만들도록 하고 일단은 소스코드와 DB만 만들었다. 데이터는 RDB로 관리한다. MySQL을 사용했으며 추후 다른 팀에서도 프로그램을 사용할 것을 고려한 유저 테이블(lnch_user), 음식 종류별 음식점 이름 및 음식점 거리를 관리하는 메뉴 테이블(lnch_menu), 먹은 메뉴를 날짜별로 관리하는 기록 테이블(lnch_record)로 구성했다.-- 유저 테이블CREATE TABLE lnch_user ( SEQ_NO int not null auto_in..
-
I/O multiplexing이 가능한 채팅 프로그램Side Project 2023. 3. 26. 23:43
채팅 프로그램은 입사하고 처음 과제로 받았던 파일럿 프로젝트인데 이번 기회에 OOP로 리팩토링을 하면서 다시 들여다본다. 당시에 국비로 머신러닝, 데이터 분석을 6개월 배우고 입사했기 때문에 개발에 대한 경험은 데이터 파이프라인을 구축해 본 경험이 전부였다. 이 분야에서 뭘 잘하는지도 모르겠고 일단 부딪히면서 생각해보자라는 주의로 입사했는데 지금 생각해보면 어디서 그런 밑도끝도 없는 용기가 나왔는지 신기하다. 결론은 실무를 하며 배우는 부분이 참 많고 여러가지 경험을 하고 있기 때문에 잘 한 선택이라고 생각한다. 각설하고 본론으로 들어가면 이 포스팅은 다중 client가 하나의 서버에서 대화를 주고받을 수 있는 채팅 프로그램에 대한 글이다. 채팅 서버는 client들의 요청을 비동기적으로 수행한다. 서..
-
회문 판별과 N-gram 만들기Python/Grammar 2023. 3. 25. 20:55
# 1. 회문 판별하기 회문(palindrome)이란? 거꾸로 읽어도 제대로 읽은 것과 같은 단어나 문장을 말한다. 예를 들어 SOS, level, nurses run, rotator, 기러기, 토마토 등이 있다. 1-1. 반복문으로 문자 검사하기 0부터 문자열 길이의 절반만큼 반복하면서 왼쪽 문자, 왼쪽 문자와 대칭되는 위치의 오른쪽 문자를 비교해서 문자가 다르면 회문이 아니라고 판단한다.word = intput()is_palindrome = Truefor i in range(len(word) // 2): if word[i] != word[-i -1]: is_palindrome = False breakprint(is_palindrome) 1-2. 시퀀스 뒤집기로 문자 검..
-
[Redis] 백업을 통한 데이터 영속화DataBase/NoSQL 2023. 3. 12. 22:55
Redis는 인메모리 저장 방식으로 리부팅시 데이터가 휘발된다. 따라서 기존 데이터를 영속화하여 복구, 유지시키기 위해서는 디스크에 데이터 백업해주는 과정이 필요하다. 백업 방식에는 1) RDB snapshot, 2) AOF 2가지가 있다. RDB snapshot은 특정 시점을 스냅샷으로 남겨 데이터를 저장하는 방식을 말한다. 여기서 "RDB"는 관계형 데이터베이스가 아니라 Redis DataBase를 의미한다. redis.conf 파일에서 스냅샷 저장에 대한 주기 설정을 할 수 있는데, save 60 10으로 설정하면 60초마다 10개 이상의 데이터 변경이 있을 때 데이터를 저장하겠다는 의미이다. 아래는 redis.conf에 기본으로 설정되어있는 # save 3600 1 300 100 60 1000..