<commit_before>import os
import uuid
import copy
import signal

from pkit.process import Process
from pkit.slot import SlotPool


class Task(object):
    """Tracks a ProcessPool execution
    
    :param  process_pid: process execution pid to track
    :type   process_pid: int

    :param  _id: specify explictly the task id, if not provided
                 a random one will be generated.
    :type   _id: string

    :param  status: task execution status
    :type   status: member of Task.STATUSES
    """
    READY = 'ready'
    RUNNING = 'running'
    FINISHED = 'finished'

    STATUSES = (
        READY,
        RUNNING,
        FINISHED
    )

    def __init__(self, process_pid, _id=None, status=None):
        self.id = _id or uuid.uuid4().hex 
        self.exitcode = None

        if status:
            self.status = status

    def __str__(self):
        return '<Task {} {}>'.format(self.id, self.status)

    @property
    def status(self):
        if not hasattr(self, '_status'):
            self._status = Task.READY

        return self._status

    @status.setter
    def status(self, value):
        if not value in Task.STATUSES:<commit_msg>Add a finish method to pool task<commit_after>import os
import uuid
import copy
import signal

from pkit.process import Process
from pkit.slot import SlotPool


class Task(object):
    """Tracks a ProcessPool execution
    
    :param  process_pid: process execution pid to track
    :type   process_pid: int

    :param  _id: specify explictly the task id, if not provided
                 a random one will be generated.
    :type   _id: string

    :param  status: task execution status
    :type   status: member of Task.STATUSES
    """
    READY = 'ready'
    RUNNING = 'running'
    FINISHED = 'finished'

    STATUSES = (
        READY,
        RUNNING,
        FINISHED
    )

    def __init__(self, process_pid, _id=None, status=None):
        self.id = _id or uuid.uuid4().hex 
        self.exitcode = None

        if status:
            self.status = status

    def __str__(self):
        return '<Task {} {}>'.format(self.id, self.status)

    def finish(self):
        self._status = Task.FINISHED

    @property
    def status(self):
        if not hasattr(self, '_status'):
            self._status = Task.READY

        return self._status

    @status.setter
    def status(self, value):
        if not value in Task.STATUSES:
{'fraction_non_alphanumeric': 0.08619975134687112, 'fraction_numerical': 0.0008288437629506838, 'mean_word_length': 2.1973509933774835, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1914973', 'n_tokens_mistral': 744, 'n_tokens_neox': 709, 'n_words': 233}