summaryrefslogtreecommitdiff
path: root/web-server/opendc/models_old/gpu.py
blob: 31b3b6b1c15802ce57721a2d9d6e44f1141a83e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from opendc.models_old.model import Model


class GPU(Model):
    JSON_TO_PYTHON_DICT = {
        'GPU': {
            'id': 'id',
            'manufacturer': 'manufacturer',
            'family': 'family',
            'generation': 'generation',
            'model': 'model',
            'clockRateMhz': 'clock_rate_mhz',
            'numberOfCores': 'number_of_cores',
            'energyConsumptionW': 'energy_consumption_w',
            'failureModelId': 'failure_model_id'
        }
    }

    COLLECTION_NAME = 'gpus'

    COLUMNS = [
        'id', 'manufacturer', 'family', 'generation', 'model', 'clock_rate_mhz', 'number_of_cores',
        'energy_consumption_w', 'failure_model_id'
    ]

    COLUMNS_PRIMARY_KEY = ['id']

    def google_id_has_at_least(self, google_id, authorization_level):
        """Return True if the User has at least the given auth level over this GPU."""

        if authorization_level in ['EDIT', 'OWN']:
            return False

        return True