Skip to content

Commit

Permalink
[HOPSWORKS-843] TensorBoard cleans up certificates twice (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
robzor92 authored and SirOibaf committed Dec 18, 2018
1 parent 1f19332 commit 5631859
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,19 +143,17 @@ public TensorBoardDTO startTensorBoard(Project project, Users user, HdfsUsers hd

while(retries > 0) {

if(retries == 0) {
throw new IOException("Failed to start TensorBoard for project=" + project.getName() + ", user="
+ user.getUid());
}
try {

// use pidfile to kill any running servers
port = ThreadLocalRandom.current().nextInt(40000, 59999);
if(retries == 0) {
throw new IOException("Failed to start TensorBoard for project=" + project.getName() + ", user="
+ user.getUid());
}

String[] command = new String[]{"/usr/bin/sudo", prog, "start", hdfsUser.getName(), hdfsLogdir,
tbPath, port.toString(), anacondaEnvironmentPath, settings.getHadoopVersion(), certsPath,
settings.getJavaHome()};
// use pidfile to kill any running servers
port = ThreadLocalRandom.current().nextInt(40000, 59999);

ProcessDescriptor processDescriptor = new ProcessDescriptor.Builder()
ProcessDescriptor processDescriptor = new ProcessDescriptor.Builder()
.addCommand("/usr/bin/sudo")
.addCommand(prog)
.addCommand("start")
Expand All @@ -169,9 +167,8 @@ public TensorBoardDTO startTensorBoard(Project project, Users user, HdfsUsers hd
.addCommand(settings.getJavaHome())
.ignoreOutErrStreams(true)
.build();
LOGGER.log(Level.FINE, processDescriptor.toString());

try {
LOGGER.log(Level.FINE, processDescriptor.toString());

ProcessResult processResult = osProcessExecutor.execute(processDescriptor);
if (!processResult.processExited()) {
throw new IOException("Tensorboard start process timed out!");
Expand All @@ -192,7 +189,7 @@ public TensorBoardDTO startTensorBoard(Project project, Users user, HdfsUsers hd
try {
host = InetAddress.getLocalHost().getHostAddress();
} catch (UnknownHostException ex) {
Logger.getLogger(TensorBoardProcessMgr.class.getName()).log(Level.SEVERE, null, ex);
LOGGER.log(Level.SEVERE, null, ex);
}
tensorBoardDTO.setEndpoint(host + ":" + port);
tensorBoardDTO.setPid(pid);
Expand Down Expand Up @@ -262,7 +259,6 @@ public int killTensorBoard(BigInteger pid) {
ProcessResult processResult = osProcessExecutor.execute(processDescriptor);
if (!processResult.processExited()) {
LOGGER.log(Level.SEVERE,"Failed to kill TensorBoard");
exitValue = 2;
}
exitValue = processResult.getExitCode();
} catch (IOException ex) {
Expand All @@ -278,7 +274,7 @@ public int killTensorBoard(BigInteger pid) {
* @return
*/
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public int killTensorBoard(TensorBoard tb) throws ServiceException {
public int killTensorBoard(TensorBoard tb) {

String prog = settings.getHopsworksDomainDir() + "/bin/tensorboard.sh";
int exitValue;
Expand All @@ -295,10 +291,8 @@ public int killTensorBoard(TensorBoard tb) throws ServiceException {
ProcessResult processResult = osProcessExecutor.execute(processDescriptor);
if (!processResult.processExited()) {
LOGGER.log(Level.SEVERE, "Failed to kill TensorBoard, process time-out");
exitValue = 2;
}
exitValue = processResult.getExitCode();
cleanupLocalTBDir(tb);
} catch (IOException ex) {
exitValue=2;
LOGGER.log(Level.SEVERE,"Failed to kill TensorBoard" , ex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,6 @@ private boolean removeRemoteInternal(MaterialKey key, String remoteDirectory, bo
remoteMaterialReferencesFacade.delete(materialRef.getIdentifier());
deletedMaterial = true;
} else {
materialRef.decrementReferences();
remoteMaterialReferencesFacade.update(materialRef);
}
} else {
Expand Down
4 changes: 0 additions & 4 deletions hopsworks-ear/test/spec/projects_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,7 @@
project_id = json_body[:projectId]
get "#{ENV['HOPSWORKS_API']}/project/#{project_id}/dataset/getContent"
expect_status(200)
jupyter = json_body.detect { |e| e[:name] == "Jupyter" }
notebook = json_body.detect { |e| e[:name] == "notebook" }
expect(jupyter[:description]).to eq ("Contains Jupyter notebooks.")
expect(jupyter[:permission]).to eq ("rwxrwx--T")
expect(jupyter[:owner]).to eq ("#{@user[:fname]} #{@user[:lname]}")
expect(notebook[:description]).to eq ("Contains Zeppelin notebooks.")
expect(notebook[:permission]).to eq ("rwxrwx--T")
expect(notebook[:owner]).to eq ("#{@user[:fname]} #{@user[:lname]}")
Expand Down

0 comments on commit 5631859

Please sign in to comment.