Search in sources :

Example 1 with Registry

use of org.icgc.dcc.song.client.register.Registry in project SONG by overture-stack.

the class Benchmark method waitForStatus.

public void waitForStatus(PayloadFileVisitor payloadFileVisitor) {
    for (val studyId : payloadFileVisitor.getStudies()) {
        val registry = new Registry(createConfig(studyId), new RestClient());
        val uploadDatas = payloadFileVisitor.getDataForStudy(studyId);
        waitForStatusForStudy(studyId, registry, uploadDatas);
    }
}
Also used : lombok.val(lombok.val) RestClient(org.icgc.dcc.song.client.register.RestClient) Registry(org.icgc.dcc.song.client.register.Registry)

Example 2 with Registry

use of org.icgc.dcc.song.client.register.Registry in project SONG by overture-stack.

the class Benchmark method upload.

public void upload(PayloadFileVisitor payloadFileVisitor) {
    for (val studyId : payloadFileVisitor.getStudies()) {
        setupStudy(studyId);
        val registry = new Registry(createConfig(studyId), new RestClient());
        checkState(registry.isAlive(), "The song server '%s' is not running", benchmarkConfig.getAccessToken());
        val uploadDatas = payloadFileVisitor.getDataForStudy(studyId);
        uploadStudy(studyId, registry, uploadDatas);
    }
}
Also used : lombok.val(lombok.val) RestClient(org.icgc.dcc.song.client.register.RestClient) Registry(org.icgc.dcc.song.client.register.Registry)

Example 3 with Registry

use of org.icgc.dcc.song.client.register.Registry in project SONG by overture-stack.

the class Benchmark method save.

public void save(PayloadFileVisitor payloadFileVisitor) {
    for (val studyId : payloadFileVisitor.getStudies()) {
        val registry = new Registry(createConfig(studyId), new RestClient());
        val uploadDatas = payloadFileVisitor.getDataForStudy(studyId);
        saveForStudy(studyId, registry, uploadDatas);
    }
}
Also used : lombok.val(lombok.val) RestClient(org.icgc.dcc.song.client.register.RestClient) Registry(org.icgc.dcc.song.client.register.Registry)

Example 4 with Registry

use of org.icgc.dcc.song.client.register.Registry in project SONG by overture-stack.

the class Benchmark method saveForStudy.

@SneakyThrows
private void saveForStudy(String studyId, Registry registry, List<UploadData> uploadDataList) {
    val modList = uploadDataList.stream().filter(x -> !x.getUploadState().equals("VALIDATION_ERROR")).collect(toList());
    val total = modList.size();
    val errored = uploadDataList.size() - total;
    log.warn("Num Errored Files: {}", errored);
    int count = 0;
    val saveMonitor = monitor.getStudyMonitor(studyId).getSaveMonitor();
    for (val uploadData : modList) {
        val submittedAnalysisId = uploadData.getAnalysisId();
        val idExists = doesIdExist(uploadData.getStudyId(), registry, submittedAnalysisId);
        log.info("ANALYSIS_ID {} existence: {}", submittedAnalysisId, idExists);
        val rawResponse = saveMonitor.callIncr(() -> registry.save(uploadData.getStudyId(), uploadData.getUploadId(), benchmarkConfig.isIgnoreIdCollisions()));
        val response = readTree(rawResponse.getOutputs());
        val status = response.path("status").textValue();
        val analysisId = response.path("analysisId").textValue();
        uploadData.setAnalysisId(analysisId);
        log.info("Saving {} file {} /{} : {}", uploadData.getStudyId(), ++count, total, uploadData.getFile().getFileName().toString());
    }
}
Also used : lombok.val(lombok.val) RestClient(org.icgc.dcc.song.client.register.RestClient) SneakyThrows(lombok.SneakyThrows) StudyClient.createStudyClient(org.icgc.dcc.song.client.benchmark.rest.StudyClient.createStudyClient) RequiredArgsConstructor(lombok.RequiredArgsConstructor) Registry(org.icgc.dcc.song.client.register.Registry) UploadData(org.icgc.dcc.song.client.benchmark.model.UploadData) Lists(com.google.common.collect.Lists) JsonUtils.readTree(org.icgc.dcc.song.core.utils.JsonUtils.readTree) Thread.sleep(java.lang.Thread.sleep) Path(java.nio.file.Path) BenchmarkMonitor(org.icgc.dcc.song.client.benchmark.monitor.BenchmarkMonitor) Files(java.nio.file.Files) NonNull(lombok.NonNull) lombok.val(lombok.val) CounterMonitor(org.icgc.dcc.song.client.benchmark.monitor.CounterMonitor) Collectors(java.util.stream.Collectors) Preconditions.checkState(com.google.common.base.Preconditions.checkState) BenchmarkMonitor.createBenchmarkMonitor(org.icgc.dcc.song.client.benchmark.monitor.BenchmarkMonitor.createBenchmarkMonitor) JsonUtils(org.icgc.dcc.song.core.utils.JsonUtils) Slf4j(lombok.extern.slf4j.Slf4j) List(java.util.List) Collectors.toList(java.util.stream.Collectors.toList) Paths(java.nio.file.Paths) StudyMonitor(org.icgc.dcc.song.client.benchmark.monitor.StudyMonitor) ObjectMapper(org.codehaus.jackson.map.ObjectMapper) Config(org.icgc.dcc.song.client.config.Config) PRIVATE(lombok.AccessLevel.PRIVATE) SneakyThrows(lombok.SneakyThrows)

Aggregations

lombok.val (lombok.val)4 Registry (org.icgc.dcc.song.client.register.Registry)4 RestClient (org.icgc.dcc.song.client.register.RestClient)4 Preconditions.checkState (com.google.common.base.Preconditions.checkState)1 Lists (com.google.common.collect.Lists)1 Thread.sleep (java.lang.Thread.sleep)1 Files (java.nio.file.Files)1 Path (java.nio.file.Path)1 Paths (java.nio.file.Paths)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 Collectors.toList (java.util.stream.Collectors.toList)1 PRIVATE (lombok.AccessLevel.PRIVATE)1 NonNull (lombok.NonNull)1 RequiredArgsConstructor (lombok.RequiredArgsConstructor)1 SneakyThrows (lombok.SneakyThrows)1 Slf4j (lombok.extern.slf4j.Slf4j)1 ObjectMapper (org.codehaus.jackson.map.ObjectMapper)1 UploadData (org.icgc.dcc.song.client.benchmark.model.UploadData)1 BenchmarkMonitor (org.icgc.dcc.song.client.benchmark.monitor.BenchmarkMonitor)1