diff --git a/examples/vagrant/provision-dev-cluster.sh b/examples/vagrant/provision-dev-cluster.sh index f815b94..50bc1c2 100755 --- a/examples/vagrant/provision-dev-cluster.sh +++ b/examples/vagrant/provision-dev-cluster.sh @@ -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 { @@ -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 { @@ -159,7 +167,6 @@ install_mesos install_marathon install_docker_compose prepare_sources -install_marathon install_cluster_config install_ssh_config start_services diff --git a/src/main/java/com/paypal/mesos/executor/DockerComposeExecutor.java b/src/main/java/com/paypal/mesos/executor/DockerComposeExecutor.java index 9c86b8f..491b8b4 100644 --- a/src/main/java/com/paypal/mesos/executor/DockerComposeExecutor.java +++ b/src/main/java/com/paypal/mesos/executor/DockerComposeExecutor.java @@ -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 { @@ -145,7 +147,6 @@ public void call(Subscriber subscriber) { } public void suicide(TaskID taskId, int exitCode) { - if (log.isDebugEnabled()) { log.debug(" ############## suicide #######"); if (taskId != null) @@ -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 { diff --git a/src/main/java/com/paypal/mesos/executor/compose/ComposeRewriteHelper.java b/src/main/java/com/paypal/mesos/executor/compose/ComposeRewriteHelper.java index 5690c1b..71155ad 100644 --- a/src/main/java/com/paypal/mesos/executor/compose/ComposeRewriteHelper.java +++ b/src/main/java/com/paypal/mesos/executor/compose/ComposeRewriteHelper.java @@ -114,7 +114,7 @@ private Map updateContainerValue(String executorId, Object volumesFromValues = containerDetails.get(VOLUMES_FROM); if (volumesFromValues != null) { List updatedVolumesFrom = new ArrayList(); - List volumesFrom = (List) updatedVolumesFrom; + List volumesFrom = (List) volumesFromValues; for (Object o : volumesFrom) { String volume = (String) o; diff --git a/src/main/java/com/paypal/mesos/executor/config/Config.java b/src/main/java/com/paypal/mesos/executor/config/Config.java index b5a96c1..70c9dce 100644 --- a/src/main/java/com/paypal/mesos/executor/config/Config.java +++ b/src/main/java/com/paypal/mesos/executor/config/Config.java @@ -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; }