dto

package
v1.0.0-alpha1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2026 License: Apache-2.0 Imports: 5 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package dto is the wire contract of the process vertical.

There is one resource here — the process — and everything a run needs hangs off it. A batch job is not a resource of its own: what a BATCH_JOB needs beyond any other process is carried in the batchProcess section of a process body, created with the process, read back nested inside it, and removed with it. The template input and output mappings are part of that section rather than of the process: the declarations they name come from the deployment's template, which only a BATCH_JOB has.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyBatchProcessRequest

func ApplyBatchProcessRequest(dst *model.BatchJobProcess, src *BatchProcessRequest)

ApplyBatchProcessRequest copies a section onto a batch process row, preserving the row's own ids so an update mutates it instead of orphaning it.

func ApplyDataStagingTaskRequest

func ApplyDataStagingTaskRequest(dst *model.DataStagingTask, src *DataStagingTaskRequest)

func ApplyInteractiveCommandTaskRequest

func ApplyInteractiveCommandTaskRequest(dst *model.InteractiveCommandTask, src *InteractiveCommandTaskRequest)

func ApplyJobMonitoringTaskRequest

func ApplyJobMonitoringTaskRequest(dst *model.JobMonitoringTask, src *JobMonitoringTaskRequest)

func ApplyJobSubmissionTaskRequest

func ApplyJobSubmissionTaskRequest(dst *model.JobSubmissionTask, src *JobSubmissionTaskRequest)

func ToInputMappingEntities

func ToInputMappingEntities(batchProcessID string, in []InputMapping) []*model.TemplateInputMapping

ToInputMappingEntities builds the rows for a batch process's mapping set. Ids are left unset so BeforeCreate assigns them.

func ToOutputMappingEntities

func ToOutputMappingEntities(batchProcessID string, in []OutputMapping) []*model.TemplateOutputMapping

ToOutputMappingEntities builds the rows for a batch process's output mapping set.

Types

type BatchJobStatusResponse

type BatchJobStatusResponse struct {
	BatchProcessStatusID string                   `json:"batchProcessStatusId"`
	BatchProcessID       string                   `json:"batchProcessId"`
	Status               model.BatchJobStatusType `json:"status"`

	// UpdatedAt is when the state was recorded, in milliseconds since the epoch — the
	// same wire shape as StatusResponse.Timestamp.
	UpdatedAt int64 `json:"updatedAt"`
}

func ToBatchJobStatusResponse

func ToBatchJobStatusResponse(s *model.BatchJobStatus) BatchJobStatusResponse

func ToBatchJobStatusResponses

func ToBatchJobStatusResponses(in []model.BatchJobStatus) []BatchJobStatusResponse

func ToBatchJobStatusResponsesFromPtrs

func ToBatchJobStatusResponsesFromPtrs(in []*model.BatchJobStatus) []BatchJobStatusResponse

type BatchProcessRequest

type BatchProcessRequest struct {
	DeploymentID   string                                `json:"deploymentId"`
	JobID          *string                               `json:"jobId"`
	BatchJobConfig *applicationdto.BatchJobConfigRequest `json:"batchJobConfig"`

	// SlurmClusterConfigID names the cluster login config this run submits under — the
	// id returned by POST /api/v1/slurm-cluster-configs, which carries the account, the
	// key and the work root.
	//
	// Required: a deployment names the machine but nobody's identity on it, so every
	// run says which config it submits under, and only a config the caller owns or that
	// is shared with them will be accepted.
	SlurmClusterConfigID *string `json:"slurmClusterConfigId"`

	// BaseWorkDir is the parent directory on the cluster this run works under; it gets
	// a subdirectory of its own beneath it, named for the process id, which is where
	// the template's file inputs are staged to and its file outputs staged from.
	//
	// Carried here rather than on the deployment, for the same reason the resource
	// request is: where a run works is a property of the run, so two runs of one
	// deployment can work under different directories.
	BaseWorkDir *string `json:"baseWorkDir"`

	// The values this run supplies for the deployment template's declared inputs and
	// outputs. Both sets are replaced wholesale by an update.
	InputMappings  []InputMapping  `json:"inputMappings"`
	OutputMappings []OutputMapping `json:"outputMappings"`
}

BatchProcessRequest is the batchProcess section of a process request.

