Skip to content

Commit

Permalink
Merge pull request #1322 from virtualcell/health-sim-status
Browse files Browse the repository at this point in the history
sim health is now OK:UP, Warning:UP, Critical:DOWN, Uknown:DOWN
  • Loading branch information
jcschaff committed Jul 18, 2024
2 parents adc6511 + 081e199 commit 762a998
Show file tree
Hide file tree
Showing 19 changed files with 121 additions and 3,648 deletions.
30 changes: 18 additions & 12 deletions docker/build/installers/VCell.install4j
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
<launcher name="VCell-${compiler:Site}-MacOSX" id="102" icnsFile="${compiler:vcellIcnsFile}">
<executable name="VCell-${compiler:Site}" iconSet="true" failOnStderrOutput="false" executableMode="gui" checkConsoleParameter="true" dpiAware="false" />
<splashScreen show="true" bitmapFile="${compiler:vcell5SplashScreenPngFilePath}" textOverlay="true" />
<java mainClass="cbit.vcell.client.VCellClientMain" vmParameters="&quot;--add-exports java.desktop/sun.awt.image=ALL-UNNAMED -Dvcell.installDir=${launcher:sys.launcherDirectory}&quot;">
<java mainClass="cbit.vcell.client.VCellClientMain" vmParameters="&quot;-Dvcell.installDir=${launcher:sys.launcherDirectory}&quot;">
<classPath>
<variable name="vcellClasspathColonSep" separator=":" useRelativePrefix="true" relativePrefix="lib" />
</classPath>
Expand All @@ -118,7 +118,8 @@
</nativeLibraryDirectories>
</java>
<vmOptionsFile mode="content" overwriteMode="1">
<content>-Dvcell.autoflushlog=true
<content>--add-exports java.desktop/sun.awt.image=ALL-UNNAMED
-Dvcell.autoflushlog=true
-Dvcell.thirdPartyLicense=thirdpartylicenses.txt
-Dvcell.softwareVersion=${compiler:SoftwareVersionString}
-Dvcell.serverHost=${compiler:rmiHosts}
Expand Down Expand Up @@ -147,7 +148,7 @@
<launcher name="VCell-${compiler:Site}-Windows64" id="345" icnsFile="${compiler:vcellIcnsFile}">
<executable name="VCell-${compiler:Site}" iconSet="true" failOnStderrOutput="false" executableMode="gui" checkConsoleParameter="true" dpiAware="false" />
<splashScreen show="true" bitmapFile="${compiler:vcell5SplashScreenPngFilePath}" textOverlay="true" />
<java mainClass="cbit.vcell.client.VCellClientMain" vmParameters="&quot;--add-exports java.desktop/sun.awt.image=ALL-UNNAMED -Dvcell.installDir=${launcher:sys.launcherDirectory}&quot;">
<java mainClass="cbit.vcell.client.VCellClientMain" vmParameters="&quot;-Dvcell.installDir=${launcher:sys.launcherDirectory}&quot;">
<classPath>
<variable name="vcellClasspathColonSep" separator=":" useRelativePrefix="true" relativePrefix="lib" />
</classPath>
Expand All @@ -156,7 +157,8 @@
</nativeLibraryDirectories>
</java>
<vmOptionsFile mode="content" overwriteMode="1">
<content>-Dvcell.autoflushlog=true
<content>--add-exports java.desktop/sun.awt.image=ALL-UNNAMED
-Dvcell.autoflushlog=true
-Dvcell.thirdPartyLicense=thirdpartylicenses.txt
-Dvcell.softwareVersion=${compiler:SoftwareVersionString}
-Dvcell.serverHost=${compiler:rmiHosts}
Expand All @@ -179,7 +181,7 @@
<launcher name="VCell-${compiler:Site}-Windows32" id="447" icnsFile="${compiler:vcellIcnsFile}">
<executable name="VCell-${compiler:Site}" iconSet="true" failOnStderrOutput="false" executableMode="gui" checkConsoleParameter="true" dpiAware="false" />
<splashScreen show="true" bitmapFile="${compiler:vcell5SplashScreenPngFilePath}" textOverlay="true" />
<java mainClass="cbit.vcell.client.VCellClientMain" vmParameters="&quot;--add-exports java.desktop/sun.awt.image=ALL-UNNAMED -Dvcell.installDir=${launcher:sys.launcherDirectory}&quot;">
<java mainClass="cbit.vcell.client.VCellClientMain" vmParameters="&quot;-Dvcell.installDir=${launcher:sys.launcherDirectory}&quot;">
<classPath>
<variable name="vcellClasspathColonSep" separator=":" useRelativePrefix="true" relativePrefix="lib" />
</classPath>
Expand All @@ -188,7 +190,8 @@
</nativeLibraryDirectories>
</java>
<vmOptionsFile mode="content" overwriteMode="1">
<content>-Dvcell.autoflushlog=true
<content>--add-exports java.desktop/sun.awt.image=ALL-UNNAMED
-Dvcell.autoflushlog=true
-Dvcell.thirdPartyLicense=thirdpartylicenses.txt
-Dvcell.softwareVersion=${compiler:SoftwareVersionString}
-Dvcell.serverHost=${compiler:rmiHosts}
Expand All @@ -212,7 +215,7 @@
<launcher name="VCell-${compiler:Site}-Linux32" id="534" icnsFile="${compiler:vcellIcnsFile}">
<executable name="VCell-${compiler:Site}" failOnStderrOutput="false" executableMode="gui" checkConsoleParameter="true" dpiAware="false" />
<splashScreen bitmapFile="${compiler:vcell5SplashScreenPngFilePath}" />
<java mainClass="cbit.vcell.client.VCellClientMain" vmParameters="&quot;--add-exports java.desktop/sun.awt.image=ALL-UNNAMED -Dvcell.installDir=${launcher:sys.launcherDirectory}&quot;">
<java mainClass="cbit.vcell.client.VCellClientMain" vmParameters="&quot;-Dvcell.installDir=${launcher:sys.launcherDirectory}&quot;">
<classPath>
<variable name="vcellClasspathColonSep" separator=":" useRelativePrefix="true" relativePrefix="lib" />
</classPath>
Expand All @@ -221,7 +224,8 @@
</nativeLibraryDirectories>
</java>
<vmOptionsFile mode="content" overwriteMode="1">
<content>-Dvcell.autoflushlog=true
<content>--add-exports java.desktop/sun.awt.image=ALL-UNNAMED
-Dvcell.autoflushlog=true
-Dvcell.thirdPartyLicense=thirdpartylicenses.txt
-Dvcell.softwareVersion=${compiler:SoftwareVersionString}
-Dvcell.serverHost=${compiler:rmiHosts}
Expand All @@ -241,7 +245,7 @@
<launcher name="VCell-${compiler:Site}-Linux64" id="627" icnsFile="${compiler:vcellIcnsFile}">
<executable name="VCell-${compiler:Site}" failOnStderrOutput="false" executableMode="gui" checkConsoleParameter="true" dpiAware="false" />
<splashScreen bitmapFile="${compiler:vcell5SplashScreenPngFilePath}" />
<java mainClass="cbit.vcell.client.VCellClientMain" vmParameters="&quot;--add-exports java.desktop/sun.awt.image=ALL-UNNAMED -Dvcell.installDir=${launcher:sys.launcherDirectory}&quot;">
<java mainClass="cbit.vcell.client.VCellClientMain" vmParameters="&quot;-Dvcell.installDir=${launcher:sys.launcherDirectory}&quot;">
<classPath>
<variable name="vcellClasspathColonSep" separator=":" useRelativePrefix="true" relativePrefix="lib" />
</classPath>
Expand All @@ -250,7 +254,8 @@
</nativeLibraryDirectories>
</java>
<vmOptionsFile mode="content" overwriteMode="1">
<content>-Dvcell.autoflushlog=true
<content>--add-exports java.desktop/sun.awt.image=ALL-UNNAMED
-Dvcell.autoflushlog=true
-Dvcell.thirdPartyLicense=thirdpartylicenses.txt
-Dvcell.serverHost=${compiler:rmiHosts}
-Dvcell.serverPrefix.v0=${compiler:serverPrefixV0}
Expand All @@ -270,7 +275,7 @@
<launcher name="VCell-${compiler:Site}-Linux64-sbmltovcml" id="1880" excludeFromMenu="true">
<executable name="VCell-${compiler:Site}-sbmltovcml" iconSet="true" redirectStderr="false" failOnStderrOutput="false" executableMode="console" checkConsoleParameter="true" dpiAware="false" />
<splashScreen bitmapFile="${compiler:vcell5SplashScreenPngFilePath}" />
<java mainClass="org.vcell.sbml.SbmlVcmlConverter" vmParameters="&quot;--add-exports java.desktop/sun.awt.image=ALL-UNNAMED -Dvcell.installDir=${launcher:sys.launcherDirectory}&quot;">
<java mainClass="org.vcell.sbml.SbmlVcmlConverter" vmParameters="&quot;-Dvcell.installDir=${launcher:sys.launcherDirectory}&quot;">
<classPath>
<variable name="vcellClasspathColonSep" separator=":" useRelativePrefix="true" relativePrefix="lib" />
</classPath>
Expand All @@ -279,7 +284,8 @@
</nativeLibraryDirectories>
</java>
<vmOptionsFile mode="content" overwriteMode="1">
<content>-Dvcell.autoflushlog=true
<content>--add-exports java.desktop/sun.awt.image=ALL-UNNAMED
-Dvcell.autoflushlog=true
-Dvcell.thirdPartyLicense=thirdpartylicenses.txt
-Dvcell.serverHost=${compiler:rmiHosts}
-Dvcell.serverPrefix.v0=${compiler:serverPrefixV0}
Expand Down
7 changes: 0 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,8 @@
<activemq-broker.version>5.18.3</activemq-broker.version>
<activemq-client.version>5.18.3</activemq-client.version>
<axis.version>1.4</axis.version>
<axis-wsdl4j.version>1.2</axis-wsdl4j.version>
<bcprov-jdk15on.version>1.70</bcprov-jdk15on.version>
<bcpkix-jdk15on.version>1.70</bcpkix-jdk15on.version>
<bio-formats.version>6.1.1</bio-formats.version>
<biojava.version>6.0.4</biojava.version>
<biomodels-wslib.version>1.21</biomodels-wslib.version>
<colt.version>1.2.0</colt.version>
<combine-archive.version>1.4.1</combine-archive.version>
<commons-beanutils.version>1.9.4</commons-beanutils.version>
Expand All @@ -121,8 +117,6 @@
<guice.version>7.0.0</guice.version>
<httpclient.version>4.5.11</httpclient.version>
<httpcore.version>4.4.13</httpcore.version>
<imagej2.version>2.3.0</imagej2.version>
<imagej.version>${imagej2.version}</imagej.version>
<itext.version>2.1.7</itext.version>
<quarkus-itext.version>3.0.5</quarkus-itext.version>
<quarkus-logging-json.version>3.1.0</quarkus-logging-json.version>
Expand Down Expand Up @@ -162,7 +156,6 @@
<mongodb-driver-sync.version>5.0.0</mongodb-driver-sync.version>
<n5.version>3.0.0</n5.version>
<netcdf.version>4.3.22</netcdf.version>
<netty.version>3.2.10.Final</netty.version>
<nitrite.version>2.1.1</nitrite.version>
<ojdbc-bom.version>23.3.0.23.09</ojdbc-bom.version>
<opencsv.version>5.7.1</opencsv.version>
Expand Down
10 changes: 5 additions & 5 deletions vcell-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,10 @@
</exclusion>
</exclusions>
</dependency>
<!-- <dependency>-->
<!-- <groupId>joda-time</groupId>-->
<!-- <artifactId>joda-time</artifactId>-->
<!-- <version>${joda-time.version}</version>-->
<!-- </dependency>-->
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>${joda-time.version}</version>
</dependency>
</dependencies>
</project>
12 changes: 7 additions & 5 deletions vcell-api/src/main/java/org/vcell/rest/health/HealthService.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,26 +70,28 @@ public static class NagiosStatus {
int nagiosStatusCode;
String message;
Long elapsedTime_MS;
String tags;

// exit with parsed nagios code (0-OK,1-Warning,2-Critical,3-Unknown)
NagiosStatus(String nagiosStatusName, int nagiosStatusCode, String message, Long elapsedTime_MS){
NagiosStatus(String nagiosStatusName, int nagiosStatusCode, String message, Long elapsedTime_MS, String tags){
this.nagiosStatusName = nagiosStatusName;
this.nagiosStatusCode = nagiosStatusCode;
this.message = message;
this.elapsedTime_MS = elapsedTime_MS;
this.tags = tags;
}

static NagiosStatus OK(Long elapsedTime_MS) {
return new NagiosStatus("OK",0,null,elapsedTime_MS);
return new NagiosStatus("OK",0,null,elapsedTime_MS, "UP");
}
static NagiosStatus Warning(Long elapsedTime_MS) {
return new NagiosStatus("Warning",1,null,elapsedTime_MS);
return new NagiosStatus("Warning",1,null,elapsedTime_MS, "UP WARNING");
}
static NagiosStatus Critical(Long elapsedTime_MS, String message) {
return new NagiosStatus("Critical",2,message,elapsedTime_MS);
return new NagiosStatus("Critical",2,message,elapsedTime_MS, "DOWN");
}
static NagiosStatus Unknown() {
return new NagiosStatus("Unknown",3,null,null);
return new NagiosStatus("Unknown",3,null,null, "WARNING");
}
}

Expand Down
26 changes: 0 additions & 26 deletions vcell-apiclient/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -109,32 +109,6 @@
<artifactId>log4j-1.2-api</artifactId>
<version>${log4j-1.2-api.version}</version>
</dependency>
<dependency>
<groupId>org.bitbucket.b_c</groupId>
<artifactId>jose4j</artifactId>
<version>0.9.3</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>org.vcell</groupId>
<artifactId>vcell-restclient</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
import com.google.gson.Gson;
import com.nimbusds.oauth2.sdk.ParseException;
import org.apache.http.*;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.AuthCache;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpResponseException;
import org.apache.http.client.ResponseHandler;
Expand All @@ -18,15 +15,20 @@
import org.apache.http.entity.ByteArrayEntity;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.auth.BasicScheme;
import org.apache.http.impl.client.*;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.DefaultRedirectStrategy;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.util.TextUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.vcell.api.client.query.BioModelsQuerySpec;
import org.vcell.api.client.query.SimTasksQuerySpec;
import org.vcell.api.common.*;
import org.vcell.api.common.BiomodelRepresentation;
import org.vcell.api.common.SimulationRepresentation;
import org.vcell.api.common.SimulationTaskRepresentation;
import org.vcell.api.common.UserInfo;
import org.vcell.api.common.events.EventWrapper;
import org.vcell.restclient.ApiClient;
import org.vcell.restclient.ApiException;
Expand Down
18 changes: 0 additions & 18 deletions vcell-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -150,24 +150,6 @@
<artifactId>picocli</artifactId>
<version>${picocli.version}</version>
</dependency>

<dependency>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
<version>${xalan.version}</version>
</dependency>

<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>${jetty.version}</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20220924</version>
</dependency>

</dependencies>
<profiles>
<profile>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package cbit.vcell.client.desktop.biomodel.annotations;

import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
Expand All @@ -8,7 +13,6 @@
import java.util.ArrayList;
import java.util.List;

import org.json.*;

public class UniProtSearch {

Expand Down Expand Up @@ -44,42 +48,50 @@ public List<SearchElement> search(String searchTerm, int searchSize, String orga

System.out.println(response);
System.out.println("Parsing JSON\n");
JSONObject obj = new JSONObject(response);
// String accession = obj.getJSONObject("pageInfo").getString("pageName");
JSONArray results = obj.getJSONArray("results"); // notice that `"posts": [...]`
for (int i = 0; i < results.length(); i++) {
JSONObject result = results.getJSONObject(i);
String accession = result.getString("primaryAccession");
searchElements.addAll(parseResponse(response));

// System.out.println("\nSearch Elements:");
// for (SearchElement element: searchElements) {
// System.out.println(element.toString()+"\n");
// }

// System.out.println("Status Code: " + response.statusCode());
// System.out.println("Response Body:\n" + response.body());
return searchElements;
}


private static List<SearchElement> parseResponse(String response) {
List<SearchElement> searchElements = new ArrayList<>();
JsonElement jelement = JsonParser.parseString(response);
JsonObject jobject = jelement.getAsJsonObject();
JsonArray results = jobject.getAsJsonArray("results");

for (JsonElement resultElement : results) {
JsonObject result = resultElement.getAsJsonObject();
String accession = result.get("primaryAccession").getAsString();

System.out.println("Accession: " + accession);
String name;
if (result.toString().contains("submissionNames")) {
name = result
.getJSONObject("proteinDescription")
.getJSONArray("submissionNames")
.getJSONObject(0)
.getJSONObject("fullName")
.getString("value");
.getAsJsonObject("proteinDescription")
.getAsJsonArray("submissionNames")
.get(0).getAsJsonObject()
.getAsJsonObject("fullName")
.get("value").getAsString();
} else {
name = results.getJSONObject(i)
.getJSONObject("proteinDescription")
.getJSONObject("recommendedName")
.getJSONObject("fullName")
.getString("value");
name = result
.getAsJsonObject("proteinDescription")
.getAsJsonObject("recommendedName")
.getAsJsonObject("fullName")
.get("value").getAsString();
}
System.out.println("Name: " + name+"\n");
System.out.println("Name: " + name + "\n");

//Add searchElements to list
// Add searchElements to list
searchElements.add(new SearchElement(name, accession));
}

// System.out.println("\nSearch Elements:");
// for (SearchElement element: searchElements) {
// System.out.println(element.toString()+"\n");
// }

// System.out.println("Status Code: " + response.statusCode());
// System.out.println("Response Body:\n" + response.body());
return searchElements;
}

Expand Down
Loading

0 comments on commit 762a998

Please sign in to comment.