Пример #1
0
async def create_convert_str_job(
    data: InputStrData, style: StyleType, level: Optional[LvType] = "MAX",
):
    """

    Args:
        data:
        style:
        level:

    Returns:

    """
    token = create_job_token(JobType(job="convert"))
    job_execute_data = {
        "names": data.data,
        "export_style": style,
        "export_level": level,
    }
    Process(target=converter_client, args=(token, job_execute_data),).start()

    job_status_data = {
        "data": data.dict(),
        "style": style,
        "level": level,
    }
    job_status = "created"
    job_info = JobStatus(token=token, status=job_status, data=job_status_data)

    return job_info
Пример #2
0
async def create_convert_dict_job(
    data: InputDictData,
    style: StyleType,
    level: Optional[LvType] = "MAX",
    file_type: str = "xlsx",
):
    """

    Args:
        file_type:
        data:
        style:
        level:

    Returns:

    """
    token = create_job_token(JobType(job="convert"))
    job_execute_data = {
        "data": data.data,
        "params": {"style": style, "level": level, "file_type": file_type,},
    }
    Process(target=converter_client, args=(token, job_execute_data, "dict"),).start()

    job_status_data = {
        "data": data.dict(),
        "params": {"style": style, "level": level, "file_type": file_type,},
    }
    job_status = "created"
    job_info = JobStatus(token=token, status=job_status, data=job_status_data)

    return job_info
Пример #3
0
async def check_linker_job(token: str, ):
    """"""
    if is_job_finished(token):
        job_data = get_job_output(token)
        job_status = "finished"
    else:
        job_data = {}
        job_status = "working"
    job_info = JobStatus(token=token, status=job_status, data=job_data)
    return job_info
Пример #4
0
async def check_converter_job_status(token: str,):
    """
    Check the status of a job submitted to converter module.
    """
    if is_job_finished(token):
        job_data = get_job_output(token)
        job_status = "finished"
    else:
        job_data = {}
        job_status = "working"
    job_info = JobStatus(token=token, status=job_status, data=job_data)
    return job_info
Пример #5
0
async def create_equalize_job(
    data: InputDictData, levels: Union[str, List[str]] = "B1", file_type: str = "xlsx",
):
    """
    """
    token = create_job_token(JobType(job="convert"))
    job_execute_data = {
        "data": data.data,
        "params": {"levels": levels, "file_type": file_type},
    }
    Process(target=equalizer_client, args=(token, job_execute_data, "dict"),).start()

    job_status_data = {
        "data": data.dict(),
        "params": {"levels": levels, "file_type": file_type},
    }
    job_status = "created"
    job_info = JobStatus(token=token, status=job_status, data=job_status_data)

    return job_info
Пример #6
0
async def create_link_dict_job(
    data: InputDictData,
    export_url: bool = True,
    export_names: bool = True,
    file_type: str = "xlsx",
):
    """"""
    token = create_job_token(JobType(job="link"))
    job_execute_data = {
        "data": data.data,
        "params": {
            "export_url": export_url,
            "export_names": export_names,
            "file_type": file_type,
        },
    }
    Process(
        target=linker_client,
        args=(token, job_execute_data, "dict"),
    ).start()
    job_status = "created"
    job_info = JobStatus(token=token, status=job_status, data=job_execute_data)

    return job_info