diff options
| author | leonoverweel <l.overweel@gmail.com> | 2017-02-27 02:33:02 +0100 |
|---|---|---|
| committer | leonoverweel <l.overweel@gmail.com> | 2017-02-27 02:33:02 +0100 |
| commit | 855b654942d400204ea3ce952b5fe0cebf8492c2 (patch) | |
| tree | 4f963b2bd11a1873d613fc78c0eda5f98e43dd75 /opendc/models/experiment.py | |
| parent | cdfce7ce038826bd99be805b7e7579c9ec5d4fc2 (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.py | 23 |
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.""" |
