Skip to content

Resources

AttributeType (TimeStampedModel) django-model

An attribute type indicates the data type of the attribute. Examples include Date, Float, Int, Text, and Yes/No.

Attributes:

Name Type Description
name str

name of attribute data type

created: AutoCreatedField django-field

created

modified: AutoLastModifiedField django-field

modified

name: CharField django-field

name

Resource (TimeStampedModel) django-model

A resource is something a center maintains and provides access to for the community. Examples include Budgetstorage, Server, and Software License.

Attributes:

Name Type Description
parent_resource Resource

used for the Cluster Partition resource type as these partitions fall under a main cluster

resource_type ResourceType

the type of resource (Cluster, Storage, etc.)

name str

name of resource

description str

description of what the resource does and is used for

is_available bool

indicates whether or not the resource is available for users to request an allocation for

is_public bool

indicates whether or not users can see the resource

requires_payment bool

indicates whether or not users have to pay to use this resource

allowed_groups Group

uses the Django Group model to allow certain user groups to request the resource

allowed_users User

links Django Users that are allowed to request the resource to the resource

allowed_groups: ManyToManyField blank django-field

allowed groups

allowed_users: ManyToManyField blank django-field

allowed users

created: AutoCreatedField django-field

created

description: TextField django-field

description

is_allocatable: BooleanField django-field

is allocatable

is_available: BooleanField django-field

is available

is_public: BooleanField django-field

is public

linked_resources: ManyToManyField blank django-field

linked resources

modified: AutoLastModifiedField django-field

modified

name: CharField django-field

name

parent_resource: ForeignKey blank django-field nullable

parent resource

requires_payment: BooleanField django-field

requires payment

resource_type: ForeignKey django-field

resource type

status property readonly

Returns:

Type Description
str

the status of the resource

get_attribute

Parameters:

Name Type Description Default
name str

name of the resource attribute type

required
expand bool

indicates whether or not to return the expanded value with attributes/parameters for attributes with a base type of 'Attribute Expanded Text'

True
typed bool

indicates whether or not to convert the attribute value to an int/ float/ str based on the base AttributeType name

True
extra_allocations list[Allocation]

allocations which are available to reference in the attribute list in addition to those associated with this ResourceAttribute

[]

Returns:

Type Description
str

the value of the first attribute found for this resource with the specified name

get_attribute_list

Parameters:

Name Type Description Default
name str

name of the resource

required
expand bool

indicates whether or not to return the expanded value with attributes/parameters for attributes with a base type of 'Attribute Expanded Text'

True
typed bool

indicates whether or not to convert the attribute value to an int/ float/ str based on the base AttributeType name

True
extra_allocations list[Allocation]

allocations which are available to reference in the attribute list in addition to those associated with this ResourceAttribute

[]

Returns:

Type Description
list

the list of values of the attributes found with specified name

get_missing_resource_attributes

Parameters:

Name Type Description Default
required bool

indicates whether or not to get only the missing resource attributes that are required (if True, get only required missing attributes; else, get required and non-required missing attributes)

False

Returns:

Type Description
list[ResourceAttribute]

a list of resource attributes that do not already exist for this resource

get_ondemand_status

Returns:

Type Description
str

If the resource has OnDemand status or not

save_without_historical_record

Save model without saving a historical record

Make sure you know what you're doing before you use this method.

ResourceAttribute (TimeStampedModel) django-model

A resource attribute class links a resource attribute type and a resource.

Attributes:

Name Type Description
resource_attribute_type ResourceAttributeType

resource attribute type to link

resource Resource

resource to link

value str

value of the resource attribute

created: AutoCreatedField django-field

created

modified: AutoLastModifiedField django-field

modified

resource: ForeignKey django-field

resource

resource_attribute_type: ForeignKey django-field

resource attribute type

value: TextField django-field

value

clean

Validates the resource and raises errors if the resource is invalid.

expanded_value

Parameters:

Name Type Description Default
typed bool

indicates whether or not to convert the attribute value to an int/ float/ str based on the base AttributeType name (unrecognized values not converted, so will return str)

True
extra_allocations list[Allocation]

allocations which are available to reference in the attribute list in addition to those associated with this ResourceAttribute

[]

Returns:

Type Description
int, float, str

the value of the attribute after attribute expansion

For attributes with attribute type of 'Attribute Expanded Text' we look for an attribute with same name suffixed with '_attriblist' (this should be ResourceAttribute of the Resource associated with the attribute). If the attriblist attribute is found, we use it to generate a dictionary to use to expand the attribute value, and the expanded value is returned.

If the expansion fails, or if no attriblist attribute is found, or if the attribute type is not 'Attribute Expanded Text', we just return the raw value.

save_without_historical_record

Save model without saving a historical record

Make sure you know what you're doing before you use this method.

typed_value

Returns:

Type Description
int, float, str

the value of the attribute with proper type and is used for computing expanded_value() (coerced into int or float for attributes with Int or Float types; if it fails or the attribute is of any other type, it is coerced into a str)

ResourceAttributeType (TimeStampedModel) django-model

A resource attribute type indicates the type of the attribute. Examples include slurm_specs and slurm_cluster.

Attributes:

Name Type Description
attribute_type AttributeType

indicates the AttributeType of the attribute

name str

name of resource attribute type

is_required bool

indicates whether or not the attribute is required

is_value_unique bool

indicates whether or not the value is unique

Note: the is_unique_per_resource field is rarely used, hence documentation does not exist.

attribute_type: ForeignKey django-field

attribute type

created: AutoCreatedField django-field

created

is_required: BooleanField django-field

is required

is_unique_per_resource: BooleanField django-field

is unique per resource

is_value_unique: BooleanField django-field

is value unique

modified: AutoLastModifiedField django-field

modified

name: CharField django-field

name

save_without_historical_record

Save model without saving a historical record

Make sure you know what you're doing before you use this method.

ResourceType (TimeStampedModel) django-model

A resource type class links a resource and its value.

Attributes:

Name Type Description
name str

name of resource type

description str

description of resource type

active_count property readonly

Returns:

Type Description
int

the number of active resources of that type

created: AutoCreatedField django-field

created

description: CharField django-field

description

inactive_count property readonly

Returns:

Type Description
int

the number of inactive resources of that type

modified: AutoLastModifiedField django-field

modified

name: CharField django-field

name

save_without_historical_record

Save model without saving a historical record

Make sure you know what you're doing before you use this method.