The resource request is carried here rather than copied from the deployment's default, which is what lets a caller ask for different resources for a particular run.

jobId is writable rather than server-generated, for the same reason the submission task's is: it is the scheduler's identifier for the submitted job, learned at submission time and recorded afterwards.

func (*BatchProcessRequest) Validate

func (r *BatchProcessRequest) Validate() []httpx.FieldError

Validate implements httpx.Validator.

type BatchProcessResponse

type BatchProcessResponse struct {
	BatchProcessID string                                 `json:"batchProcessId"`
	DeploymentID   *string                                `json:"deploymentId"`
	JobID          *string                                `json:"jobId"`
	BatchJobConfig *applicationdto.BatchJobConfigResponse `json:"batchJobConfig"`

	SlurmClusterConfigID string `json:"slurmClusterConfigId"`

	BaseWorkDir *string `json:"baseWorkDir"`

	InputMappings  []InputMapping  `json:"inputMappings"`
	OutputMappings []OutputMapping `json:"outputMappings"`

	BatchJobStatuses     []BatchJobStatusResponse `json:"batchJobStatuses"`
	LatestBatchJobStatus *BatchJobStatusResponse  `json:"latestBatchJobStatus"`
}

BatchProcessResponse is the batchProcess section of a process response. The nested config is a snapshot of what this run actually asked for.

func ToBatchProcessResponse

func ToBatchProcessResponse(b *model.BatchJobProcess) *BatchProcessResponse

ToBatchProcessResponse renders the batchProcess section, or nil for a process that has none.

type DataStagingTaskRequest

type DataStagingTaskRequest struct {
	SourceDataStorageID   *string               `json:"sourceDataStorageId"`
	SourceDataStorageType *data.DataStorageType `json:"sourceDataStorageType"`

	DestinationDataStorageID   *string               `json:"destinationDataStorageId"`
	DestinationDataStorageType *data.DataStorageType `json:"destinationDataStorageType"`

	SourcePath      *string `json:"sourcePath"`
	DestinationPath *string `json:"destinationPath"`

	OnFailure  *model.OnFailureAction `json:"onFailure"`
	RetryCount *int                   `json:"retryCount"`
	TaskOrder  *int                   `json:"taskOrder"`
}

DataStagingTaskRequest is the create/update payload for a staging task.

func (*DataStagingTaskRequest) Validate

func (r *DataStagingTaskRequest) Validate() []httpx.FieldError

Validate implements httpx.Validator.

Both paths are required: a staging task that names neither where data comes from nor where it goes describes no transfer at all.

type DataStagingTaskResponse

type DataStagingTaskResponse struct {
	TaskID    string  `json:"taskId"`
	ProcessID *string `json:"processId"`

	SourceDataStorageID   *string               `json:"sourceDataStorageId"`
	SourceDataStorageType *data.DataStorageType `json:"sourceDataStorageType"`

	DestinationDataStorageID   *string               `json:"destinationDataStorageId"`
	DestinationDataStorageType *data.DataStorageType `json:"destinationDataStorageType"`

	SourcePath      *string `json:"sourcePath"`
	DestinationPath *string `json:"destinationPath"`

	OnFailure  *model.OnFailureAction `json:"onFailure"`
	RetryCount *int                   `json:"retryCount"`
	TaskOrder  *int                   `json:"taskOrder"`
}

DataStagingTaskResponse is the read model for a staging task.

func ToDataStagingTaskResponses

func ToDataStagingTaskResponses(in []model.DataStagingTask) []DataStagingTaskResponse

type InputMapping

type InputMapping struct {
	TemplateInputMappingID string `json:"templateInputMappingId"`
	TemplateInputID        string `json:"templateInputId"`

	// Value is a JSON document, either {"value": "..."} for a single value or
	// {"values": [...]} for a list.
	Value *string `json:"value"`
}

InputMapping binds one of the template's declared inputs to a value for this run. It is used for both reads and writes.

TemplateInputMappingID is echoed back on reads but ignored on writes: an update replaces the mapping set wholesale, the same way a template's declarations are replaced, so child ids are regenerated rather than matched.

func ToInputMappings

func ToInputMappings(in []*model.TemplateInputMapping) []InputMapping

func (*InputMapping) Validate

func (m *InputMapping) Validate() []httpx.FieldError

