From 74a7fac774fab83f52a11a01b159385c783d7274 Mon Sep 17 00:00:00 2001 From: sandro Date: Wed, 15 Apr 2020 15:23:54 +0200 Subject: [PATCH] fixed problem with timestamp --- .../dnetlib/dhp/provision/update/DataciteClientIterator.java | 4 +++- .../resources/eu/dnetlib/dhp/sx/synch/oozie_app/workflow.xml | 4 ++-- .../java/eu/dnetlib/dhp/provision/DataciteClientTest.java | 5 ++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/dhp-workflows/dhp-graph-provision-scholexplorer/src/main/java/eu/dnetlib/dhp/provision/update/DataciteClientIterator.java b/dhp-workflows/dhp-graph-provision-scholexplorer/src/main/java/eu/dnetlib/dhp/provision/update/DataciteClientIterator.java index e823945ae..61c1aa39f 100644 --- a/dhp-workflows/dhp-graph-provision-scholexplorer/src/main/java/eu/dnetlib/dhp/provision/update/DataciteClientIterator.java +++ b/dhp-workflows/dhp-graph-provision-scholexplorer/src/main/java/eu/dnetlib/dhp/provision/update/DataciteClientIterator.java @@ -27,10 +27,12 @@ public class DataciteClientIterator implements Iterator { final String esIndex; final ObjectMapper mapper = new ObjectMapper(); - public DataciteClientIterator(final String esHost, final String esIndex, final long timestamp) throws IOException { + public DataciteClientIterator(final String esHost, final String esIndex, long timestamp) throws IOException { this.esHost = esHost; this.esIndex = esIndex; + // THIS FIX IS NECESSARY to avoid different timezone + timestamp -= (60 *60 *2); final String body =getResponse(String.format("http://%s:9200/%s/_search?scroll=1m", esHost, esIndex), String.format("{\"size\":1000, \"query\":{\"range\":{\"timestamp\":{\"gte\":%d}}}}", timestamp)); scrollId= getJPathString(scrollIdPath, body); buffer = getBlobs(body); diff --git a/dhp-workflows/dhp-graph-provision-scholexplorer/src/main/resources/eu/dnetlib/dhp/sx/synch/oozie_app/workflow.xml b/dhp-workflows/dhp-graph-provision-scholexplorer/src/main/resources/eu/dnetlib/dhp/sx/synch/oozie_app/workflow.xml index 5e108f94f..c004eafe6 100644 --- a/dhp-workflows/dhp-graph-provision-scholexplorer/src/main/resources/eu/dnetlib/dhp/sx/synch/oozie_app/workflow.xml +++ b/dhp-workflows/dhp-graph-provision-scholexplorer/src/main/resources/eu/dnetlib/dhp/sx/synch/oozie_app/workflow.xml @@ -50,7 +50,7 @@ -ihip-90-147-167-25.ct1.garrservices.it -indatacite - + @@ -60,7 +60,7 @@ ${nameNode} yarn-cluster cluster - Resolve and generate Scholix + resolve and generate Scholix eu.dnetlib.dhp.provision.update.SparkResolveScholixTarget dhp-graph-provision-scholexplorer-${projectVersion}.jar --executor-memory ${sparkExecutorMemory} --driver-memory=${sparkDriverMemory} ${sparkExtraOPT} --conf spark.dynamicAllocation.maxExecutors="32" diff --git a/dhp-workflows/dhp-graph-provision-scholexplorer/src/test/java/eu/dnetlib/dhp/provision/DataciteClientTest.java b/dhp-workflows/dhp-graph-provision-scholexplorer/src/test/java/eu/dnetlib/dhp/provision/DataciteClientTest.java index 782784be4..f4a480163 100644 --- a/dhp-workflows/dhp-graph-provision-scholexplorer/src/test/java/eu/dnetlib/dhp/provision/DataciteClientTest.java +++ b/dhp-workflows/dhp-graph-provision-scholexplorer/src/test/java/eu/dnetlib/dhp/provision/DataciteClientTest.java @@ -6,11 +6,13 @@ import eu.dnetlib.dhp.provision.scholix.ScholixResource; import eu.dnetlib.dhp.provision.update.CrossrefClient; import eu.dnetlib.dhp.provision.update.Datacite2Scholix; import eu.dnetlib.dhp.provision.update.DataciteClient; +import eu.dnetlib.dhp.provision.update.DataciteClientIterator; import eu.dnetlib.scholexplorer.relation.RelationMapper; import org.apache.commons.io.IOUtils; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import java.io.IOException; import java.util.List; @@ -25,7 +27,6 @@ public class DataciteClientTest { System.out.println(new ObjectMapper().writeValueAsString(s)); } - public void testResolveDataset() throws Exception { DataciteClient dc = new DataciteClient("ip-90-147-167-25.ct1.garrservices.it"); ScholixResource datasetByDOI = dc.getDatasetByDOI("10.17182/hepdata.15392.v1/t5"); @@ -37,7 +38,5 @@ public class DataciteClientTest { ScholixResource crossrefByDOI = cr.getResourceByDOI("10.26850/1678-4618eqj.v35.1.2010.p41-46"); Assertions.assertNotNull(crossrefByDOI); System.out.println(new ObjectMapper().writeValueAsString(crossrefByDOI)); - - } }