언어 정리/python_비동기관련_lib20 agent,handler 모음 (ros2, gmqtt, asyncio.Queue) 원래는 manager가 ros2, gmqtt, queue 각각 3개 agent를 다뤄주고 ros2 와 gmqtt 는 client - handler - agent 구조 queue 는 client - agent 구조 인데 manager 는 아직 구현 안함. client 는 라이브러리라고 생각하면 된다. 지금 코드는 agent 까지만 구현되있어서 agent끼리 구현해볼 수 있게끔 해놈 실행은 agent.py 코드 키면 되고 코드 내부에 출력 결과 적혀있고 subscribe 랑 publish 해보려면 ros2 같은경우엔 명령어로 test gmqtt 같은 경우엔 mqtt box 로 test 함. ( gmqtt 경우엔 docker 로 emqx 올리고 셋업까지 해서 동작 시킴 ) 일단 코드만 올려 놓음 ros2 ha.. 2022. 9. 12. asyncio Queue 랑 loop 개념까지 정리 참고 사이트 : https://docs.python.org/ko/3/library/asyncio-queue.html 큐 — Python 3.10.6 문서 큐 소스 코드: Lib/asyncio/queues.py asyncio 큐는 queue 모듈의 클래스와 유사하도록 설계되었습니다. asyncio 큐는 스레드 안전하지 않지만, async/await 코드에서 사용되도록 설계되었습니다. asyncio 큐의 메 docs.python.org # loop 개념관련 : asyncio.get_event_loop() VS asyncio.run( ) https://stackoverflow.com/questions/53724665/using-queues-results-in-asyncio-exception-got-future.. 2022. 9. 6. 이벤트 루프_2 - 예제랑 같이 좀더 자세히 참고 : https://www.pythontutorial.net/python-concurrency/python-event-loop/ Python Event Loop In this tutorial, you'll learn about the Python event loop and how Python uses it to achieve the concurrency model using a single thread. www.pythontutorial.net 개요 : Event Loop : 언제 쓰나? 왜 쓰나 ? 단일 스레드 동시성 모델을 달성하기 위해 asyncio패키지는 이벤트 루프라는 구성을 사용합니다. 파일에 데이터를 쓰는 예를 들어 이벤트 루프를 설명 하자면 1. 파일 열기 2. 파일에 데이터를 쓰고 완.. 2022. 8. 28. 다른사람 예제 rclpy.executors 랑 rclpy.task 관련 예시 퍼옴 """ https://github.com/ros2/rclpy/blob/691e4fbfcb4bd4cc2a01182a7dced3105a78200b/rclpy/test/test_executor.py#L226 """ # Copyright 2017 Open Source Robotics Foundation, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # .. 2022. 8. 17. 이벤트 루프 - 파이썬 레퍼런스 정리 https://docs.python.org/ko/3/library/asyncio-eventloop.html#asyncio.loop.call_soon 이벤트 루프 — Python 3.10.6 문서 이벤트 루프 소스 코드: Lib/asyncio/events.py, Lib/asyncio/base_events.py 머리말 이벤트 루프는 모든 asyncio 응용 프로그램의 핵심입니다. 이벤트 루프는 비동기 태스크 및 콜백을 실행하고 네트워크 IO 연산 docs.python.org 선행개념 : 이벤트 루프란 "?" 이벤트 루프는 모든 asyncio 응용 프로그램의 핵심입니다. 이벤트 루프는 비동기 태스크 및 콜백을 실행하고 네트워크 IO 연산을 수행하며 자식 프로세스를 실행합니다. 응용 프로그램 개발자는 일반적으로.. 2022. 8. 17. 코루틴과 태스크, 퓨처 - 파이썬 레퍼런스 정리 https://docs.python.org/ko/3/library/asyncio-task.html 코루틴과 태스크 — Python 3.10.6 문서 코루틴과 태스크 이 절에서는 코루틴과 태스크로 작업하기 위한 고급 asyncio API에 관해 설명합니다. Coroutines declared with the async/await syntax is the preferred way of writing asyncio applications. For example, the follo docs.python.org https://wonhyeok1994.tistory.com/79 asyncIO_1_( 코루틴개념+함수 : create_task, run, sleep ) 참고 https://docs.python.org/ko.. 2022. 8. 17. 이전 1 2 3 4 다음