QuotaConfig

pydantic model gafaelfawr.config.QuotaConfig

Quota configuration.

Parameters:

data (Any)

Show JSON schema
{
   "title": "QuotaConfig",
   "description": "Quota configuration.",
   "type": "object",
   "properties": {
      "default": {
         "$ref": "#/$defs/Quota",
         "title": "Default quota",
         "description": "Default quotas for all users"
      },
      "groups": {
         "additionalProperties": {
            "$ref": "#/$defs/Quota"
         },
         "default": {},
         "description": "Additional quota grants by group name",
         "title": "Quota grants by group",
         "type": "object"
      },
      "bypass": {
         "default": [],
         "description": "Groups whose members bypass all quota restrictions",
         "items": {
            "type": "string"
         },
         "title": "Groups without quotas",
         "type": "array",
         "uniqueItems": true
      }
   },
   "$defs": {
      "NotebookQuota": {
         "additionalProperties": false,
         "description": "Notebook Aspect quota information for a user.",
         "properties": {
            "cpu": {
               "examples": [
                  4.0
               ],
               "title": "CPU equivalents",
               "type": "number"
            },
            "memory": {
               "examples": [
                  16.0
               ],
               "title": "Maximum memory use (GiB)",
               "type": "number"
            },
            "spawn": {
               "default": true,
               "description": "Whether the user is allowed to spawn a notebook",
               "title": "Spawning allowed",
               "type": "boolean"
            }
         },
         "required": [
            "cpu",
            "memory"
         ],
         "title": "NotebookQuota",
         "type": "object"
      },
      "Quota": {
         "additionalProperties": false,
         "description": "Quota information for a user.",
         "properties": {
            "api": {
               "additionalProperties": {
                  "type": "integer"
               },
               "default": {},
               "description": "Mapping of service names to allowed requests per 15 minutes.",
               "examples": [
                  {
                     "datalinker": 500,
                     "hips": 2000,
                     "tap": 500,
                     "vo-cutouts": 100
                  }
               ],
               "title": "API quotas",
               "type": "object"
            },
            "notebook": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/NotebookQuota"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Notebook Aspect quotas"
            }
         },
         "title": "Quota",
         "type": "object"
      }
   },
   "additionalProperties": false,
   "required": [
      "default"
   ]
}

Fields:
field bypass: set[str] = {}

Groups whose members bypass all quota restrictions

field default: Quota [Required]

Default quotas for all users

field groups: dict[str, Quota] = {}

Additional quota grants by group name

calculate_quota(groups)

Calculate user’s quota given their group membership.

Parameters:

groups (set[str]) – Group membership of the user.

Returns:

Quota information for that user or None if no quotas apply. If the user bypasses quotas, a Quota model with quotas set to None or an empty dictionary is returned rather than None.

Return type:

Quota or None