diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..056ff984756c00995a56a88e59915e7fe5c7853c --- /dev/null +++ b/README.md @@ -0,0 +1,19 @@ +# Building openBIS + +## Requirements +JDK8 + +## Step By Step: +``` +git clone https://sissource.ethz.ch/sispub/openbis.git +cd installation/ +./gradlew clean +./gradlew build -x test +``` +## Where the build is found? +``` +./installation/targets/gradle/distributions/openBIS-installation-standard-technologies-SNAPSHOT-rXXXXXXXXXX.tar.gz +``` + +## Why we disable tests to make the build? +They slowdown the time to obtain a build plus some tests could have additional environment requirements. \ No newline at end of file diff --git a/openbis_benchmark/conf/config.json b/openbis_benchmark/conf/config.json index dbaa6b6fcb0a33b7eaa6e1889a75397ed988401b..69b16fd12d65f81d7966b4953ead0461e7d0c628 100644 --- a/openbis_benchmark/conf/config.json +++ b/openbis_benchmark/conf/config.json @@ -6,9 +6,10 @@ "openbisTimeout" : "3600000", "datastoreURL" : "https://openbis-polyhub.ethz.ch/datastore_server/rmi-data-store-server-v3", "datastoreTimeout" : "3600000", + "threads" : 2, "parameters" : { - "SPACES_TO_CREATE" : 5, - "SAMPLES_TO_CREATE" : 50000 + "SPACES_TO_CREATE" : 1, + "SAMPLES_TO_CREATE" : 5000 } }, { "className" : "ch.ethz.sis.benchmark.impl.GlobalSearchBenchmark", @@ -18,9 +19,9 @@ "openbisTimeout" : "3600000", "datastoreURL" : "https://openbis-polyhub.ethz.ch/datastore_server/rmi-data-store-server-v3", "datastoreTimeout" : "3600000", + "threads" : 10, "parameters" : { - "ITERATIONS" : 10, - "THREADS" : 10 + "ITERATIONS" : 10 } }, { "className" : "ch.ethz.sis.benchmark.impl.ListBenchmark", @@ -30,152 +31,8 @@ "openbisTimeout" : "3600000", "datastoreURL" : "https://openbis-polyhub.ethz.ch/datastore_server/rmi-data-store-server-v3", "datastoreTimeout" : "3600000", + "threads" : 10, "parameters" : { - "ITERATIONS" : 10, - "THREADS" : 10 - } -}, { - "className" : "ch.ethz.sis.benchmark.impl.LoadBenchmark", - "user" : "test", - "password" : "test", - "openbisURL" : "https://openbis-polyhub.ethz.ch/openbis/openbis/rmi-application-server-v3", - "openbisTimeout" : "3600000", - "datastoreURL" : "https://openbis-polyhub.ethz.ch/datastore_server/rmi-data-store-server-v3", - "datastoreTimeout" : "3600000", - "parameters" : { - "SPACES_TO_CREATE" : 50, - "SAMPLES_TO_CREATE" : 50000 - } -}, { - "className" : "ch.ethz.sis.benchmark.impl.GlobalSearchBenchmark", - "user" : "test", - "password" : "test", - "openbisURL" : "https://openbis-polyhub.ethz.ch/openbis/openbis/rmi-application-server-v3", - "openbisTimeout" : "3600000", - "datastoreURL" : "https://openbis-polyhub.ethz.ch/datastore_server/rmi-data-store-server-v3", - "datastoreTimeout" : "3600000", - "parameters" : { - "ITERATIONS" : 10, - "THREADS" : 10 - } -}, { - "className" : "ch.ethz.sis.benchmark.impl.ListBenchmark", - "user" : "test", - "password" : "test", - "openbisURL" : "https://openbis-polyhub.ethz.ch/openbis/openbis/rmi-application-server-v3", - "openbisTimeout" : "3600000", - "datastoreURL" : "https://openbis-polyhub.ethz.ch/datastore_server/rmi-data-store-server-v3", - "datastoreTimeout" : "3600000", - "parameters" : { - "ITERATIONS" : 10, - "THREADS" : 10 - } -}, { - "className" : "ch.ethz.sis.benchmark.impl.LoadBenchmark", - "user" : "test", - "password" : "test", - "openbisURL" : "https://openbis-polyhub.ethz.ch/openbis/openbis/rmi-application-server-v3", - "openbisTimeout" : "3600000", - "datastoreURL" : "https://openbis-polyhub.ethz.ch/datastore_server/rmi-data-store-server-v3", - "datastoreTimeout" : "3600000", - "parameters" : { - "SPACES_TO_CREATE" : 500, - "SAMPLES_TO_CREATE" : 50000 - } -}, { - "className" : "ch.ethz.sis.benchmark.impl.GlobalSearchBenchmark", - "user" : "test", - "password" : "test", - "openbisURL" : "https://openbis-polyhub.ethz.ch/openbis/openbis/rmi-application-server-v3", - "openbisTimeout" : "3600000", - "datastoreURL" : "https://openbis-polyhub.ethz.ch/datastore_server/rmi-data-store-server-v3", - "datastoreTimeout" : "3600000", - "parameters" : { - "ITERATIONS" : 10, - "THREADS" : 10 - } -}, { - "className" : "ch.ethz.sis.benchmark.impl.ListBenchmark", - "user" : "test", - "password" : "test", - "openbisURL" : "https://openbis-polyhub.ethz.ch/openbis/openbis/rmi-application-server-v3", - "openbisTimeout" : "3600000", - "datastoreURL" : "https://openbis-polyhub.ethz.ch/datastore_server/rmi-data-store-server-v3", - "datastoreTimeout" : "3600000", - "parameters" : { - "ITERATIONS" : 10, - "THREADS" : 10 - } -}, { - "className" : "ch.ethz.sis.benchmark.impl.LoadBenchmark", - "user" : "test", - "password" : "test", - "openbisURL" : "https://openbis-polyhub.ethz.ch/openbis/openbis/rmi-application-server-v3", - "openbisTimeout" : "3600000", - "datastoreURL" : "https://openbis-polyhub.ethz.ch/datastore_server/rmi-data-store-server-v3", - "datastoreTimeout" : "3600000", - "parameters" : { - "SPACES_TO_CREATE" : 5000, - "SAMPLES_TO_CREATE" : 50000 - } -}, { - "className" : "ch.ethz.sis.benchmark.impl.GlobalSearchBenchmark", - "user" : "test", - "password" : "test", - "openbisURL" : "https://openbis-polyhub.ethz.ch/openbis/openbis/rmi-application-server-v3", - "openbisTimeout" : "3600000", - "datastoreURL" : "https://openbis-polyhub.ethz.ch/datastore_server/rmi-data-store-server-v3", - "datastoreTimeout" : "3600000", - "parameters" : { - "ITERATIONS" : 10, - "THREADS" : 10 - } -}, { - "className" : "ch.ethz.sis.benchmark.impl.ListBenchmark", - "user" : "test", - "password" : "test", - "openbisURL" : "https://openbis-polyhub.ethz.ch/openbis/openbis/rmi-application-server-v3", - "openbisTimeout" : "3600000", - "datastoreURL" : "https://openbis-polyhub.ethz.ch/datastore_server/rmi-data-store-server-v3", - "datastoreTimeout" : "3600000", - "parameters" : { - "ITERATIONS" : 10, - "THREADS" : 10 - } -}, { - "className" : "ch.ethz.sis.benchmark.impl.LoadBenchmark", - "user" : "test", - "password" : "test", - "openbisURL" : "https://openbis-polyhub.ethz.ch/openbis/openbis/rmi-application-server-v3", - "openbisTimeout" : "3600000", - "datastoreURL" : "https://openbis-polyhub.ethz.ch/datastore_server/rmi-data-store-server-v3", - "datastoreTimeout" : "3600000", - "parameters" : { - "SPACES_TO_CREATE" : 500, - "SAMPLES_TO_CREATE" : 500000 - } -}, { - "className" : "ch.ethz.sis.benchmark.impl.GlobalSearchBenchmark", - "user" : "test", - "password" : "test", - "openbisURL" : "https://openbis-polyhub.ethz.ch/openbis/openbis/rmi-application-server-v3", - "openbisTimeout" : "3600000", - "datastoreURL" : "https://openbis-polyhub.ethz.ch/datastore_server/rmi-data-store-server-v3", - "datastoreTimeout" : "3600000", - "parameters" : { - "ITERATIONS" : 10, - "THREADS" : 10 - } -}, { - "className" : "ch.ethz.sis.benchmark.impl.ListBenchmark", - "user" : "test", - "password" : "test", - "openbisURL" : "https://openbis-polyhub.ethz.ch/openbis/openbis/rmi-application-server-v3", - "openbisTimeout" : "3600000", - "datastoreURL" : "https://openbis-polyhub.ethz.ch/datastore_server/rmi-data-store-server-v3", - "datastoreTimeout" : "3600000", - "parameters" : { - "ITERATIONS" : 10, - "THREADS" : 10 + "ITERATIONS" : 10 } }] \ No newline at end of file diff --git a/openbis_benchmark/src/main/java/ch/ethz/sis/benchmark/Benchmark.java b/openbis_benchmark/src/main/java/ch/ethz/sis/benchmark/Benchmark.java index ace60e48c7a257a3e744fd56230d7376e2abb04c..cf23b4bb5d6e9e9ccb1cac8f7fc663de2d994b66 100644 --- a/openbis_benchmark/src/main/java/ch/ethz/sis/benchmark/Benchmark.java +++ b/openbis_benchmark/src/main/java/ch/ethz/sis/benchmark/Benchmark.java @@ -2,12 +2,16 @@ package ch.ethz.sis.benchmark; import ch.ethz.sis.logging.LogManager; import ch.ethz.sis.logging.Logger; +import ch.ethz.sis.openbis.generic.asapi.v3.IApplicationServerApi; import ch.ethz.sis.ssl.SslCertificateHelper; +import ch.systemsx.cisd.common.spring.HttpInvokerUtils; public abstract class Benchmark { protected BenchmarkConfig configuration; protected Logger logger; + protected IApplicationServerApi v3; + protected String sessionToken; public void start() { logger = LogManager.getLogger(this.getClass()); @@ -22,8 +26,23 @@ public abstract class Benchmark long end = System.currentTimeMillis(); logger.info("Benchmark took: " + (end-start) + " millis"); } + public abstract void startInternal() throws Exception; + public IApplicationServerApi login() { + if(v3 == null) { + v3 = HttpInvokerUtils.createServiceStub(IApplicationServerApi.class, getConfiguration().getOpenbisURL(), getConfiguration().getOpenbisTimeout()); + sessionToken = v3.login(getConfiguration().getUser(), getConfiguration().getPassword()); + } + return v3; + } + + public void logout() { + v3.logout(sessionToken); + v3 = null; + sessionToken = null; + } + public BenchmarkConfig getConfiguration() { return configuration; diff --git a/openbis_benchmark/src/main/java/ch/ethz/sis/benchmark/BenchmarkConfig.java b/openbis_benchmark/src/main/java/ch/ethz/sis/benchmark/BenchmarkConfig.java index b7f37fe7fbf093271ea674970a95660e5f2eda05..32b590a5bb036ffff907f3cdeb11015e1b25e74d 100644 --- a/openbis_benchmark/src/main/java/ch/ethz/sis/benchmark/BenchmarkConfig.java +++ b/openbis_benchmark/src/main/java/ch/ethz/sis/benchmark/BenchmarkConfig.java @@ -19,4 +19,5 @@ public class BenchmarkConfig private String datastoreURL; private int datastoreTimeout; private HashMap<String, String> parameters; + private int threads; } diff --git a/openbis_benchmark/src/main/java/ch/ethz/sis/benchmark/impl/GlobalSearchBenchmark.java b/openbis_benchmark/src/main/java/ch/ethz/sis/benchmark/impl/GlobalSearchBenchmark.java index a374947c7da3bbe9de49796cab847810cc04fdf0..2fc9152b5cb5e035a945ac04d3778c81e951261a 100644 --- a/openbis_benchmark/src/main/java/ch/ethz/sis/benchmark/impl/GlobalSearchBenchmark.java +++ b/openbis_benchmark/src/main/java/ch/ethz/sis/benchmark/impl/GlobalSearchBenchmark.java @@ -1,11 +1,7 @@ package ch.ethz.sis.benchmark.impl; -import java.util.ArrayList; -import java.util.List; - import ch.ethz.sis.benchmark.Benchmark; import ch.ethz.sis.benchmark.util.RandomWord; -import ch.ethz.sis.openbis.generic.asapi.v3.IApplicationServerApi; import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.search.SearchResult; import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.fetchoptions.DataSetFetchOptions; import ch.ethz.sis.openbis.generic.asapi.v3.dto.experiment.fetchoptions.ExperimentFetchOptions; @@ -13,7 +9,6 @@ import ch.ethz.sis.openbis.generic.asapi.v3.dto.global.GlobalSearchObject; import ch.ethz.sis.openbis.generic.asapi.v3.dto.global.fetchoptions.GlobalSearchObjectFetchOptions; import ch.ethz.sis.openbis.generic.asapi.v3.dto.global.search.GlobalSearchCriteria; import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.fetchoptions.SampleFetchOptions; -import ch.systemsx.cisd.common.spring.HttpInvokerUtils; public class GlobalSearchBenchmark extends Benchmark { @@ -21,62 +16,48 @@ public class GlobalSearchBenchmark extends Benchmark { @Override public void startInternal() throws Exception { - long start = System.currentTimeMillis(); - IApplicationServerApi v3 = HttpInvokerUtils.createServiceStub(IApplicationServerApi.class, getConfiguration().getOpenbisURL(), getConfiguration().getOpenbisTimeout()); - String sessionToken = v3.login(getConfiguration().getUser(), getConfiguration().getPassword()); - int iterations = Integer.parseInt(this.getConfiguration().getParameters().get(Parameters.ITERATIONS.name())); - int threads = Integer.parseInt(this.getConfiguration().getParameters().get(Parameters.THREADS.name())); - - List<Thread> threadsToJoin = new ArrayList<>(); - for(int t = 0; t < threads; t++) { - Thread thread = new Thread() { - public void run() { - for(int i = 0; i < iterations; i++) { - String word = RandomWord.getRandomWord(); - GlobalSearchCriteria criteria = new GlobalSearchCriteria(); - criteria.withText().thatContains(word); - - GlobalSearchObjectFetchOptions options = new GlobalSearchObjectFetchOptions(); - options.from(0); - options.count(25); - - SampleFetchOptions sampleFetchOptions = options.withSample(); - sampleFetchOptions.withSpace(); - sampleFetchOptions.withType(); - sampleFetchOptions.withRegistrator(); - sampleFetchOptions.withModifier(); - sampleFetchOptions.withExperiment(); - sampleFetchOptions.withProperties(); - - ExperimentFetchOptions experimentFetchOptions = options.withExperiment(); - experimentFetchOptions.withType(); - experimentFetchOptions.withRegistrator(); - experimentFetchOptions.withModifier(); - experimentFetchOptions.withProperties(); - - DataSetFetchOptions dataSetFetchOptions = options.withDataSet(); - dataSetFetchOptions.withType(); - dataSetFetchOptions.withRegistrator(); - dataSetFetchOptions.withModifier(); - dataSetFetchOptions.withProperties(); - - long start = System.currentTimeMillis(); - SearchResult<GlobalSearchObject> objects = v3.searchGlobally(sessionToken, criteria, options); - long end = System.currentTimeMillis(); - logger.info("Found " + objects.getTotalCount() + " objects containting '" + word+ "' in " + (end-start) + " millis."); - } - } - }; - threadsToJoin.add(thread); - thread.start(); + long laps = 0; + for(int i = 0; i < iterations; i++) { + String word = RandomWord.getRandomWord(); + GlobalSearchCriteria criteria = new GlobalSearchCriteria(); + criteria.withText().thatContains(word); + + GlobalSearchObjectFetchOptions options = new GlobalSearchObjectFetchOptions(); + options.from(0); + options.count(25); + + SampleFetchOptions sampleFetchOptions = options.withSample(); + sampleFetchOptions.withSpace(); + sampleFetchOptions.withType(); + sampleFetchOptions.withRegistrator(); + sampleFetchOptions.withModifier(); + sampleFetchOptions.withExperiment(); + sampleFetchOptions.withProperties(); + + ExperimentFetchOptions experimentFetchOptions = options.withExperiment(); + experimentFetchOptions.withType(); + experimentFetchOptions.withRegistrator(); + experimentFetchOptions.withModifier(); + experimentFetchOptions.withProperties(); + + DataSetFetchOptions dataSetFetchOptions = options.withDataSet(); + dataSetFetchOptions.withType(); + dataSetFetchOptions.withRegistrator(); + dataSetFetchOptions.withModifier(); + dataSetFetchOptions.withProperties(); + + login(); + long start = System.currentTimeMillis(); + SearchResult<GlobalSearchObject> objects = v3.searchGlobally(sessionToken, criteria, options); + long end = System.currentTimeMillis(); + long lap = end - start; + laps += lap; + logout(); + logger.info("Found " + objects.getTotalCount() + " objects containting '" + word+ "' in " + lap + " millis."); } - for(Thread thread:threadsToJoin) { - thread.join(); - } - long end = System.currentTimeMillis(); - logger.info("Done " + (iterations * threads) + " objects searches in " + (end-start) + " millis, " + ((end-start)/(iterations * threads)) + " millis/search"); + logger.info("Done " + iterations + " global searches in " + laps + " millis, " + (laps/iterations) + " millis/search avg"); } } diff --git a/openbis_benchmark/src/main/java/ch/ethz/sis/benchmark/impl/ListBenchmark.java b/openbis_benchmark/src/main/java/ch/ethz/sis/benchmark/impl/ListBenchmark.java index 73ba11b03a2c585f640a80712195c454b13552af..2f8ef38846ed4c6130f783c01adc892da08ae0a8 100644 --- a/openbis_benchmark/src/main/java/ch/ethz/sis/benchmark/impl/ListBenchmark.java +++ b/openbis_benchmark/src/main/java/ch/ethz/sis/benchmark/impl/ListBenchmark.java @@ -1,11 +1,10 @@ package ch.ethz.sis.benchmark.impl; -import java.util.ArrayList; +import java.util.Collections; import java.util.List; import ch.ethz.sis.benchmark.Benchmark; import ch.ethz.sis.benchmark.util.RandomValueGenerator; -import ch.ethz.sis.openbis.generic.asapi.v3.IApplicationServerApi; import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.search.SearchResult; import ch.ethz.sis.openbis.generic.asapi.v3.dto.experiment.Experiment; import ch.ethz.sis.openbis.generic.asapi.v3.dto.experiment.fetchoptions.ExperimentFetchOptions; @@ -16,7 +15,6 @@ import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.search.SampleSearchCriter import ch.ethz.sis.openbis.generic.asapi.v3.dto.space.Space; import ch.ethz.sis.openbis.generic.asapi.v3.dto.space.fetchoptions.SpaceFetchOptions; import ch.ethz.sis.openbis.generic.asapi.v3.dto.space.search.SpaceSearchCriteria; -import ch.systemsx.cisd.common.spring.HttpInvokerUtils; public class ListBenchmark extends Benchmark { @@ -24,67 +22,57 @@ public class ListBenchmark extends Benchmark { @Override public void startInternal() throws Exception { - long start1 = System.currentTimeMillis(); - IApplicationServerApi v3 = HttpInvokerUtils.createServiceStub(IApplicationServerApi.class, getConfiguration().getOpenbisURL(), getConfiguration().getOpenbisTimeout()); - String sessionToken = v3.login(getConfiguration().getUser(), getConfiguration().getPassword()); - + login(); int iterations = Integer.parseInt(this.getConfiguration().getParameters().get(Parameters.ITERATIONS.name())); - int threads = Integer.parseInt(this.getConfiguration().getParameters().get(Parameters.THREADS.name())); - - long start2 = System.currentTimeMillis(); + long start = System.currentTimeMillis(); List<Space> spaces = v3.searchSpaces(sessionToken, new SpaceSearchCriteria(), new SpaceFetchOptions()).getObjects(); - long end2 = System.currentTimeMillis(); - logger.info("Found " + spaces.size() + " spaces in " + (end2-start2) + " millis."); + long end = System.currentTimeMillis(); + logger.info("Found " + spaces.size() + " spaces in " + (end-start) + " millis."); final RandomValueGenerator<Space> random = new RandomValueGenerator<>(); random.addAll(spaces); + logout(); - List<Thread> threadsToJoin = new ArrayList<>(); - for(int t = 0; t < threads; t++) { - Thread thread = new Thread() { - public void run() { - for(int i = 0; i < iterations; i++) { - Space space = random.getRandom(); - - ExperimentSearchCriteria experimentSearchCriteria = new ExperimentSearchCriteria(); - experimentSearchCriteria.withProject().withSpace().withCode().thatEquals(space.getCode()); - - ExperimentFetchOptions experimentFetchOptions = new ExperimentFetchOptions(); - - long start1 = System.currentTimeMillis(); - Experiment experiment = v3.searchExperiments(sessionToken, experimentSearchCriteria, experimentFetchOptions).getObjects().get(0); - long end1 = System.currentTimeMillis(); - logger.info("Found experiment '" + experiment.getPermId().getPermId()+ "' from space " + space.getCode() + " in " + (end1-start1) + " millis."); - - SampleSearchCriteria criteria = new SampleSearchCriteria(); - criteria.withExperiment().withPermId().thatEquals(experiment.getPermId().getPermId()); - - SampleFetchOptions options = new SampleFetchOptions(); - options.from(0); - options.count(25); - options.withType(); - options.withSpace(); - options.withRegistrator(); - options.withModifier(); - options.withProperties(); - options.withParents(); - options.withChildren(); - - long start2 = System.currentTimeMillis(); - SearchResult<Sample> samples = v3.searchSamples(sessionToken, criteria, options); - long end2 = System.currentTimeMillis(); - logger.info("Found " + samples.getTotalCount() + " objects in experiment '" + experiment.getPermId().getPermId()+ "' from space " + space.getCode() + " in " + (end2-start2) + " millis."); - } - } - }; - threadsToJoin.add(thread); - thread.start(); - } - - for(Thread thread:threadsToJoin) { - thread.join(); + long laps = 0; + for(int i = 0; i < iterations; i++) { + login(); + + List<Experiment> experiments = Collections.emptyList(); + Space space = null; + long lapStart1 = System.currentTimeMillis(); + while(experiments.isEmpty()) { + space = random.getRandom(); + ExperimentSearchCriteria experimentSearchCriteria = new ExperimentSearchCriteria(); + experimentSearchCriteria.withProject().withSpace().withCode().thatEquals(space.getCode()); + ExperimentFetchOptions experimentFetchOptions = new ExperimentFetchOptions(); + experiments = v3.searchExperiments(sessionToken, experimentSearchCriteria, experimentFetchOptions).getObjects(); + } + long lapEnd1 = System.currentTimeMillis(); + Experiment experiment = experiments.get(0); + logger.info("Found experiment '" + experiment.getPermId().getPermId()+ "' from space " + space.getCode() + " in " + (lapEnd1-lapStart1) + " millis."); + + SampleSearchCriteria criteria = new SampleSearchCriteria(); + criteria.withExperiment().withPermId().thatEquals(experiment.getPermId().getPermId()); + + SampleFetchOptions options = new SampleFetchOptions(); + options.from(0); + options.count(25); + options.withType(); + options.withSpace(); + options.withRegistrator(); + options.withModifier(); + options.withProperties(); + options.withParents(); + options.withChildren(); + + long lapStart2 = System.currentTimeMillis(); + SearchResult<Sample> samples = v3.searchSamples(sessionToken, criteria, options); + long lapEnd2 = System.currentTimeMillis(); + long lap = lapEnd2 - lapStart2; + laps += lap; + logger.info("Found " + samples.getTotalCount() + " objects in experiment '" + experiment.getPermId().getPermId()+ "' from space " + space.getCode() + " in " + lap + " millis."); + logout(); } - long end1 = System.currentTimeMillis(); - logger.info("Done " + (iterations * threads) + " sample searches in " + (end1-start1) + " millis, " + ((end1-start1)/(iterations * threads)) + " millis/search"); + logger.info("Done " + (iterations) + " experiment object lists in " + laps + " millis, " + ((laps)/(iterations)) + " millis/search avg"); } } diff --git a/openbis_benchmark/src/main/java/ch/ethz/sis/benchmark/impl/LoadBenchmark.java b/openbis_benchmark/src/main/java/ch/ethz/sis/benchmark/impl/LoadBenchmark.java index 5582ea27b0b447e9553278f3b84b17509f7b3a79..32acb8df0ce42dc4c245de1f928b3c0a4d5e9cdb 100644 --- a/openbis_benchmark/src/main/java/ch/ethz/sis/benchmark/impl/LoadBenchmark.java +++ b/openbis_benchmark/src/main/java/ch/ethz/sis/benchmark/impl/LoadBenchmark.java @@ -9,7 +9,6 @@ import java.util.Set; import ch.ethz.sis.benchmark.Benchmark; import ch.ethz.sis.benchmark.util.RandomValueGenerator; import ch.ethz.sis.benchmark.util.RandomWord; -import ch.ethz.sis.openbis.generic.asapi.v3.IApplicationServerApi; import ch.ethz.sis.openbis.generic.asapi.v3.dto.entitytype.id.EntityTypePermId; import ch.ethz.sis.openbis.generic.asapi.v3.dto.experiment.create.ExperimentCreation; import ch.ethz.sis.openbis.generic.asapi.v3.dto.experiment.create.ExperimentTypeCreation; @@ -27,7 +26,6 @@ import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.DataType; import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.create.PropertyAssignmentCreation; import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.create.PropertyTypeCreation; import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.id.PropertyTypePermId; -import ch.systemsx.cisd.common.spring.HttpInvokerUtils; public class LoadBenchmark extends Benchmark { @@ -36,8 +34,7 @@ public class LoadBenchmark extends Benchmark { @Override public void startInternal() throws Exception { - IApplicationServerApi v3 = HttpInvokerUtils.createServiceStub(IApplicationServerApi.class, getConfiguration().getOpenbisURL(), getConfiguration().getOpenbisTimeout()); - String sessionToken = v3.login(getConfiguration().getUser(), getConfiguration().getPassword()); + login(); String propertyTypeCode1 = "BENCHMARK_STRING_1"; String propertyTypeCode2 = "BENCHMARK_STRING_2"; @@ -157,6 +154,7 @@ public class LoadBenchmark extends Benchmark { long end3 = System.currentTimeMillis(); logger.info("Create " + spacesToCreate + " Collections took: " + (end3-start3) + " millis - " + ((end3-start3)/spacesToCreate) + " millis/collection"); + logout(); // // Part 4 - Creating Samples // @@ -181,10 +179,12 @@ public class LoadBenchmark extends Benchmark { sampleCreation.setSpaceId(new SpacePermId(Prefix.SPACE_ + code)); // Spaces are distributed randomly sampleCreation.setExperimentId(new ExperimentIdentifier("/" + Prefix.SPACE_ + code + "/" + Prefix.PROJECT_ + code + "/" + Prefix.COLLECTION_ + code)); sampleCreations.add(sampleCreation); - if(i % sampleBatchSize == 0) { // Every 5000, send to openBIS + if((i+1) % sampleBatchSize == 0) { // Every 5000, send to openBIS + login(); long lapStart4 = System.currentTimeMillis(); v3.createSamples(sessionToken, sampleCreations); long lapEnd4 = System.currentTimeMillis(); + logout(); logger.info("Create " + sampleCreations.size() + " Samples took: " + (lapEnd4 - lapStart4) + " millis - " + ((lapEnd4-lapStart4)/sampleCreations.size()) + " millis/sample"); sampleCreations.clear(); } diff --git a/openbis_benchmark/src/main/java/ch/ethz/sis/startup/Main.java b/openbis_benchmark/src/main/java/ch/ethz/sis/startup/Main.java index cdfe2279f14a4b3c7e0d6deddd3b85816a4e7d04..45f4b314683ace0243e69dd7c100469fba1e9073 100644 --- a/openbis_benchmark/src/main/java/ch/ethz/sis/startup/Main.java +++ b/openbis_benchmark/src/main/java/ch/ethz/sis/startup/Main.java @@ -2,6 +2,9 @@ package ch.ethz.sis.startup; import java.io.File; import java.io.FileInputStream; +import java.util.ArrayList; +import java.util.List; + import ch.ethz.sis.benchmark.Benchmark; import ch.ethz.sis.benchmark.BenchmarkConfig; import ch.ethz.sis.json.jackson.JacksonObjectMapper; @@ -42,9 +45,36 @@ public class Main BenchmarkConfig[] benchmarkConfigs = JacksonObjectMapper.getInstance().readValue(new FileInputStream(configFile), BenchmarkConfig[].class); for(BenchmarkConfig benchmarkConfig:benchmarkConfigs) { - Benchmark benchmark = (Benchmark) Class.forName(benchmarkConfig.getClassName()).newInstance(); - benchmark.setConfiguration(benchmarkConfig); - benchmark.start(); + List<BenchmarkThread> threadsToJoin = new ArrayList<>(); + for(int t = 0; t < benchmarkConfig.getThreads(); t++) { + BenchmarkThread thread = new BenchmarkThread(benchmarkConfig) { + public void run() { + Benchmark benchmark = null; + try { + benchmark = (Benchmark) Class.forName(benchmarkConfig.getClassName()).newInstance(); + } catch (Exception e) { + e.printStackTrace(); + } + benchmark.setConfiguration(benchmarkConfig); + benchmark.start(); + } + }; + threadsToJoin.add(thread); + thread.start(); + } + + for(BenchmarkThread thread:threadsToJoin) { + thread.join(); + } } } + + static private abstract class BenchmarkThread extends Thread { + private final BenchmarkConfig benchmarkConfig; + + public BenchmarkThread(BenchmarkConfig benchmarkConfig) { + super(); + this.benchmarkConfig = benchmarkConfig; + } + } } diff --git a/openbis_standard_technologies/build.gradle b/openbis_standard_technologies/build.gradle index d0ba4842f03ed959fb24fc80ff4e78bc9207cf16..259f97a04f4770f66d1795c6320598f98d43b0de 100644 --- a/openbis_standard_technologies/build.gradle +++ b/openbis_standard_technologies/build.gradle @@ -1,3 +1,27 @@ +buildscript { + apply from: '../gradle/repository.gradle' + + repositories repositoryConfig + + dependencies { + classpath 'apache:commons-codec:+', + 'owasp:dependency-check-gradle:+' + } +} + +apply plugin: org.owasp.dependencycheck.gradle.DependencyCheckPlugin + +dependencyCheck { + failBuildOnCVSS = 7 // 0 - 4 = low, 4 - 7 = medium, 7 - 9 = high, 9-10 = critical + analyzers{ + assemblyEnabled = false + } + proxy { + server = 'proxy.ethz.ch' + port = 3128 + } +} + evaluationDependsOn(':commonbase') evaluationDependsOn(':common') evaluationDependsOn(':openbis_api') @@ -12,6 +36,7 @@ evaluationDependsOn(':rtd_yeastx') evaluationDependsOn(':deep_sequencing_unit') evaluationDependsOn(':plasmid') + apply from: '../gradle/javaproject.gradle' apply from: 'query-api.gradle' apply from: 'screening-api.gradle' @@ -80,16 +105,6 @@ dependencies { project(path:':screening') } -buildscript { - apply from: '../gradle/repository.gradle' - - repositories repositoryConfig - - dependencies { - classpath 'apache:commons-codec:+' - } -} - task compileGwt (dependsOn: classes, type: JavaExec) { ext.buildDir = "${project.buildDir}/gwt" @@ -431,4 +446,4 @@ build.dependsOn zipDss build.dependsOn clientsAndApis build.dependsOn dssUploadGuiStandaloneZip build.dependsOn dssUploadGuiStandaloneJar -build.dependsOn generateJavadoc \ No newline at end of file +build.dependsOn generateJavadoc diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/ELNDictionary.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/ELNDictionary.js index d9431aae0189e7706e45c89e135ede80b1ac97dd..504ac9540998433362983aa6c261cf98cd0b582d 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/ELNDictionary.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/ELNDictionary.js @@ -50,11 +50,11 @@ ELNDictionary.settingsView = { }, dataSetTypeForFileName : { title : "Dataset types for filenames", - info : "When listing a combination of file extension / " + ELNDictionary.Sample + " Type on this section the Dataset uploader will select a Dataset Type by default. This decision can be overridden by users afterwards but provides a nice default to avoid mistakes.", + info : "When listing a combination of file extension / Dataset Type on this section the Dataset uploader will select a Dataset Type by default. This decision can be overridden by users afterwards but provides a nice default to avoid mistakes.", }, sampleTypeDefinitionsExtension : { title : ELNDictionary.Sample +" Type definitions Extension", - info : "This section is used to extend the common openBIS definitions to: 1. Enable the storage. 2. Specify if the object type is a protocol. 3. Add intended parent/children hints. 4. Support annotations for these links using properties. 5. Show in dropdowns.", + info : "This section is used to extend the common openBIS definitions to: 1. Enable the storage. 2. Specify if the " + ELNDictionary.sample + " type is a protocol. 3. Add intended parent/children hints. 4. Support annotations for these links using properties. 5. Show in dropdowns.", }, } } diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataGrid/SampleDataGridUtil.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataGrid/SampleDataGridUtil.js index b8c0bf524d96e6f3b8f236010081622396fea61d..92bfae40a748a260d468ac531fc96fb3431d6705 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataGrid/SampleDataGridUtil.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataGrid/SampleDataGridUtil.js @@ -48,7 +48,38 @@ var SampleDataGridUtil = new function() { label : 'Code', property : 'code', isExportable: false, - sortable : true + sortable : true, + render : function(data, grid) { + var paginationInfo = null; + if(isDynamic) { + var indexFound = null; + for(var idx = 0; idx < grid.lastReceivedData.objects.length; idx++) { + if(grid.lastReceivedData.objects[idx].permId === data.permId) { + indexFound = idx + (grid.lastUsedOptions.pageIndex * grid.lastUsedOptions.pageSize); + break; + } + } + + if(indexFound !== null) { + paginationInfo = { + pagFunction : _this.getDataListDynamic(samplesOrCriteria, false), + pagOptions : grid.lastUsedOptions, + currentIndex : indexFound, + totalCount : grid.lastReceivedData.totalCount + } + } + } + return (isLinksDisabled)?data.code:FormUtil.getFormLink(data.code, "Sample", data.permId, paginationInfo); + }, + filter : function(data, filter) { + return data.identifier.toLowerCase().indexOf(filter) !== -1; + }, + sort : function(data1, data2, asc) { + var value1 = data1.identifier; + var value2 = data2.identifier; + var sortDirection = (asc)? 1 : -1; + return sortDirection * naturalSort(value1, value2); + } }); columnsFirst.push({ @@ -87,14 +118,44 @@ var SampleDataGridUtil = new function() { label : 'Parents', property : 'parents', isExportable: true, - sortable : false + sortable : false, + render : function(data, grid) { + var output = $("<span>"); + if(data.parents) { + var elements = data.parents.split(", "); + for (var eIdx = 0; eIdx < elements.length; eIdx++) { + var eIdentifier = elements[eIdx]; + var eComponent = (isLinksDisabled)?eIdentifier:FormUtil.getFormLink(eIdentifier, "Sample", eIdentifier, null); + if(eIdx != 0) { + output.append(", "); + } + output.append(eComponent); + } + } + return output; + } }); columnsFirst.push({ label : 'Children', property : 'children', isExportable: false, - sortable : false + sortable : false, + render : function(data, grid) { + var output = $("<span>"); + if(data.children) { + var elements = data.children.split(", "); + for (var eIdx = 0; eIdx < elements.length; eIdx++) { + var eIdentifier = elements[eIdx]; + var eComponent = (isLinksDisabled)?eIdentifier:FormUtil.getFormLink(eIdentifier, "Sample", eIdentifier, null); + if(eIdx != 0) { + output.append(", "); + } + output.append(eComponent); + } + } + return output; + } }); columnsFirst.push({ diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/widgets/DatasetViewerModel.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/widgets/DatasetViewerModel.js index 2395ca44039df68dc43143cbfe50762195af4518..c42346b5d68dc08921b4c1288f2ecf6e8759518a 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/widgets/DatasetViewerModel.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/widgets/DatasetViewerModel.js @@ -83,9 +83,10 @@ function DataSetViewerModel(containerId, profile, entity, serverFacade, datastor } this._isIconableImage = function(pathInDataSet) { - return this._hasExtension(pathInDataSet, ["jpg", "jpeg", "png", "gif"]); + var filename = pathInDataSet.split('/').slice(-1)[0]; + return !filename.startsWith('.') && this._hasExtension(pathInDataSet, ["jpg", "jpeg", "png", "gif"]); } - + this._isJupyterNotebook = function(pathInDataSet) { return this._hasExtension(pathInDataSet, ["ipynb"]); } diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/widgets/ImagePreviewIconLoader.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/widgets/ImagePreviewIconLoader.js index c0830e100b97e70c685846127639c5d3b7afbd5d..569b03ae2909feaaf1f3868e092db743fb64df67 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/widgets/ImagePreviewIconLoader.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/widgets/ImagePreviewIconLoader.js @@ -34,7 +34,7 @@ function ImagePreviewIconLoader() { } this._shouldLoadPreview = function(node) { - return ! node.data.previewLoaded && node.data.fileSize <= profile.datasetViewerMaxFilesizeForImagePreview; + return ! node.data.previewLoading && ! node.data.previewLoaded && node.data.fileSize <= profile.datasetViewerMaxFilesizeForImagePreview; } this._addToQueue = function(node) { @@ -58,6 +58,9 @@ function ImagePreviewIconLoader() { } this._initLoading = function(node) { + + node.data.previewLoading = true; + var $span = $(node.span); var $imageContainer = $("<span>", { id : "image-container" }).css({ @@ -122,6 +125,7 @@ function ImagePreviewIconLoader() { $imageContainer.append($iconImg); params.node.data.previewLoaded = true; + params.node.data.previewLoading = false; params.done(); }); } diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SettingsForm/SettingsFormController.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SettingsForm/SettingsFormController.js index fce3682ddc92eb14801cfcc3ae62cae7b95df31d..c4f73efa7a0060aade880d266e20797cb4bc9ec6 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SettingsForm/SettingsFormController.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SettingsForm/SettingsFormController.js @@ -21,11 +21,6 @@ function SettingsFormController(mainController, settingsSample, mode) { this._settingsManager = new SettingsManager(this._mainController.serverFacade); this.init = function(views) { - - if (!profile.isAdmin) { - return; - } - // apply settings to copy of profile, even if invalid, for editing var profileToEdit = jQuery.extend(true, {}, profile); this._settingsManager.loadSettingsAndApplyToProfile((function() { diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SettingsForm/SettingsFormView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SettingsForm/SettingsFormView.js index 4a3e99695161a57a696c7f8bce1035f695df6ec4..9e1c5b6bbe7bdd7db389dc7076796bc5f19ee97c 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SettingsForm/SettingsFormView.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SettingsForm/SettingsFormView.js @@ -427,29 +427,28 @@ function SettingsFormView(settingsFormController, settingsFormModel) { { label : "Settings for" }, { label : "Section name" }, { label : "Disable section" }, - { label : "Disable addition of any object type" } + { label : "Disable addition of any " + ELNDictionary.sample + " type" } ]; - tableModel.rowBuilders = { - "Settings for" : function(rowData) { + tableModel.rowBuilders = {} + tableModel.rowBuilders["Settings for"] = function(rowData) { return $("<span>").text(rowData.parentsOrChildren); - }, - "Section name" : function(rowData) { - return $("<input>", { type : "text", class : "form-control" }).val(rowData.title); - }, - "Disable section" : function(rowData) { - var $checkbox = $("<input>", { type : "checkbox" }); - if (rowData.disabled) { - $checkbox.attr("checked", true); - } - return $checkbox; - }, - "Disable addition of any object type" : function(rowData) { - var $checkbox = $("<input>", { type : "checkbox" }); - if (rowData.anyTypeDisabled) { - $checkbox.attr("checked", true); - } - return $checkbox; - }, + }; + tableModel.rowBuilders["Section name"] = function(rowData) { + return $("<input>", { type : "text", class : "form-control" }).val(rowData.title); + }; + tableModel.rowBuilders["Disable section"] = function(rowData) { + var $checkbox = $("<input>", { type : "checkbox" }); + if (rowData.disabled) { + $checkbox.attr("checked", true); + } + return $checkbox; + }; + tableModel.rowBuilders["Disable addition of any " + ELNDictionary.sample + " type"] = function(rowData) { + var $checkbox = $("<input>", { type : "checkbox" }); + if (rowData.anyTypeDisabled) { + $checkbox.attr("checked", true); + } + return $checkbox; }; // add data if (sampleTypeSettings) { // values from profile @@ -490,7 +489,7 @@ function SettingsFormView(settingsFormController, settingsFormModel) { if (rowValues["Disable section"]) { settings["SAMPLE_PARENTS_DISABLED"] = true; } - if (rowValues["Disable addition of any object type"]) { + if (rowValues["Disable addition of any " + ELNDictionary.sample + " type"]) { settings["SAMPLE_PARENTS_ANY_TYPE_DISABLED"] = true; } } else if (rowValues["Settings for"] === "Children") { @@ -500,7 +499,7 @@ function SettingsFormView(settingsFormController, settingsFormModel) { if (rowValues["Disable section"]) { settings["SAMPLE_CHILDREN_DISABLED"] = true; } - if (rowValues["Disable addition of any object type"]) { + if (rowValues["Disable addition of any " + ELNDictionary.sample + " type"]) { settings["SAMPLE_CHILDREN_ANY_TYPE_DISABLED"] = true; } } @@ -646,7 +645,7 @@ function SettingsFormView(settingsFormController, settingsFormModel) { tableModel.rowBuilders[params.columnName] = function(rowData) { return FormUtil.getDropdown(params.options.map(function(option) { return { - label : option, + label : Util.getDisplayNameFromCode(option), value : option, selected : option === rowData, };