summaryrefslogtreecommitdiff
path: root/src/sagas/experiments.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/sagas/experiments.js')
-rw-r--r--src/sagas/experiments.js28
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);