Validate implements httpx.Validator.

type InteractiveCommandTaskRequest

type InteractiveCommandTaskRequest struct {
	Command    *string                `json:"command"`
	Output     *string                `json:"output"`
	OnFailure  *model.OnFailureAction `json:"onFailure"`
	RetryCount *int                   `json:"retryCount"`
	TaskOrder  *int                   `json:"taskOrder"`
}

InteractiveCommandTaskRequest is the create/update payload for a command task.

output is writable for the same reason jobId is: it is the result of running the command, recorded once whatever executed it knows the answer.

func (*InteractiveCommandTaskRequest) Validate

Validate implements httpx.Validator.

type InteractiveCommandTaskResponse

type InteractiveCommandTaskResponse struct {
	TaskID    string  `json:"taskId"`
	ProcessID *string `json:"processId"`

	Command    *string                `json:"command"`
	Output     *string                `json:"output"`
	OnFailure  *model.OnFailureAction `json:"onFailure"`
	RetryCount *int                   `json:"retryCount"`
	TaskOrder  *int                   `json:"taskOrder"`
}

InteractiveCommandTaskResponse is the read model for a command task.

type JobMonitoringTaskRequest

type JobMonitoringTaskRequest struct {
	JobID      *string                `json:"jobId"`
	OnFailure  *model.OnFailureAction `json:"onFailure"`
	RetryCount *int                   `json:"retryCount"`
	TaskOrder  *int                   `json:"taskOrder"`
}

JobMonitoringTaskRequest is the create/update payload for a monitoring task.

func (*JobMonitoringTaskRequest) Validate

func (r *JobMonitoringTaskRequest) Validate() []httpx.FieldError

Validate implements httpx.Validator.

type JobMonitoringTaskResponse

type JobMonitoringTaskResponse struct {
	TaskID    string  `json:"taskId"`
	ProcessID *string `json:"processId"`

	JobID      *string                `json:"jobId"`
	OnFailure  *model.OnFailureAction `json:"onFailure"`
	RetryCount *int                   `json:"retryCount"`
	TaskOrder  *int                   `json:"taskOrder"`
}

JobMonitoringTaskResponse is the read model for a monitoring task.

func ToJobMonitoringTaskResponses

func ToJobMonitoringTaskResponses(in []model.JobMonitoringTask) []JobMonitoringTaskResponse

type JobSubmissionTaskRequest

type JobSubmissionTaskRequest struct {
	JobID      *string                `json:"jobId"`
	WorkingDir *string                `json:"workingDir"`
	OnFailure  *model.OnFailureAction `json:"onFailure"`
	RetryCount *int                   `json:"retryCount"`
	TaskOrder  *int                   `json:"taskOrder"`
}

JobSubmissionTaskRequest is the create/update payload for a submission task.

jobId is writable rather than server-generated: it is the scheduler's identifier for the submitted job, learned at submission time and recorded here afterwards.

func (*JobSubmissionTaskRequest) Validate

func (r *JobSubmissionTaskRequest) Validate() []httpx.FieldError

Validate implements httpx.Validator.

type JobSubmissionTaskResponse

type JobSubmissionTaskResponse struct {
	TaskID    string  `json:"taskId"`
	ProcessID *string `json:"processId"`

	JobID      *string                `json:"jobId"`
	WorkingDir *string                `json:"workingDir"`
	Script     *string                `json:"script"`
	OnFailure  *model.OnFailureAction `json:"onFailure"`
	RetryCount *int                   `json:"retryCount"`
	TaskOrder  *int                   `json:"taskOrder"`
}

JobSubmissionTaskResponse is the read model for a submission task.

func ToJobSubmissionTaskResponses

func ToJobSubmissionTaskResponses(in []model.JobSubmissionTask) []JobSubmissionTaskResponse

type JupyterServerResponse

type JupyterServerResponse struct {
	ProcessID string `json:"processId"`
	Linked    bool   `json:"linked"`
	BaseURL   string `json:"baseUrl"`
	Token     string `json:"token"`
}

JupyterServerResponse is how the dashboard opens a process's Jupyter Server: through Airavata's proxy at BaseURL (a path under the API root), with Token as the Jupyter token. Linked says whether the job's Linkspan currently holds its link; until it does, the proxy answers 502.

