<commit_before>import celery
from itertools import chain

from framework.tasks import handlers

from website.archiver.tasks import (
    archive,
    create_app_context,
)
from website.archiver import utils as archiver_utils
from website.archiver import (
    ARCHIVER_UNCAUGHT_ERROR,
)

from website.project import signals as project_signals
from website.project import utils as project_utils

@project_signals.after_create_registration.connect
def after_register(src, dst, user):
    """Blinker listener for registration initiations. Enqueqes an archive task

    :param src: Node being registered
    :param dst: registration Node
    :param user: registration initiator
    """
    archiver_utils.before_archive(dst, user)
    if dst.root != dst:  # if not top-level registration
        return
    targets = chain([dst], dst.get_descendants_recursive())
    archive_tasks = [archive.si(t.archive_job._id) for t in targets]
    handlers.enqueue_task(
        celery.chain(*archive_tasks)
    )

@project_signals.archive_callback.connect
def archive_callback(dst):
    """Blinker listener for updates to the archive task. When no tasks are
    pending, either fail the registration or send a success email

    :param dst: registration Node
    """
    create_app_context()
    root_job = dst.root.archive_job
    if root_job.sent or not root_job.archive_tree_finished():
        return
    root_job.sent = True
    root_job.save()
    if dst.archive_job.success:
        if dst.pending_embargo:
            for contributor in dst.contributors:
                project_utils.send_embargo_email(dst, contributor)
        else:<commit_msg>Don't try to archive Pointers<commit_after>import celery
import itertools

from framework.tasks import handlers

from website.archiver.tasks import (
    archive,
    create_app_context,
)
from website.archiver import utils as archiver_utils
from website.archiver import (
    ARCHIVER_UNCAUGHT_ERROR,
)

from website.project import signals as project_signals
from website.project import utils as project_utils

@project_signals.after_create_registration.connect
def after_register(src, dst, user):
    """Blinker listener for registration initiations. Enqueqes an archive task

    :param src: Node being registered
    :param dst: registration Node
    :param user: registration initiator
    """
    archiver_utils.before_archive(dst, user)
    if dst.root != dst:  # if not top-level registration
        return
    targets = itertools.chain([dst], dst.get_descendants_recursive())
    archive_tasks = [archive.si(t.archive_job._id) for t in targets if t.primary]
    handlers.enqueue_task(
        celery.chain(*archive_tasks)
    )

@project_signals.archive_callback.connect
def archive_callback(dst):
    """Blinker listener for updates to the archive task. When no tasks are
    pending, either fail the registration or send a success email

    :param dst: registration Node
    """
    create_app_context()
    root_job = dst.root.archive_job
    if root_job.sent or not root_job.archive_tree_finished():
        return
    root_job.sent = True
    root_job.save()
    if dst.archive_job.success:
        if dst.pending_embargo:
            for contributor in dst.contributors:
                project_utils.send_embargo_email(dst.root, contributor)
        else:
{'fraction_non_alphanumeric': 0.07063084817386055, 'fraction_numerical': 0.0, 'mean_word_length': 3.6284916201117317, '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': '3925814', 'n_tokens_mistral': 956, 'n_tokens_neox': 940, 'n_words': 277}