<commit_before>from goodtablesio import services


# Module API

def get_task(task_id):
    """Get task by identifier.

    Args:
        task_id (str): task identifier

    Returns:
        dict: task result

    """
    report = None
    result = tasks.validate.AsyncResult(task_id)
    if result.state == 'SUCCESS':
        report = services.database['reports'].find_one(task_id=task_id)
    return {'status': result.status, 'report': report}


def get_task_ids():
    """Get all task identifiers.

    Returns:
        str[]: list of task identifiers

    """
    return [r['task_id']
            for r in
            services.database['reports'].find(order_by=['-created'])]<commit_msg>Don't rely on the celery task id to get the result<commit_after>from goodtablesio import services


# Module API

def get_task(task_id):
    """Get task by identifier.

    Args:
        task_id (str): task identifier

    Returns:
        dict: task result

    """
    report = services.database['reports'].find_one(task_id=task_id)
    # TODO: we need to store the status in the DB as we can no longer rely on
    # the task id being the same one used by celery
    status = 'Not Implemented'
    return {'status': status, 'report': report}


def get_task_ids():
    """Get all task identifiers.

    Returns:
        str[]: list of task identifiers

    """
    return [r['task_id']
            for r in
            services.database['reports'].find(order_by=['-created'])]
{'fraction_non_alphanumeric': 0.11307901907356949, 'fraction_numerical': 0.0, 'mean_word_length': 2.728426395939086, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2468578', 'n_tokens_mistral': 446, 'n_tokens_neox': 419, 'n_words': 138}