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
| Name | Type | Description |
|---|---|---|
| ctx | context.Context | The context for the operation, used for cancellation and deadlines. |
| taskId | *task.TaskIdentifier | The unique identifier for the task, containing its name and other identifying information. |
| spec | *task.TaskSpec | The detailed specification of the task, including its environment, documentation, and other configuration. |
Returns
| Type | Description |
|---|---|
*models.Task, error | A pointer to the newly created Task model and an error if marshaling the task specification fails. |