Skip to content
Snippets Groups Projects
Commit d4a01189 authored by Sven Weber's avatar Sven Weber
Browse files

Removing fixed references to menzel and using learningstoragelocation instead

parent f0e9932b
Branches
Tags
No related merge requests found
......@@ -33,12 +33,13 @@ class FLJobManager
* @param {*} jobId If of the job
* @param {*} pid metadata id of the job
* @param {*} trainclassidlearning train that should be used for learning
* @param {*} trainclassidlearning the location where to pull the learning image from
* @param {*} currentround The current run of the job
* @param {*} maxrounds Max number of rounds the job should run
* @param {*} envs The array with environment variables
* @returns
*/
async createNewWorker(jobId, pid, trainclassidlearning, currentround, maxrounds, envs)
async createNewWorker(jobId, pid, trainclassidlearning, learningstoragelocation, currentround, maxrounds, envs)
{
this.#logger.log(`Creating new JobWorker for job ${jobId}`);
this.#logger.log(`Creating new entry in database for job ${jobId}`);
......@@ -48,7 +49,7 @@ class FLJobManager
"jobid": jobId,
"pid": pid,
"trainclassidlearning": trainclassidlearning,
"trainstoragelocation": "menzel.informatik.rwth-aachen.de:3007/" + trainclassidlearning,
"trainstoragelocation": learningstoragelocation,
"currentround": currentround,
"maxrounds": maxrounds,
"envs": envs
......
......@@ -58,7 +58,7 @@ function readLabelForImage(image, callback)
{
//Read label for the trainclassid
let options = {
uri: `https://${process.env.DOCKER_HOST}:${process.env.DOCKER_PORT}/images/menzel.informatik.rwth-aachen.de:3007/${image}/json?all=1`,
uri: `https://${process.env.DOCKER_HOST}:${process.env.DOCKER_PORT}/images/${image}/json?all=1`,
method: 'GET',
agentOptions: getAgentOptions()
};
......@@ -386,14 +386,14 @@ router.get('/federated', ensureAuthenticated, async (req, res) => {
*/
router.get('/federated/createContainer', ensureAuthenticated, async (req, res) => {
const { jobid, trainclassidlearning, currentround, maxrounds, pid} = req.query;
const { jobid, trainclassidlearning, learningstoragelocation, currentround, maxrounds, pid} = req.query;
try
{
//check if vault is available
await vault.healthStatus();
readLabelForImage(trainclassidlearning, (labels) => {
readLabelForImage(learningstoragelocation, (labels) => {
if (labels == undefined) {
req.flash('error_msg', "Failed to load information from learning image");
res.redirect('/dashboard');
......@@ -407,8 +407,8 @@ router.get('/federated/createContainer', ensureAuthenticated, async (req, res) =
//Redirec to create container screen
res.render('dashboard-create-fedcontainer', {
user: req.user, jobid: jobid, trainclassidlearning: trainclassidlearning,
currentround: currentround, maxrounds: maxrounds, pid: pid,
envVariableList: envVariableList, paths: pathList
learningstoragelocation: learningstoragelocation, currentround: currentround,
maxrounds: maxrounds, pid: pid, envVariableList: envVariableList, paths: pathList
});
});
});
......@@ -420,7 +420,7 @@ router.get('/federated/createContainer', ensureAuthenticated, async (req, res) =
});
router.post('/federated/startLearning', ensureAuthenticated, async (req, res) => {
const { jobid, trainclassidlearning, currentround, maxrounds, pid, envs } = req.body;
const { jobid, trainclassidlearning, learningstoragelocation, currentround, maxrounds, pid, envs } = req.body;
var job = await FLJob.findOne({ jobid: jobid });
......@@ -445,7 +445,7 @@ router.post('/federated/startLearning', ensureAuthenticated, async (req, res) =>
//Create new worker, start learning
var manager = new FLJobManager();
var worker = await manager.createNewWorker(jobid,pid,trainclassidlearning, currentround, maxrounds, env_array);
var worker = await manager.createNewWorker(jobid,pid,trainclassidlearning, learningstoragelocation, currentround, maxrounds, env_array);
worker.start().then(async () => {
var fedJobs = await FLJob.find({});
res.render('dashboard-federated', { user: req.user, federatedJobs: fedJobs, success_msg: "The job " + jobid + " has started learning." });
......
......@@ -194,7 +194,7 @@ const pullImage = (req, res, image, tag, successCallback, failureCallback) =>
router.get('/image/pullfederated', async function (req, res)
{
const { trainclassidlearning } = req.query;
const { learningstoragelocation } = req.query;
try
{
......@@ -204,10 +204,11 @@ router.get('/image/pullfederated', async function (req, res)
{
console.log("error: ", error);
res.status(500).send(error);
return;
}
//TODO: Replace with the actual train storagelocation
await pullImage(req, res, "menzel.informatik.rwth-aachen.de:3007/" + trainclassidlearning, null, async function ()
await pullImage(req, res, learningstoragelocation, null, async function ()
{
//Success
res.end();
......
......@@ -12,6 +12,7 @@
<div class="form-group">
<input type="hidden" id="trainclassidlearning" name="trainclassidlearning" value="<%=trainclassidlearning%>">
<input type="hidden" id="learningstoragelocation" name="learningstoragelocation" value="<%=learningstoragelocation%>">
<input type="hidden" id="jobid" name="jobid" value="<%=jobid%>">
<input type="hidden" id="currentround" name="currentround" value="<%=currentround%>">
<input type="hidden" id="maxrounds" name="maxrounds" value="<%=maxrounds%>">
......
......@@ -355,7 +355,7 @@
function pullFederatedImage(job)
{
job = JSON.parse(job);
const parameter = `jobid=${job.jobid}&trainclassidlearning=${job.trainclassidlearning}&currentround=${job.currentround}&maxrounds=${job.maxrounds}&pid=${job.pid}`;
const parameter = `jobid=${job.jobid}&learningstoragelocation=${job.learningstoragelocation}&trainclassidlearning=${job.trainclassidlearning}&currentround=${job.currentround}&maxrounds=${job.maxrounds}&pid=${job.pid}`;
const url = `/docker/image/pullfederated?` + parameter;
pullImageForJob(job, url, () =>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment