diff options
Diffstat (limited to 'opendc/api/v1/experiments/experimentId')
7 files changed, 31 insertions, 22 deletions
diff --git a/opendc/api/v1/experiments/experimentId/endpoint.py b/opendc/api/v1/experiments/experimentId/endpoint.py index 3bdd30d2..59e0e0fe 100644 --- a/opendc/api/v1/experiments/experimentId/endpoint.py +++ b/opendc/api/v1/experiments/experimentId/endpoint.py @@ -1,13 +1,14 @@ from opendc.models.experiment import Experiment -from opendc.util import database, exceptions +from opendc.util import exceptions from opendc.util.rest import Response + def GET(request): """Get this Experiment.""" try: request.check_required_parameters( - path = { + path={ 'experimentId': 'int' } ) @@ -39,6 +40,7 @@ def GET(request): experiment.to_JSON() ) + def PUT(request): """Update this Experiment's Path, Trace, Scheduler, and/or name.""" @@ -46,10 +48,10 @@ def PUT(request): try: request.check_required_parameters( - path = { + path={ 'experimentId': 'int' }, - body = { + body={ 'experiment': { 'pathId': 'int', 'traceId': 'int', @@ -97,6 +99,7 @@ def PUT(request): experiment.to_JSON() ) + def DELETE(request): """Delete this Experiment.""" @@ -104,7 +107,7 @@ def DELETE(request): try: request.check_required_parameters( - path = { + path={ 'experimentId': 'int' } ) diff --git a/opendc/api/v1/experiments/experimentId/last-simulated-tick/endpoint.py b/opendc/api/v1/experiments/experimentId/last-simulated-tick/endpoint.py index 24eb8932..b4b19f59 100644 --- a/opendc/api/v1/experiments/experimentId/last-simulated-tick/endpoint.py +++ b/opendc/api/v1/experiments/experimentId/last-simulated-tick/endpoint.py @@ -1,7 +1,8 @@ from opendc.models.experiment import Experiment -from opendc.util import database, exceptions +from opendc.util import exceptions from opendc.util.rest import Response + def GET(request): """Get this Experiment's last simulated tick.""" @@ -9,7 +10,7 @@ def GET(request): try: request.check_required_parameters( - path = { + path={ 'experimentId': 'int' } ) @@ -21,7 +22,7 @@ def GET(request): experiment = Experiment.from_primary_key((request.params_path['experimentId'],)) - # Make sure this Experiment exisits + # Make sure this Experiment exists if not experiment.exists(): return Response(404, '{} not found.'.format(experiment)) diff --git a/opendc/api/v1/experiments/experimentId/machine-states/endpoint.py b/opendc/api/v1/experiments/experimentId/machine-states/endpoint.py index 97113e4a..8ad588d2 100644 --- a/opendc/api/v1/experiments/experimentId/machine-states/endpoint.py +++ b/opendc/api/v1/experiments/experimentId/machine-states/endpoint.py @@ -1,8 +1,9 @@ from opendc.models.experiment import Experiment from opendc.models.machine_state import MachineState -from opendc.util import database, exceptions +from opendc.util import exceptions from opendc.util.rest import Response + def GET(request): """Get this Experiment's Machine States.""" @@ -10,7 +11,7 @@ def GET(request): try: request.check_required_parameters( - path = { + path={ 'experimentId': 'int' } ) @@ -22,7 +23,7 @@ def GET(request): experiment = Experiment.from_primary_key((request.params_path['experimentId'],)) - # Make sure this Experiment exisits + # Make sure this Experiment exists if not experiment.exists(): return Response(404, '{} not found.'.format(experiment)) diff --git a/opendc/api/v1/experiments/experimentId/rack-states/endpoint.py b/opendc/api/v1/experiments/experimentId/rack-states/endpoint.py index daed45c5..03570039 100644 --- a/opendc/api/v1/experiments/experimentId/rack-states/endpoint.py +++ b/opendc/api/v1/experiments/experimentId/rack-states/endpoint.py @@ -1,8 +1,9 @@ from opendc.models.experiment import Experiment from opendc.models.rack_state import RackState -from opendc.util import database, exceptions +from opendc.util import exceptions from opendc.util.rest import Response + def GET(request): """Get this Experiment's Tack States.""" @@ -10,7 +11,7 @@ def GET(request): try: request.check_required_parameters( - path = { + path={ 'experimentId': 'int' } ) @@ -22,7 +23,7 @@ def GET(request): experiment = Experiment.from_primary_key((request.params_path['experimentId'],)) - # Make sure this Experiment exisits + # Make sure this Experiment exists if not experiment.exists(): return Response(404, '{} not found.'.format(experiment)) diff --git a/opendc/api/v1/experiments/experimentId/room-states/endpoint.py b/opendc/api/v1/experiments/experimentId/room-states/endpoint.py index 9e283d34..2693dc89 100644 --- a/opendc/api/v1/experiments/experimentId/room-states/endpoint.py +++ b/opendc/api/v1/experiments/experimentId/room-states/endpoint.py @@ -1,8 +1,9 @@ from opendc.models.experiment import Experiment from opendc.models.room_state import RoomState -from opendc.util import database, exceptions +from opendc.util import exceptions from opendc.util.rest import Response + def GET(request): """Get this Experiment's Room States.""" @@ -10,7 +11,7 @@ def GET(request): try: request.check_required_parameters( - path = { + path={ 'experimentId': 'int' } ) @@ -22,7 +23,7 @@ def GET(request): experiment = Experiment.from_primary_key((request.params_path['experimentId'],)) - # Make sure this Experiment exisits + # Make sure this Experiment exists if not experiment.exists(): return Response(404, '{} not found.'.format(experiment)) diff --git a/opendc/api/v1/experiments/experimentId/statistics/task-durations/endpoint.py b/opendc/api/v1/experiments/experimentId/statistics/task-durations/endpoint.py index ad73daa7..b8311f08 100644 --- a/opendc/api/v1/experiments/experimentId/statistics/task-durations/endpoint.py +++ b/opendc/api/v1/experiments/experimentId/statistics/task-durations/endpoint.py @@ -1,8 +1,9 @@ from opendc.models.experiment import Experiment from opendc.models.task_duration import TaskDuration -from opendc.util import database, exceptions +from opendc.util import exceptions from opendc.util.rest import Response + def GET(request): """Get this Experiment's Task Durations.""" @@ -10,7 +11,7 @@ def GET(request): try: request.check_required_parameters( - path = { + path={ 'experimentId': 'int' } ) @@ -22,7 +23,7 @@ def GET(request): experiment = Experiment.from_primary_key((request.params_path['experimentId'],)) - # Make sure this Experiment exisits + # Make sure this Experiment exists if not experiment.exists(): return Response(404, '{} not found.'.format(experiment)) diff --git a/opendc/api/v1/experiments/experimentId/task-states/endpoint.py b/opendc/api/v1/experiments/experimentId/task-states/endpoint.py index 805d86fb..0c3fae89 100644 --- a/opendc/api/v1/experiments/experimentId/task-states/endpoint.py +++ b/opendc/api/v1/experiments/experimentId/task-states/endpoint.py @@ -1,8 +1,9 @@ from opendc.models.experiment import Experiment from opendc.models.task_state import TaskState -from opendc.util import database, exceptions +from opendc.util import exceptions from opendc.util.rest import Response + def GET(request): """Get this Experiment's Task States.""" @@ -10,7 +11,7 @@ def GET(request): try: request.check_required_parameters( - path = { + path={ 'experimentId': 'int' } ) |
