Skip to content

Commit 90898dd

Browse files
authored
Merge pull request #17 from kkrishna/master
Fix mesos task status and miscellaneous changes..
2 parents 5f10abe + d4d7a6b commit 90898dd

File tree

4 files changed

+19
-8
lines changed

4 files changed

+19
-8
lines changed

examples/vagrant/provision-dev-cluster.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,16 @@ apt-get -y install \
6969
update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
7070

7171
readonly IP_ADDRESS=192.168.33.7
72-
readonly MESOS_VERSION=0.28.2-2.0.27
72+
#readonly MESOS_VERSION=0.28.2-2.0.27
73+
readonly MESOS_VERSION=1.0.0-2.0.89
7374
readonly MARATHON_VERSION=1.1.2-1.0.482
7475
readonly PROJECT_HOME_DIR='/home/vagrant/marathon'
75-
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 } }'`
76+
readonly PROJECT_VERSION=`mvn -f /vagrant/pom.xml -q \
77+
-Dexec.executable="echo" \
78+
-Dexec.args='${project.version}' \
79+
--non-recursive \
80+
org.codehaus.mojo:exec-maven-plugin:1.3.1:exec`
81+
export PROJECT_VERSION
7682

7783

7884
function install_mesos {
@@ -93,7 +99,9 @@ function get_pom_version {
9399

94100
function build_docker_compose_executor {
95101
mvn -f /home/vagrant/marathon/pom.xml clean package -U
102+
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
96103
chmod 777 /home/vagrant/marathon/target/docker-compose-executor_${PROJECT_VERSION}.jar
104+
chmod +x /home/vagrant/marathon/examples/vagrant/docker-compose-executor.sh
97105
}
98106

99107
function install_cluster_config {
@@ -159,7 +167,6 @@ install_mesos
159167
install_marathon
160168
install_docker_compose
161169
prepare_sources
162-
install_marathon
163170
install_cluster_config
164171
install_ssh_config
165172
start_services

src/main/java/com/paypal/mesos/executor/DockerComposeExecutor.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@
2222
import javax.inject.Inject;
2323
import java.io.*;
2424
import java.util.ArrayList;
25+
import java.util.Date;
2526
import java.util.List;
2627
import java.util.Map;
28+
import java.util.concurrent.TimeUnit;
2729

2830
public class DockerComposeExecutor implements Executor {
2931

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

147149
public void suicide(TaskID taskId, int exitCode) {
148-
149150
if (log.isDebugEnabled()) {
150151
log.debug(" ############## suicide #######");
151152
if (taskId != null)
@@ -159,14 +160,17 @@ public void suicide(TaskID taskId, int exitCode) {
159160
this.pluginManager.stopPlugins();
160161
}
161162
log.debug(" cleanUp exit code: " + stopContainers);
162-
sendTaskStatusUpdate(executorDriver, taskId, TaskState.TASK_FINISHED);
163-
System.exit(0);
163+
log.debug("Sending TASK_KILLED status..");
164+
sendTaskStatusUpdate(executorDriver, taskId, TaskState.TASK_KILLED);
165+
if (executorDriver != null)
166+
executorDriver.stop();
164167
} else {
165168
if (!isShutDownInProgress) {
166169
int stopContainers = cleanUp();
167170
if (this.pluginManager != null) {
168171
this.pluginManager.stopPlugins();
169172
}
173+
log.debug("Sending TASK_FAILED status");
170174
sendTaskStatusUpdate(executorDriver, taskId, TaskState.TASK_FAILED);
171175
System.exit(1);
172176
} else {

src/main/java/com/paypal/mesos/executor/compose/ComposeRewriteHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ private Map<String, Object> updateContainerValue(String executorId,
114114
Object volumesFromValues = containerDetails.get(VOLUMES_FROM);
115115
if (volumesFromValues != null) {
116116
List<String> updatedVolumesFrom = new ArrayList<String>();
117-
List<?> volumesFrom = (List<?>) updatedVolumesFrom;
117+
List<?> volumesFrom = (List<?>) volumesFromValues;
118118

119119
for (Object o : volumesFrom) {
120120
String volume = (String) o;

src/main/java/com/paypal/mesos/executor/config/Config.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ public interface Config {
77
public static final boolean MONITOR_POD = true;
88

99
//time in milliseconds
10-
public static final int POD_MONITOR_INTERVAL = 500;
10+
public static final int POD_MONITOR_INTERVAL = 2000;
1111

1212
public static final boolean IGNORE_PULL_FAILURES = false;
1313
}

0 commit comments

Comments
 (0)