<commit_before>package task

import "github.com/pborman/uuid"

// Task states
const (
	// Unknown state of the task
	// This is the default state of a task
	// when new task is initially created
	TaskStateUnknown = "unknown"

	// Task has been received by the
	// minion and is queued for execution
	TaskStateQueued = "queued"

	// Task is being processed
	TaskStateProcessing = "processing"

	// Task has been processed by the
	// minion and was flagged as successful
	TaskStateSuccess = "success"

	// Task has been processed by the
	// minion and was flagged as failed
	TaskStateFailed = "failed"
)

// Task type represents a task that is processed by minions
type Task struct {
	// Command to be executed by the minion
	Command string `json:"command"`

	// Command arguments
	Args []string `json:"args"`

	// Time when the command was sent for processing
	TimeReceived int64 `json:"timeReceived"`

	// Time when the command was processed
	TimeProcessed int64 `json:"timeProcessed"`

	// Task unique identifier
	TaskID uuid.UUID `json:"taskId"`

	// Result of task after processing
	Result string `json:"result"`

	// If true this task can run concurrently with other tasks
	IsConcurrent bool `json:"isConcurrent"`

	// Task error, if any
	Error string `json:"error"`

	// Task state
	State string `json:"state"`
}

// New creates a new task
func New(command string, args ...string) *Task {
	t := &Task{
		Command: command,
		Args:    args,
		TaskID:  uuid.NewRandom(),
		State:   TaskStateUnknown,
	}
<commit_msg>task.Task contains a catalog to be processed by minions<commit_after>package task

import (
	"github.com/dnaeon/gru/catalog"
	"github.com/pborman/uuid"
)

// Task states
const (
	// Unknown state of the task
	// This is the default state of a task
	// when new task is initially created
	TaskStateUnknown = "unknown"

	// Task has been received by the
	// minion and is queued for execution
	TaskStateQueued = "queued"

	// Task is being processed
	TaskStateProcessing = "processing"

	// Task has been processed by the
	// minion and was flagged as successful
	TaskStateSuccess = "success"

	// Task has been processed by the
	// minion and was flagged as failed
	TaskStateFailed = "failed"
)

// Task type represents a task that is processed by minions
type Task struct {
	// Catalog to be processed
	Catalog *catalog.Catalog `json:"catalog"`

	// Time when the command was sent for processing
	TimeReceived int64 `json:"timeReceived"`

	// Time when the command was processed
	TimeProcessed int64 `json:"timeProcessed"`

	// Task unique identifier
	TaskID uuid.UUID `json:"taskId"`

	// Result of task after processing
	Result string `json:"result"`

	// If true this task can run concurrently with other tasks
	IsConcurrent bool `json:"isConcurrent"`

	// Task state
	State string `json:"state"`
}

// New creates a new task
func New(c *catalog.Catalog) *Task {
	t := &Task{
		Catalog: c,
		TaskID:  uuid.NewRandom(),
		State:   TaskStateUnknown,
	}

{'fraction_non_alphanumeric': 0.09357118815213733, 'fraction_numerical': 0.0026926960619320095, 'mean_word_length': 3.558282208588957, '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': '4686708', 'n_tokens_mistral': 906, 'n_tokens_neox': 870, 'n_words': 358}