프로세스 런타임 구성하기
프로세스 런타임 구성하기
프로세스(process) 런타임의 기본 구성은 conf/functions_worker.yml 파일에서 바로 사용할 수 있어요. 더 많은 매개변수를 커스터마이즈하고 싶다면 아래 예시를 참고하면 돼요.
또한 Python에서는 설정 파일(config.ini)을 이용해 런타임 매개변수를 지정하는 것도 지원해요. 이때 같은 매개변수를 파일과 명령줄 양쪽에 설정하면 명령줄 값이 우선한다는 점을 기억해 두세요.
출처: 문서
본문
프로세스 런타임의 기본 구성은 conf/functions_worker.yml 파일에서 사용할 수 있어요.
더 많은 매개변수를 커스터마이즈하려면 다음 예시를 참고해요.
functionRuntimeFactoryClassName: org.apache.pulsar.functions.runtime.process.ProcessRuntimeFactory
functionRuntimeFactoryConfigs:
# the directory for storing the function logs
logDirectory:
# change the jar location only when you put the java instance jar in a different location
javaInstanceJarLocation:
# change the python instance location only when you put the python instance jar in a different location
pythonInstanceLocation:
# change the extra dependencies location:
extraFunctionDependenciesDir:
자세한 내용은 코드를 참고해요.
설정 파일로 런타임 매개변수 지정하기 (Set runtime parameter with configuration file)
Pulsar Functions는 이제 Python에서 설정 파일을 사용해 런타임 매개변수를 지정하는 것을 지원해요.
예시
다음 명령으로 config.ini 설정 파일을 사용해 Python 런타임을 시작할 수 있어요.
pulsar-admin functions localrun \
--py /path/to/python_instance.py \
--config-file /path/to/config.ini \
--classname MyFunction \
--logging_level debug \
--inputs persistent://public/default/my-input-topic \
--output persistent://public/default/my-output-topic \
--log-topic persistent://public/default/functions-logs
--config-file은 설정 파일의 경로예요. 다음 사항을 주의해요.
--config-file은.ini형식으로 작성되어야 하고, 각 매개변수는key = value로 구성돼요.
예시
[DEFAULT]
logging_level = info
max_pending_async_requests = 1000
max_concurrent_requests = 50
- 위 예시의
logging_level처럼 같은 매개변수를 설정 파일과 명령줄 양쪽에서 설정하면, 명령줄로 설정한 값이 설정 파일의 값보다 우선해요. 그 결과logging_level의 값은debug가 돼요.
더 알아보기 (Learn more)
- 런타임 유형의 차이가 궁금하다면 함수 런타임 문서를 참고해요.
- 스레드 런타임 구성은 스레드 런타임 문서를 살펴보세요.
- 함수 워커 설정 전반은 함수 워커 문서에서 확인할 수 있어요.