<commit_before>from celery.execute import send_task

from rest_framework import viewsets
from rest_framework.response import Response

from rockit.core import models
from rockit.core import holders

class WhenViewSet(viewsets.ViewSet):
    """
    View to list all addable nodes in rockit server.
    """
    def list(self, request):
        """
        Return a list of all addables.
        """
        result = holders.Holder()

        for a in models.Association.objects.all():
            task = send_task("%s.when" % a.entry, args=[holders.WhenHolder(a)])
            when = task.wait(timeout=30)
            
            result.extend(when)

        return Response(result.get_content())<commit_msg>Added state for when view<commit_after>from celery.execute import send_task

from rest_framework import viewsets
from rest_framework.response import Response

from rockit.core import models
from rockit.core import holders

class WhenViewSet(viewsets.ViewSet):
    """
    View to list all addable nodes in rockit server.
    """
    def list(self, request):
        """
        Return a list of all addables.
        """
        result = holders.Holder()

        for a in models.Association.objects.all():
            task = send_task("%s.when" % a.entry, args=[holders.WhenHolder(a)])

            print task.state

            when = task.wait(timeout=30)
            
            result.extend(when)

        return Response(result.get_content())
{'fraction_non_alphanumeric': 0.09402882635552505, 'fraction_numerical': 0.002745367192862045, 'mean_word_length': 2.5048076923076925, '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': '6782944', 'n_tokens_mistral': 407, 'n_tokens_neox': 390, 'n_words': 115}