Documentation
¶
Overview ¶
Package application holds application-template and deployment entities.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BatchDeployment ¶
type BatchDeployment struct {
ID string `gorm:"column:deployment_id;primaryKey;type:varchar(36)" json:"deploymentId"`
// The cluster is genuinely optional: a null ClusterID is legitimate, while a
// supplied-but-unknown id is an error the service reports as not-found.
//
// It names the machine only. Which account a run submits under, and with which
// key, is a SlurmClusterConfig chosen at launch time rather than baked into the
// deployment — one deployment serves every user who holds a config for the cluster.
ClusterID *string `gorm:"column:cluster_id;type:varchar(36);index" json:"clusterId,omitempty"`
Cluster *computemodel.SlurmCluster `gorm:"references:ID;constraint:OnDelete:RESTRICT,OnUpdate:CASCADE" json:"-"`
TemplateID *string `gorm:"column:template_id;type:varchar(36);index" json:"templateId,omitempty"`
Template *Template `gorm:"references:ID;constraint:OnDelete:RESTRICT,OnUpdate:CASCADE" json:"-"`
// SlurmRunSection carries every execution command — module loads, the run command
// itself, and cleanup. It is a Jinja template, parameterised at submission time.
SlurmRunSection string `gorm:"column:slurm_run_section;type:text;not null" json:"slurmRunSection"`
// Owned one-to-one. The foreign key lives on this side and is unique, so no two
// deployments can share a config. Because the key points outward, the orphaned
// config row is removed by AfterDelete rather than by a database cascade.
//
// It is the deployment's default: a run copies it into a config of its own and may
// depart from it, which is why the run's snapshot is what a job is submitted with.
DefaultBatchJobConfigID string `gorm:"column:default_batch_job_config_id;type:varchar(36);not null;uniqueIndex" json:"defaultBatchJobConfigId"`
DefaultBatchJobConfig *BatchJobConfig `gorm:"references:ID;constraint:OnDelete:RESTRICT,OnUpdate:CASCADE" json:"defaultBatchJobConfig,omitempty"`
DefaultPartition *string `gorm:"column:default_partition;type:varchar(255)" json:"defaultPartition,omitempty"`
}
BatchDeployment is a Template made runnable on a specific cluster.
Java: org.apache.airavata.application.model.deployment.BatchApplicationDeploymentEntity
func (*BatchDeployment) AfterDelete ¶
func (d *BatchDeployment) AfterDelete(tx *gorm.DB) error
AfterDelete removes the owned BatchJobConfig. This stands in for JPA's orphanRemoval: the foreign key points from the deployment to the config, so the database cannot cascade in this direction and the cleanup has to be explicit.
func (*BatchDeployment) BeforeCreate ¶
func (d *BatchDeployment) BeforeCreate(*gorm.DB) error
BeforeCreate assigns a UUID when none was supplied.
func (BatchDeployment) TableName ¶
func (BatchDeployment) TableName() string
TableName returns the table backing BatchDeployment.
type BatchJobConfig ¶
type BatchJobConfig struct {
ID string `gorm:"column:batch_job_config_id;primaryKey;type:varchar(36)" json:"batchJobConfigId"`
// Slurm resource allocation parameters. All optional: an unset value means "let
// the scheduler decide", which is distinct from an explicit zero.
CPUs *int32 `gorm:"column:cpus" json:"cpus,omitempty"`
Mem *string `gorm:"column:mem;type:varchar(64)" json:"mem,omitempty"`
MemPerCPU *string `gorm:"column:mem_per_cpu;type:varchar(64)" json:"memPerCpu,omitempty"`
NtasksPerNode *int32 `gorm:"column:ntasks_per_node" json:"ntasksPerNode,omitempty"`
CPUsPerTask *int32 `gorm:"column:cpus_per_task" json:"cpusPerTask,omitempty"`
Nodes *int32 `gorm:"column:nodes" json:"nodes,omitempty"`
Ntasks *int32 `gorm:"column:ntasks" json:"ntasks,omitempty"`
// GPU related fields.
Gres *string `gorm:"column:gres;type:varchar(255)" json:"gres,omitempty"`
GPUs *int32 `gorm:"column:gpus" json:"gpus,omitempty"`
MemPerGPU *string `gorm:"column:mem_per_gpu;type:varchar(64)" json:"memPerGpu,omitempty"`
CPUsPerGPU *string `gorm:"column:cpus_per_gpu;type:varchar(64)" json:"cpusPerGpu,omitempty"`
GPUsPerNode *int32 `gorm:"column:gpus_per_node" json:"gpusPerNode,omitempty"`
WallTimeMinutes int64 `gorm:"column:wall_time_minutes;not null" json:"wallTimeMinutes"`
// Constraints is a Slurm feature constraint expression, e.g. "gpu", "highmem".
Constraints *string `gorm:"column:constraints;type:varchar(255)" json:"constraints,omitempty"`
// QOS is the Slurm quality of service the job is submitted under, e.g. "normal".
QOS *string `gorm:"column:qos;type:varchar(255)" json:"qos,omitempty"`
Allocation string `gorm:"column:allocation;type:varchar(255);not null" json:"allocation"`
}
BatchJobConfig is a batch-scheduler resource request.
It is owned outright by whatever references it — a BatchDeployment as its default, or a BatchJobProcess as the snapshot of what that run actually asked for. It is created, replaced and deleted with its owner and has no life of its own, so it is never shared between two owners.
Java: org.apache.airavata.application.model.deployment.BatchJobConfigs
func (*BatchJobConfig) BeforeCreate ¶
func (c *BatchJobConfig) BeforeCreate(*gorm.DB) error
BeforeCreate assigns a UUID when none was supplied.
func (BatchJobConfig) TableName ¶
func (BatchJobConfig) TableName() string
TableName returns the table backing BatchJobConfig.
type Template ¶
type Template struct {
ID string `gorm:"column:template_id;primaryKey;type:varchar(36)" json:"templateId"`
TemplateName *string `gorm:"column:template_name;type:varchar(255)" json:"templateName,omitempty"`
TemplateDescription *string `gorm:"column:template_description;type:varchar(2048)" json:"templateDescription,omitempty"`
Inputs []TemplateInput `gorm:"foreignKey:TemplateID;references:ID;constraint:OnDelete:CASCADE,OnUpdate:CASCADE" json:"inputs,omitempty"`
Outputs []TemplateOutput `gorm:"foreignKey:TemplateID;references:ID;constraint:OnDelete:CASCADE,OnUpdate:CASCADE" json:"outputs,omitempty"`
}
Template describes an application's input/output contract, independent of where it runs.
Inputs and outputs are owned by the template: created, replaced and deleted with it. Deployments are not — they outlive individual edits and are managed through their own endpoints, so deleting a template that still has deployments is refused with a conflict in the service layer.
Java: org.apache.airavata.application.model.template.ApplicationTemplateEntity
func (*Template) BeforeCreate ¶
BeforeCreate assigns a UUID when none was supplied.
type TemplateInput ¶
type TemplateInput struct {
ID string `gorm:"column:input_id;primaryKey;type:varchar(36)" json:"inputId"`
// Owned by Template.Inputs, which declares the cascade; only the key is held here.
TemplateID *string `gorm:"column:template_id;type:varchar(36);uniqueIndex:uk_template_input_name" json:"templateId,omitempty"`
InputName *string `gorm:"column:input_name;type:varchar(255);uniqueIndex:uk_template_input_name" json:"inputName,omitempty"`
DisplayName *string `gorm:"column:display_name;type:varchar(255)" json:"displayName,omitempty"`
InputDescription *string `gorm:"column:input_description;type:varchar(2048)" json:"inputDescription,omitempty"`
InputType *TemplateInputType `gorm:"column:input_type;type:varchar(32)" json:"inputType,omitempty"`
IsRequired bool `gorm:"column:is_required;not null" json:"isRequired"`
// DefaultValue is a JSON document, either {"value": "..."} for a single value or
// {"values": [...]} for a list.
DefaultValue *string `gorm:"column:default_value;type:text" json:"defaultValue,omitempty"`
}
TemplateInput is one declared input of a Template.
The (template_id, input_name) pair is unique. The Java @UniqueConstraint named the column "input_name" while Hibernate's identity naming strategy actually produced "inputName", so the constraint referenced a column that did not exist and never took effect. Under the normalised snake_case schema the name matches and the constraint is live — meaning duplicate input names within a template are now rejected, as was always intended.
Java: org.apache.airavata.application.model.template.ApplicationTemplateInputEntity
func (*TemplateInput) BeforeCreate ¶
func (i *TemplateInput) BeforeCreate(*gorm.DB) error
BeforeCreate assigns a UUID when none was supplied.
func (TemplateInput) TableName ¶
func (TemplateInput) TableName() string
TableName returns the table backing TemplateInput.
type TemplateInputType ¶
type TemplateInputType string
TemplateInputType is the declared type of a template input.
Java stored this as an ORDINAL int (the field carried no @Enumerated annotation), which meant reordering the enum silently reinterpreted existing rows. It is stored by name here. The JSON representation is unchanged — Jackson already serialised these by name — so this is a storage fix, not an API change.
Java: org.apache.airavata.application.model.template.ApplicationTemplateInputType
const ( TemplateInputTypeString TemplateInputType = "STRING" TemplateInputTypeInteger TemplateInputType = "INTEGER" TemplateInputTypeFloat TemplateInputType = "FLOAT" TemplateInputTypeBoolean TemplateInputType = "BOOLEAN" TemplateInputTypeFile TemplateInputType = "FILE" TemplateInputTypeFileList TemplateInputType = "FILE_LIST" TemplateInputTypeDirectory TemplateInputType = "DIRECTORY" )
func (TemplateInputType) Valid ¶
func (t TemplateInputType) Valid() bool
Valid reports whether t is a recognised TemplateInputType.
type TemplateOutput ¶
type TemplateOutput struct {
ID string `gorm:"column:output_id;primaryKey;type:varchar(36)" json:"outputId"`
// Owned by Template.Outputs, which declares the cascade; only the key is held here.
TemplateID *string `gorm:"column:template_id;type:varchar(36);index" json:"templateId,omitempty"`
OutputType *TemplateOutputType `gorm:"column:output_type;type:varchar(32)" json:"outputType,omitempty"`
OutputName *string `gorm:"column:output_name;type:varchar(255)" json:"outputName,omitempty"`
DisplayName *string `gorm:"column:display_name;type:varchar(255)" json:"displayName,omitempty"`
OutputDescription *string `gorm:"column:output_description;type:varchar(2048)" json:"outputDescription,omitempty"`
}
TemplateOutput is one declared output of a Template.
Java: org.apache.airavata.application.model.template.ApplicationTemplateOutputEntity
func (*TemplateOutput) BeforeCreate ¶
func (o *TemplateOutput) BeforeCreate(*gorm.DB) error
BeforeCreate assigns a UUID when none was supplied.
func (TemplateOutput) TableName ¶
func (TemplateOutput) TableName() string
TableName returns the table backing TemplateOutput.
type TemplateOutputType ¶
type TemplateOutputType string
TemplateOutputType is the declared type of a template output. Stored by name for the same reason as TemplateInputType.
Java: org.apache.airavata.application.model.template.ApplicationTemplateOutputType
const ( TemplateOutputTypeFile TemplateOutputType = "FILE" TemplateOutputTypeFileList TemplateOutputType = "FILE_LIST" TemplateOutputTypeDirectory TemplateOutputType = "DIRECTORY" )
func (TemplateOutputType) Valid ¶
func (t TemplateOutputType) Valid() bool
Valid reports whether t is a recognised TemplateOutputType.