Skip to main content

NewTaskModel

Creates a new Task model instance from the provided context, task identifier, and task specification. It marshals the task specification into bytes and extracts relevant environment and documentation details to populate the model fields.

def NewTaskModel(
ctx: context.Context,
taskId: *task.TaskIdentifier,
spec: *task.TaskSpec
) - > *models.Task, error

Creates a new Task model instance from the provided task identifier and specification. This function is used to construct the internal representation of a task for storage or further processing.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the operation, used for cancellation and deadlines.
taskId*task.TaskIdentifierThe unique identifier for the task, containing its name and other identifying information.
spec*task.TaskSpecThe detailed specification of the task, including its environment, documentation, and other configuration.

Returns

TypeDescription
*models.Task, errorA pointer to the newly created Task model and an error if marshaling the task specification fails.