blob: 2b8aac4ded28769e5c46615ce8a64e1a90c14576 (
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
|
from opendc.models.experiment import Experiment
from opendc.models.simulation import Simulation
from opendc.util.rest import Response
def POST(request):
"""Add a new Experiment for this Simulation."""
request.check_required_parameters(path={'simulationId': 'string'},
body={
'experiment': {
'topologyId': 'string',
'traceId': 'string',
'schedulerName': 'string',
'name': 'string',
}
})
simulation = Simulation.from_id(request.params_path['simulationId'])
simulation.check_exists()
simulation.check_user_access(request.google_id, True)
experiment = Experiment(request.params_body['experiment'])
experiment.set_property('simulationId', request.params_path['simulationId'])
experiment.set_property('state', 'QUEUED')
experiment.set_property('lastSimulatedTick', 0)
experiment.insert()
return Response(200, 'Successfully added Experiment.', experiment.obj)
|