New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow slave process to use the slave memory specified in the configuration #30
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,6 @@ | |
*/ | ||
package org.jenkinsci.plugins.mesos; | ||
|
||
import hudson.model.Label; | ||
|
||
public abstract class Mesos { | ||
private static MesosImpl mesos; | ||
|
@@ -29,17 +28,21 @@ public JenkinsSlave(String name) { | |
|
||
public static class SlaveRequest { | ||
JenkinsSlave slave; | ||
|
||
final double cpus; | ||
final int mem; | ||
final String label; | ||
final String jvmArgs; | ||
final int slaveMem; | ||
|
||
public SlaveRequest(JenkinsSlave slave, double cpus, int mem, String label, String jvmArgs) { | ||
public SlaveRequest(JenkinsSlave slave, double cpus, int mem, String label, String jvmArgs, int slaveMem) { | ||
this.slave = slave; | ||
this.cpus = cpus; | ||
this.mem = mem; | ||
this.label = label; | ||
this.jvmArgs = jvmArgs; | ||
// the amoutn memory for the jenkins slave process to use | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/the/The/ |
||
this.slaveMem = slaveMem; | ||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,8 +71,10 @@ public void launch(SlaveComputer _computer, TaskListener listener) throws Interr | |
// Create the request. | ||
double cpus = computer.getNode().getCpus(); | ||
int mem = computer.getNode().getMem(); | ||
int slaveMem = computer.getNode().getSlaveMem(); | ||
|
||
Mesos.SlaveRequest request = new Mesos.SlaveRequest(new JenkinsSlave(name), | ||
cpus, mem, _computer.getNode().getLabelString(), computer.getJvmArgs()); | ||
cpus, mem, _computer.getNode().getLabelString(), computer.getJvmArgs(), slaveMem); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. make slaveMem the 4th argument after "mem". |
||
|
||
// Launch the jenkins slave. | ||
final Lock lock = new ReentrantLock(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,7 @@ public class MesosSlave extends Slave { | |
private final double cpus; | ||
private final int mem; | ||
private final String jvmArgs; | ||
private final int slaveMem; | ||
|
||
private static final Logger LOGGER = Logger.getLogger(MesosSlave.class | ||
.getName()); | ||
|
@@ -56,6 +57,9 @@ public MesosSlave(String name, int numExecutors, String labelString, | |
|
||
this.cpus = slaveCpus + (numExecutors * executorCpus); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of passing mem and slaveJarMem which is a bit confusing how about passing around a "Resources" object. The object could contain numExecutors, slaveCpus, slaveMem, execuorCpus and executorMem. Inside JenkinsScheduler.java the "Resources" object could be handled appropriately? You could do that in a subsequent review if you don't want to do it now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can talk about about this in person, but there are only 3 params that we need, and putting them into a resource object doesn't seem to improve things much. |
||
this.mem = slaveMem + (numExecutors * executorMem); | ||
|
||
// jenkins slave memory size and args | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/jenkins/Jenkins/ |
||
this.slaveMem = slaveMem; | ||
this.jvmArgs = jvmArgs; | ||
|
||
LOGGER.info("Constructing Mesos slave"); | ||
|
@@ -68,6 +72,10 @@ public double getCpus() { | |
public int getMem() { | ||
return mem; | ||
} | ||
|
||
public int getSlaveMem() { | ||
return slaveMem; | ||
} | ||
|
||
public String getJvmArgs() { | ||
return jvmArgs; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets make 'slaveMem' the 4th argument (after "mem") instead of last.