type OutputMapping

type OutputMapping struct {
	TemplateOutputMappingID string `json:"templateOutputMappingId"`
	TemplateOutputID        string `json:"templateOutputId"`

	// Value is a JSON document, either {"value": "..."} for a single value or
	// {"values": [...]} for a list.
	Value *string `json:"value"`
}

OutputMapping binds one of the template's declared outputs to a value for this run.

func ToOutputMappings

func ToOutputMappings(in []*model.TemplateOutputMapping) []OutputMapping

func (*OutputMapping) Validate

func (m *OutputMapping) Validate() []httpx.FieldError

Validate implements httpx.Validator.

type Request

type Request struct {
	ProcessType *model.ProcessType `json:"processType"`

	// BatchProcess is required when ProcessType is BATCH_JOB and rejected otherwise.
	BatchProcess *BatchProcessRequest `json:"batchProcess"`
}

Request is the create/update payload for a process.

There is no owner field: ownership comes from the access token.

func (*Request) Validate

func (r *Request) Validate() []httpx.FieldError

Validate implements httpx.Validator.

Which sections a body may carry follows from its process type, so the type is checked first and the sections against it: a BATCH_JOB without a batchProcess describes no job at all, and a batchProcess on any other kind of process is a caller's mistake rather than something to store and ignore.

type Response

type Response struct {
	ProcessID      string             `json:"processId"`
	UserID         *string            `json:"userId"`
	ProcessType    *model.ProcessType `json:"processType"`
	LastStatusID   *string            `json:"lastStatusId"`
	LastWorkflowID *string            `json:"lastWorkflowId"`

	BatchProcess *BatchProcessResponse `json:"batchProcess"`
}

Response is the read model for a process, with every section it carries nested inside it.

func ToResponse

func ToResponse(p *model.Process) Response

func ToResponses

func ToResponses(in []model.Process) []Response

type StatusResponse

type StatusResponse struct {
	ProcessStatusID string                   `json:"processStatusId"`
	ProcessID       *string                  `json:"processId"`
	Status          *model.ProcessStatusType `json:"status"`
	Log             *string                  `json:"log"`
	Timestamp       *int64                   `json:"timestamp"`
}

StatusResponse is the read model for one recorded process status.

There is deliberately no request DTO alongside it: statuses are never created or updated from a client request body, only recorded internally by StatusService and read back through it.

func ToStatusResponse

func ToStatusResponse(s *model.ProcessStatus) StatusResponse

func ToStatusResponses

func ToStatusResponses(in []model.ProcessStatus) []StatusResponse

type TaskStatusResponse

type TaskStatusResponse struct {
	TaskStatusID string                `json:"taskStatusId"`
	TaskID       string                `json:"taskId"`
	TaskType     model.TaskType        `json:"taskType"`
	ProcessID    *string               `json:"processId"`
	Status       *model.TaskStatusType `json:"status"`
	Log          *string               `json:"log"`
	Timestamp    *int64                `json:"timestamp"`
}

TaskStatusResponse is the read model for one recorded task status. Like StatusResponse it has no request counterpart: task statuses are recorded by the orchestration engine as it runs a task, never accepted from a client.

func ToTaskStatusResponse

func ToTaskStatusResponse(s *model.TaskStatus) TaskStatusResponse

func ToTaskStatusResponses

func ToTaskStatusResponses(in []model.TaskStatus) []TaskStatusResponse

type WorkflowResponse

type WorkflowResponse struct {
	ProcessWorkflowID string                           `json:"processWorkflowId"`
	ProcessID         *string                          `json:"processId"`
	WorkflowID        string                           `json:"workflowId"`
	WorkflowType      *model.ProcessWorkflowType       `json:"workflowType"`
	Status            *model.ProcessWorkflowStatusType `json:"status"`
	Timestamp         *int64                           `json:"timestamp"`
}

WorkflowResponse is the read model for one recorded process workflow. Like StatusResponse it has no request counterpart: workflows are recorded when a workflow is started for a process, never accepted from a client.

func ToWorkflowResponse

func ToWorkflowResponse(e *model.ProcessWorkflow) WorkflowResponse

func ToWorkflowResponses

func ToWorkflowResponses(in []model.ProcessWorkflow) []WorkflowResponse

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL