Skip to content

Commit

Permalink
Merge pull request #115 from erikdw/per-topology-supervisor-logs
Browse files Browse the repository at this point in the history
per-topology supervisor logs
  • Loading branch information
erikdw committed Mar 25, 2016
2 parents a21ba5f + ade9571 commit b6f232a
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,13 @@ public CommandLineShim(String extraConfig) {
this.extraConfig = extraConfig;
}

public String getCommandLine() {
return "cp storm.yaml storm-mesos*/conf && cd storm-mesos* && python bin/storm.py " +
"supervisor storm.mesos.MesosSupervisor" + extraConfig;
public String getCommandLine(String topologyId) {
return String.format(
"export STORM_SUPERVISOR_LOG_FILE=%s-supervisor.log" +
" && cp storm.yaml storm-mesos*/conf" +
" && cd storm-mesos*" +
" && python bin/storm.py supervisor storm.mesos.MesosSupervisor%s",
topologyId, extraConfig);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,17 @@ public DockerCommandLineShim(String extraConfig) {
this.extraConfig = extraConfig;
}

public String getCommandLine() {
public String getCommandLine(String topologyId) {
// An ugly workaround for a bug in DCOS
Map<String, String> env = System.getenv();
String javaLibPath = env.get("MESOS_NATIVE_JAVA_LIBRARY");
return "export MESOS_NATIVE_JAVA_LIBRARY=" + javaLibPath +
" && /bin/cp $MESOS_SANDBOX/storm.yaml conf && /usr/bin/python bin/storm.py " +
"supervisor storm.mesos.MesosSupervisor -c storm.log.dir=$MESOS_SANDBOX/logs" + extraConfig;
return String.format(
"export MESOS_NATIVE_JAVA_LIBRARY=%s" +
" && export STORM_SUPERVISOR_LOG_FILE=%s-supervisor.log" +
" && /bin/cp $MESOS_SANDBOX/storm.yaml conf " +
" && /usr/bin/python bin/storm.py supervisor storm.mesos.MesosSupervisor " +
"-c storm.log.dir=$MESOS_SANDBOX/logs%s",
javaLibPath, topologyId, extraConfig);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,13 @@ public CommandLineShim(String extraConfig) {
this.extraConfig = extraConfig;
}

public String getCommandLine() {
return "cp storm.yaml storm-mesos*/conf && cd storm-mesos* && python bin/storm " +
"supervisor storm.mesos.MesosSupervisor" + extraConfig;
public String getCommandLine(String topologyId) {
return String.format(
"export STORM_SUPERVISOR_LOG_FILE=%s-supervisor.log" +
" && cp storm.yaml storm-mesos*/conf" +
" && cd storm-mesos*" +
" && python bin/storm supervisor storm.mesos.MesosSupervisor%s",
topologyId, extraConfig);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,16 @@ public DockerCommandLineShim(String extraConfig) {
this.extraConfig = extraConfig;
}

public String getCommandLine() {
public String getCommandLine(String topologyId) {
// An ugly workaround for a bug in DCOS
Map<String, String> env = System.getenv();
String javaLibPath = env.get("MESOS_NATIVE_JAVA_LIBRARY");
return "export MESOS_NATIVE_JAVA_LIBRARY=" + javaLibPath +
" && /bin/cp $MESOS_SANDBOX/storm.yaml conf && /usr/bin/python bin/storm " +
"supervisor storm.mesos.MesosSupervisor -c storm.log.dir=$MESOS_SANDBOX/logs" + extraConfig;
return String.format(
"export MESOS_NATIVE_JAVA_LIBRARY=%s" +
" && export STORM_SUPERVISOR_LOG_FILE=%s-supervisor.log" +
" && /bin/cp $MESOS_SANDBOX/storm.yaml conf " +
" && /usr/bin/python bin/storm supervisor storm.mesos.MesosSupervisor " +
"-c storm.log.dir=$MESOS_SANDBOX/logs%s",
javaLibPath, topologyId, extraConfig);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
*/
public interface ICommandLineShim {

public String getCommandLine();
public String getCommandLine(String topologyId);

}
4 changes: 2 additions & 2 deletions storm/src/main/storm/mesos/MesosNimbus.java
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ protected void computeResourcesForSlot(final RotatingMap<OfferID, Offer> offers,
executorInfoBuilder
.setCommand(CommandInfo.newBuilder()
.addUris(URI.newBuilder().setValue(configUri))
.setValue(commandLineShim.getCommandLine()))
.setValue(commandLineShim.getCommandLine(details.getId())))
.setContainer(
ContainerInfo.newBuilder()
.setType(ContainerInfo.Type.DOCKER)
Expand All @@ -745,7 +745,7 @@ protected void computeResourcesForSlot(final RotatingMap<OfferID, Offer> offers,
.setCommand(CommandInfo.newBuilder()
.addUris(URI.newBuilder().setValue((String) _conf.get(CONF_EXECUTOR_URI)))
.addUris(URI.newBuilder().setValue(configUri))
.setValue(commandLineShim.getCommandLine()));
.setValue(commandLineShim.getCommandLine(details.getId())));
}

LOG.info("Launching task with Mesos Executor data: < {} >", executorDataStr);
Expand Down

0 comments on commit b6f232a

Please sign in to comment.