diff options
| author | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-09-21 10:20:50 +0200 |
|---|---|---|
| committer | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-09-23 10:06:04 +0200 |
| commit | da861719c6433a1fc9346da958f0907e52d578ce (patch) | |
| tree | b171796fbfe17f0356bf6e32430223c67812a760 /src/sagas/experiments.js | |
| parent | f8f617c97fcb2df3dbefc9527d974151e367cb60 (diff) | |
Show experiment and trace data on left-hand sidebar
Diffstat (limited to 'src/sagas/experiments.js')
| -rw-r--r-- | src/sagas/experiments.js | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/sagas/experiments.js b/src/sagas/experiments.js index cf92e97f..29f9a211 100644 --- a/src/sagas/experiments.js +++ b/src/sagas/experiments.js @@ -1,15 +1,23 @@ import {call, put, select} from "redux-saga/effects"; import {addPropToStoreObject, addToStore} from "../actions/objects"; import {deleteExperiment, getExperiment} from "../api/routes/experiments"; -import {addExperiment, getExperimentsOfSimulation} from "../api/routes/simulations"; +import {getTasksOfJob} from "../api/routes/jobs"; +import {addExperiment, getExperimentsOfSimulation, getSimulation} from "../api/routes/simulations"; +import {getJobsOfTrace} from "../api/routes/traces"; import {fetchAndStoreAllSchedulers, fetchAndStoreAllTraces, fetchAndStorePathsOfSimulation} from "./objects"; import {fetchAllDatacentersOfExperiment} from "./topology"; export function* onOpenExperimentSucceeded(action) { try { + const simulation = yield call(getSimulation, action.simulationId); + yield put(addToStore("simulation", simulation)); + const experiment = yield call(getExperiment, action.experimentId); yield put(addToStore("experiment", experiment)); + yield fetchExperimentSpecifications(); + yield fetchWorkloadOfTrace(experiment.traceId); + yield fetchAllDatacentersOfExperiment(experiment); } catch (error) { console.error(error); @@ -43,6 +51,24 @@ function* fetchExperimentSpecifications() { } } +function* fetchWorkloadOfTrace(traceId) { + try { + const jobs = yield call(getJobsOfTrace, traceId); + for (let i in jobs) { + const job = jobs[i]; + const tasks = yield call(getTasksOfJob, job.id); + job.taskIds = tasks.map(task => task.id); + for (let j in tasks) { + yield put(addToStore("task", tasks[j])); + } + yield put(addToStore("job", job)); + } + yield put(addPropToStoreObject("trace", traceId, {jobIds: jobs.map(job => job.id)})) + } catch (error) { + console.error(error); + } +} + export function* onAddExperiment(action) { try { const currentSimulationId = yield select(state => state.currentSimulationId); |
