import os
from pathlib import Path
{% if imports_slot -%}
{{ imports_slot }}
{%- endif -%}
from kptn.caching.TaskStateCache import run_task
from kptn.util.pipeline_config import PipelineConfig

if __name__ == "__main__":
    tasks_config_path = Path(__file__).parent / "{{ rel_tasks_conf_path }}"
    pipeline_config = PipelineConfig(
        TASKS_CONFIG_PATH=str(tasks_config_path),
        PIPELINE_NAME=os.getenv("KAPTEN_PIPELINE"),
    )
    run_task(pipeline_config, os.getenv("KAPTEN_TASK"))