Skip to content

Commit

Permalink
[HWORKS-590] HA testing (#1409)
Browse files Browse the repository at this point in the history
  • Loading branch information
ErmiasG authored Oct 5, 2023
1 parent 53737fb commit ada8663
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 24 deletions.
3 changes: 2 additions & 1 deletion hopsworks-IT/src/test/ruby/spec/helpers/project_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ def raw_delete_project(project, response, headers)
method: "post",
followlocation: true,
ssl_verifypeer: false,
ssl_verifyhost: 0)
ssl_verifyhost: 0,
forbid_reuse: true)
end

def delete_project(project)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* This file is part of Hopsworks
* Copyright (C) 2019, Logical Clocks AB. All rights reserved
* Copyright (C) 2023, Hopsworks AB. All rights reserved
*
* Hopsworks is free software: you can redistribute it and/or modify it under the terms of
* the GNU Affero General Public License as published by the Free Software Foundation,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import javax.ejb.TransactionAttributeType;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Optional;
import java.util.logging.Level;
Expand Down Expand Up @@ -167,9 +166,8 @@ public PythonDep condaOp(CondaOp op, Users user, CondaInstallType installType, P
proj.setPythonDepCollection(depsInProj);
projectFacade.update(proj);

CondaCommands cc = new CondaCommands(user, op,
CondaStatus.NEW, installType, proj, lib, version, channelUrl,
new Date(), arg, null, false, gitBackend, apiKeyName);
CondaCommands cc = new CondaCommands(user, op, CondaStatus.NEW, installType, proj, lib, version, channelUrl,
arg, null, false, gitBackend, apiKeyName);
condaCommandFacade.save(cc);
} catch (Exception ex) {
throw new GenericException(RESTCodes.GenericErrorCode.UNKNOWN_ERROR, Level.SEVERE, "condaOp failed",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
import javax.ejb.TransactionAttributeType;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;

Expand All @@ -68,8 +67,8 @@ public CondaCommands buildEnvWithCustomCommands(Project project, Users users, Cu
validateArtifacts(cmdSettings);
}
CondaCommands cc = new CondaCommands(users, CondaOp.CUSTOM_COMMANDS, CondaStatus.NEW,
CondaInstallType.CUSTOM_COMMANDS, project, null, version, null, new Date(),
cmdSettings.getArtifacts(), null, false, null, null);
CondaInstallType.CUSTOM_COMMANDS, project, null, version, null, cmdSettings.getArtifacts(), null, false, null,
null);
cc.setCustomCommandsFile(cmdSettings.getCommandsFile());
commandsController.create(cc);
return cc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Optional;
import java.util.logging.Level;
Expand Down Expand Up @@ -201,7 +200,7 @@ private void condaEnvironmentOp(CondaOp op, String pythonVersion, Project proj,
throw new IllegalStateException("Tried to execute a conda env op on a reserved project name");
}
CondaCommands cc = new CondaCommands(user, op, CondaStatus.NEW, CondaInstallType.ENVIRONMENT, proj,
pythonVersion, "", "defaults", new Date(), arg, environmentFile, installJupyter);
pythonVersion, "", "defaults", arg, environmentFile, installJupyter);
condaCommandFacade.save(cc);
}

Expand Down Expand Up @@ -288,7 +287,7 @@ public Project createEnv(Project project, Users user) throws PythonException {

CondaCommands cc = new CondaCommands(user, CondaOp.SYNC_BASE_ENV, CondaStatus.NEW,
CondaInstallType.ENVIRONMENT, project, settings.getDockerBaseImagePythonVersion(),
null, null, new Date(), null, null, false);
null, null, null, null, false);
condaCommandFacade.save(cc);

return projectFacade.update(project);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,10 @@ public int compare(T t, T t1) {
}

private int condaCommandCompare(final CondaCommands t, final CondaCommands t1) {
int comp = t.getCreated().compareTo(t1.getCreated());
if (comp != 0) {
return comp;
}
return t.getId().compareTo(t1.getId());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@

import java.io.Serializable;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
Expand Down Expand Up @@ -175,8 +176,7 @@ public class CondaCommands implements Serializable {
@Enumerated(EnumType.STRING)
private CondaInstallType installType;
@Basic(optional = false)
@NotNull
@Column(name = "created")
@Column(name = "created", insertable = false, updatable = false)
@Temporal(TemporalType.TIMESTAMP)
private Date created;
@JoinColumn(name = "project_id",
Expand All @@ -201,16 +201,15 @@ public class CondaCommands implements Serializable {
public CondaCommands() {
}

public CondaCommands(Users userId, CondaOp op,
CondaStatus status, CondaInstallType installType, Project project, String lib, String version,
String channelUrl, Date created, String arg, String environmentFile, Boolean installJupyter) {
this(userId, op, status, installType, project, lib, version, channelUrl, created, arg,
environmentFile, installJupyter, null, null);
public CondaCommands(Users userId, CondaOp op, CondaStatus status, CondaInstallType installType, Project project,
String lib, String version, String channelUrl, String arg, String environmentFile, Boolean installJupyter) {
this(userId, op, status, installType, project, lib, version, channelUrl, arg, environmentFile, installJupyter, null,
null);
}

public CondaCommands(Users userId, CondaOp op,
CondaStatus status, CondaInstallType installType, Project project, String lib, String version,
String channelUrl, Date created, String arg, String environmentFile, Boolean installJupyter,
String channelUrl, String arg, String environmentFile, Boolean installJupyter,
GitBackend gitBackend, String gitApiKeyName) {
if (op == null || project == null) {
throw new NullPointerException("Op/project cannot be null");
Expand All @@ -220,7 +219,6 @@ public CondaCommands(Users userId, CondaOp op,
this.projectId = project;
this.status = status;
this.installType = installType;
this.created = created;
this.channelUrl = channelUrl;
this.lib = lib;
this.version = version;
Expand Down Expand Up @@ -369,9 +367,10 @@ public boolean equals(Object object) {
@Override
public String toString() {
String projectName = projectId != null ? projectId.getName() : "unknown";
return "[ id=" + id + ", proj=" + projectName + ", op=" + op + ", installType=" + installType
+ ", lib=" + lib + ", version=" + version + ", arg=" + arg
+ ", channel=" + channelUrl + "]";
return "[ id=" + id + ", proj=" + projectName + ", op=" + op + ", installType=" + installType
+ ", lib=" + lib + ", version=" + version + ", arg=" + arg
+ ", channel=" + channelUrl + ", created=" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(created) +
"]";
}

public Users getUserId() {
Expand Down

0 comments on commit ada8663

Please sign in to comment.