29 lines
819 B
Python
29 lines
819 B
Python
import argparse
|
|
import time
|
|
from pathlib import Path
|
|
|
|
from pyinfra.config.loader import load_settings, pyinfra_config_path
|
|
from pyinfra.examples import start_queue_consumer_with_prometheus_and_health_endpoints
|
|
|
|
|
|
def parse_args():
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument(
|
|
"--settings_path",
|
|
"-s",
|
|
type=Path,
|
|
default=pyinfra_config_path,
|
|
help="Path to settings file or folder. Must be a .toml file or a folder containing .toml files.",
|
|
)
|
|
return parser.parse_args()
|
|
|
|
|
|
def processor_mock(_data: dict, _message: dict) -> dict:
|
|
time.sleep(5)
|
|
return {"result1": "result1"}
|
|
|
|
|
|
if __name__ == "__main__":
|
|
settings = load_settings(parse_args().settings_path)
|
|
start_queue_consumer_with_prometheus_and_health_endpoints(processor_mock, settings)
|