# -------------------------------------------------------------------------
#  This file is part of the MindStudio project.
# Copyright (c) 2025 Huawei Technologies Co.,Ltd.
#
# MindStudio is licensed under Mulan PSL v2.
# You can use this software according to the terms and conditions of the Mulan PSL v2.
# You may obtain a copy of Mulan PSL v2 at:
#
#          http://license.coscl.org.cn/MulanPSL2
#
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# -------------------------------------------------------------------------

from atk.tasks.celery_base_task import BaseCeleryTask
from atk.tasks.opp_tasks import (
    create_dataset,
    run_opp_task,
    post_process,
    clean_output_data,
    run_aclnn_task,
)
from atk.tasks.celery_config import app


@app.task(base=BaseCeleryTask)
def celery_post_process(task_result_json):
    return post_process(task_result_json)


@app.task(base=BaseCeleryTask)
def celery_create_dataset(task_result_json):
    return create_dataset(task_result_json)


@app.task(base=BaseCeleryTask)
def celery_run_opp_task(task_result_json):
    return run_opp_task(task_result_json)


@app.task(base=BaseCeleryTask)
def celery_run_aclnn_task(task_result_json, self_result_json):
    return run_aclnn_task(task_result_json, self_result_json)


@app.task(base=BaseCeleryTask, time_limit=180, max_retries=1)
def celery_clean_output_data(task_result_json):
    return clean_output_data(task_result_json)