No project description provided
Project description
Scavenger Agent Python (BETA)
(본 Agent는 베타 버전으로 현재 개발 환경에서만의 사용을 권장하며 상용 환경에서의 사용을 권장하지 않습니다.) Scavenger Agent의 Python 버전으로, Agent가 아닌 Server Component는 사전에 준비되어야 합니다.
개발 가이드
Scavenger Agent Python은 패키지 관리자로 Poetry를 이용합니다.
- 의존성 설치
$ poetry install
- 테스트
$ poetry run python -m unittest
- 빌드
$ poetry build
자세한 내용은 Poetry Docs를 참고해주세요.
에이전트 설치 가이드
전제조건
Python >= 3.7
설치
$ pip install scavenger-agent-python --save
설정
설정은 설정 파일 scavenger.conf을 이용한 방식과 Config Instance를 직접 생성하는 두 가지 방식을 지원합니다.
- Example of
scavenger.conf
# scavenger.conf
apiKey=eb99ff0f-aaaa-bbbb-cccc-5d1ec81f6183
serverUrl=http://10.106.93.41:8081
environment=dev
appName=apiserver
packages=views
codebase=.
---
# source
config = Config.load_config()
agent = Agent(config)
- Example of
Config()
config = Config(
api_key="eb99ff0f-aaaa-bbbb-cccc-5d1ec81f6183",
server_url="http://10.106.93.41:8081",
environment="dev",
app_name="apiserver",
packages=["views"],
codebase=["."],
)
agent = Agent(config)
에이전트 시작
Scavenger Agent Python은 Scavenger Agent Java와 달리, Agent 시작 코드를 직접 삽입하는 방식으로 동작합니다. 수집을 시작할 함수의 모듈이 import되기 전에 Agent가 동작해야 하므로 반드시 프로그램의 시작점에 Agent 시작 코드가 삽입되어야 함을 유의하십시오.
from scavenger import Agent, Config
config = Config.load_config()
agent = Agent(config)
agent.start()
### your source code
from ...
한계
- Graceful Shutdown에 대한 구현은 기존 프레임워크와의 충돌 가능성으로 인해 자동으로 지원하지 않습니다. 대신 아래와 같은
agent.shutdown()함수를 지원하므로 직접 등록하여서 사용하여야 합니다.
def shutdown_gracefully(*args):
# Shutdown your application/server first.
agent.shutdown()
sys.exit(0)
signal.signal(signal.SIGTERM, shutdown_gracefully)
agent.start()
- Scavenger Python Agent는 현재 모듈/클래스의 레퍼런스를 대체하는 방식으로 동작하므로 레퍼런스를 사용하지 않고 함수를 호출하는 경우에는 동작하지 않습니다. 따라서 아래와 같이 Decorator를 이용해 함수의 레퍼런스만 따로 프레임워크에 저장해두는 경우,
def hello_world()에는 동작하지 않습니다. 이는 추후 함수내 코드를 삽입하는 방식으로 변경되어 지원될 예정입니다.
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello World!'
- 코드를 직접 읽어서 메서드를 탐색해야 하므로 pyc 파일은 현재 지원되지 않습니다.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file scavenger_agent_python-0.1.2.tar.gz.
File metadata
- Download URL: scavenger_agent_python-0.1.2.tar.gz
- Upload date:
- Size: 21.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.10.9 Darwin/21.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a6b42053d9e6f37c0a36a2ab3456f9113a7304fc0774e8855929c9649899fc99
|
|
| MD5 |
aa8243565cfa0917a8114d3c2a2df39d
|
|
| BLAKE2b-256 |
4a7b4fb0063b612ecfcaca43cf8ba1dd969089511949f923e69bc0d0741d7746
|
File details
Details for the file scavenger_agent_python-0.1.2-py3-none-any.whl.
File metadata
- Download URL: scavenger_agent_python-0.1.2-py3-none-any.whl
- Upload date:
- Size: 30.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.10.9 Darwin/21.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e439d92becb6573ebce34825ae4ada826b95bf7daaf62ecbb9a2cff59f5837e
|
|
| MD5 |
08662e8253d14e4cbd28f0af969cd7a9
|
|
| BLAKE2b-256 |
d4d9195fc027f125632d09ba53e7e6b7ea902aefe1f7c36ef154b5e91cc447cd
|