Skip to content

Commit

Permalink
Merge pull request #17 from kkrishna/master
Browse files Browse the repository at this point in the history
Fix mesos task status and miscellaneous changes..
  • Loading branch information
kkrishna authored Aug 18, 2016
2 parents 5f10abe + d4d7a6b commit 90898dd
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
13 changes: 10 additions & 3 deletions examples/vagrant/provision-dev-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,16 @@ apt-get -y install \
update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java

readonly IP_ADDRESS=192.168.33.7
readonly MESOS_VERSION=0.28.2-2.0.27
#readonly MESOS_VERSION=0.28.2-2.0.27
readonly MESOS_VERSION=1.0.0-2.0.89
readonly MARATHON_VERSION=1.1.2-1.0.482
readonly PROJECT_HOME_DIR='/home/vagrant/marathon'
readonly PROJECT_VERSION=`mvn -f $PROJECT_HOME_DIR/pom.xml org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | sed -n -e '/^\[.*\]/ !{ /^[0-9]/ { p; q } }'`
readonly PROJECT_VERSION=`mvn -f /vagrant/pom.xml -q \
-Dexec.executable="echo" \
-Dexec.args='${project.version}' \
--non-recursive \
org.codehaus.mojo:exec-maven-plugin:1.3.1:exec`
export PROJECT_VERSION


function install_mesos {
Expand All @@ -93,7 +99,9 @@ function get_pom_version {

function build_docker_compose_executor {
mvn -f /home/vagrant/marathon/pom.xml clean package -U
echo -e 'PROJECT_HOME_DIR='/home/vagrant/marathon/' \nCOMPOSE_JAR_NAME=/home/vagrant/marathon/target/docker-compose-executor_$PROJECT_VERSION.jar \njava -jar ${COMPOSE_JAR_NAME}' | envsubst '$PROJECT_VERSION' > /home/vagrant/marathon/examples/vagrant/docker-compose-executor.sh
chmod 777 /home/vagrant/marathon/target/docker-compose-executor_${PROJECT_VERSION}.jar
chmod +x /home/vagrant/marathon/examples/vagrant/docker-compose-executor.sh
}

function install_cluster_config {
Expand Down Expand Up @@ -159,7 +167,6 @@ install_mesos
install_marathon
install_docker_compose
prepare_sources
install_marathon
install_cluster_config
install_ssh_config
start_services
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@
import javax.inject.Inject;
import java.io.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;

public class DockerComposeExecutor implements Executor {

Expand Down Expand Up @@ -145,7 +147,6 @@ public void call(Subscriber<? super Integer> subscriber) {
}

public void suicide(TaskID taskId, int exitCode) {

if (log.isDebugEnabled()) {
log.debug(" ############## suicide #######");
if (taskId != null)
Expand All @@ -159,14 +160,17 @@ public void suicide(TaskID taskId, int exitCode) {
this.pluginManager.stopPlugins();
}
log.debug(" cleanUp exit code: " + stopContainers);
sendTaskStatusUpdate(executorDriver, taskId, TaskState.TASK_FINISHED);
System.exit(0);
log.debug("Sending TASK_KILLED status..");
sendTaskStatusUpdate(executorDriver, taskId, TaskState.TASK_KILLED);
if (executorDriver != null)
executorDriver.stop();
} else {
if (!isShutDownInProgress) {
int stopContainers = cleanUp();
if (this.pluginManager != null) {
this.pluginManager.stopPlugins();
}
log.debug("Sending TASK_FAILED status");
sendTaskStatusUpdate(executorDriver, taskId, TaskState.TASK_FAILED);
System.exit(1);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ private Map<String, Object> updateContainerValue(String executorId,
Object volumesFromValues = containerDetails.get(VOLUMES_FROM);
if (volumesFromValues != null) {
List<String> updatedVolumesFrom = new ArrayList<String>();
List<?> volumesFrom = (List<?>) updatedVolumesFrom;
List<?> volumesFrom = (List<?>) volumesFromValues;

for (Object o : volumesFrom) {
String volume = (String) o;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/paypal/mesos/executor/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public interface Config {
public static final boolean MONITOR_POD = true;

//time in milliseconds
public static final int POD_MONITOR_INTERVAL = 500;
public static final int POD_MONITOR_INTERVAL = 2000;

public static final boolean IGNORE_PULL_FAILURES = false;
}

0 comments on commit 90898dd

Please sign in to comment.