summaryrefslogtreecommitdiff
path: root/opendc/models/experiment.py
diff options
context:
space:
mode:
authorleonoverweel <l.overweel@gmail.com>2017-02-27 02:33:02 +0100
committerleonoverweel <l.overweel@gmail.com>2017-02-27 02:33:02 +0100
commit855b654942d400204ea3ce952b5fe0cebf8492c2 (patch)
tree4f963b2bd11a1873d613fc78c0eda5f98e43dd75 /opendc/models/experiment.py
parentcdfce7ce038826bd99be805b7e7579c9ec5d4fc2 (diff)
Add state and last_simulated_tick to Experiments
This change brings the web server back up to date with the new database schema.
Diffstat (limited to 'opendc/models/experiment.py')
-rw-r--r--opendc/models/experiment.py23
1 files changed, 4 insertions, 19 deletions
diff --git a/opendc/models/experiment.py b/opendc/models/experiment.py
index 35056d0f..c7381084 100644
--- a/opendc/models/experiment.py
+++ b/opendc/models/experiment.py
@@ -11,31 +11,16 @@ class Experiment(Model):
'pathId': 'path_id',
'traceId': 'trace_id',
'schedulerName': 'scheduler_name',
- 'name': 'name'
+ 'name': 'name',
+ 'state': 'state',
+ 'lastSimulatedTick': 'last_simulated_tick'
}
}
TABLE_NAME = 'experiments'
- COLUMNS = ['id', 'simulation_id', 'path_id', 'trace_id', 'scheduler_name', 'name']
+ COLUMNS = ['id', 'simulation_id', 'path_id', 'trace_id', 'scheduler_name', 'name', 'state', 'last_simulated_tick']
COLUMNS_PRIMARY_KEY = ['id']
- def get_last_simulated_tick(self):
- """Get this Experiment's last simulated tick."""
-
- statement = '''
- SELECT tick
- FROM task_states
- WHERE experiment_id = ?
- ORDER BY tick DESC
- LIMIT 1
- '''
- result = database.fetchone(statement, (self.id,))
-
- if result is not None:
- return result[0]
-
- return -1
-
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 Experiment."""