summaryrefslogtreecommitdiff
path: root/opendc/models/machine_state.py
diff options
context:
space:
mode:
authorGeorgios Andreadis <info@gandreadis.com>2020-06-24 09:13:09 +0200
committerGeorgios Andreadis <info@gandreadis.com>2020-06-24 09:13:09 +0200
commitbae760a62fc6a480fbe615dff6a7de03c7fd6d1d (patch)
tree06fc47f9922add14a3ac50fcfdfeb3d4fdc00363 /opendc/models/machine_state.py
parent6fdb3e75dad15523d996e457c216647755b29101 (diff)
Add formatter
Diffstat (limited to 'opendc/models/machine_state.py')
-rw-r--r--opendc/models/machine_state.py15
1 files changed, 4 insertions, 11 deletions
diff --git a/opendc/models/machine_state.py b/opendc/models/machine_state.py
index ba6d261f..3418f66e 100644
--- a/opendc/models/machine_state.py
+++ b/opendc/models/machine_state.py
@@ -14,8 +14,7 @@ class MachineState(Model):
}
COLLECTION_NAME = 'machine_states'
- COLUMNS = ['id', 'machine_id', 'experiment_id', 'tick', 'temperature_c', 'in_use_memory_mb',
- 'load_fraction']
+ COLUMNS = ['id', 'machine_id', 'experiment_id', 'tick', 'temperature_c', 'in_use_memory_mb', 'load_fraction']
COLUMNS_PRIMARY_KEY = ['id']
@@ -23,13 +22,7 @@ class MachineState(Model):
def _from_database_row(cls, row):
"""Instantiate a MachineState from a database row (including tick from the TaskState)."""
- return cls(
- machine_id=row[1],
- temperature_c=row[4],
- in_use_memory_mb=row[5],
- load_fraction=row[6],
- tick=row[3]
- )
+ return cls(machine_id=row[1], temperature_c=row[4], in_use_memory_mb=row[5], load_fraction=row[6], tick=row[3])
@classmethod
def from_experiment_id(cls, experiment_id):
@@ -38,7 +31,7 @@ class MachineState(Model):
machine_states = []
statement = 'SELECT * FROM machine_states WHERE experiment_id = %s'
- results = database.fetch_all(statement, (experiment_id,))
+ results = database.fetch_all(statement, (experiment_id, ))
for row in results:
machine_states.append(cls._from_database_row(row))
@@ -65,7 +58,7 @@ class MachineState(Model):
super(MachineState, self).read()
statement = 'SELECT tick FROM task_states WHERE id = %s'
- result = database.fetch_one(statement, (self.task_state_id,))
+ result = database.fetch_one(statement, (self.task_state_id, ))
self.tick = result[0]