forked from D-Net/dnet-hadoop
fixed problem with timestamp
This commit is contained in:
parent
c36239e693
commit
74a7fac774
|
@ -27,10 +27,12 @@ public class DataciteClientIterator implements Iterator<String> {
|
||||||
final String esIndex;
|
final String esIndex;
|
||||||
final ObjectMapper mapper = new ObjectMapper();
|
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.esHost = esHost;
|
||||||
this.esIndex = esIndex;
|
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));
|
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);
|
scrollId= getJPathString(scrollIdPath, body);
|
||||||
buffer = getBlobs(body);
|
buffer = getBlobs(body);
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
<arg>-ih</arg><arg>ip-90-147-167-25.ct1.garrservices.it</arg>
|
<arg>-ih</arg><arg>ip-90-147-167-25.ct1.garrservices.it</arg>
|
||||||
<arg>-in</arg><arg>datacite</arg>
|
<arg>-in</arg><arg>datacite</arg>
|
||||||
</java>
|
</java>
|
||||||
<ok to="End"/>
|
<ok to="resolveScholix"/>
|
||||||
<error to="Kill"/>
|
<error to="Kill"/>
|
||||||
</action>
|
</action>
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@
|
||||||
<name-node>${nameNode}</name-node>
|
<name-node>${nameNode}</name-node>
|
||||||
<master>yarn-cluster</master>
|
<master>yarn-cluster</master>
|
||||||
<mode>cluster</mode>
|
<mode>cluster</mode>
|
||||||
<name>Resolve and generate Scholix</name>
|
<name>resolve and generate Scholix</name>
|
||||||
<class>eu.dnetlib.dhp.provision.update.SparkResolveScholixTarget</class>
|
<class>eu.dnetlib.dhp.provision.update.SparkResolveScholixTarget</class>
|
||||||
<jar>dhp-graph-provision-scholexplorer-${projectVersion}.jar</jar>
|
<jar>dhp-graph-provision-scholexplorer-${projectVersion}.jar</jar>
|
||||||
<spark-opts>--executor-memory ${sparkExecutorMemory} --driver-memory=${sparkDriverMemory} ${sparkExtraOPT} --conf spark.dynamicAllocation.maxExecutors="32" </spark-opts>
|
<spark-opts>--executor-memory ${sparkExecutorMemory} --driver-memory=${sparkDriverMemory} ${sparkExtraOPT} --conf spark.dynamicAllocation.maxExecutors="32" </spark-opts>
|
||||||
|
|
|
@ -6,11 +6,13 @@ import eu.dnetlib.dhp.provision.scholix.ScholixResource;
|
||||||
import eu.dnetlib.dhp.provision.update.CrossrefClient;
|
import eu.dnetlib.dhp.provision.update.CrossrefClient;
|
||||||
import eu.dnetlib.dhp.provision.update.Datacite2Scholix;
|
import eu.dnetlib.dhp.provision.update.Datacite2Scholix;
|
||||||
import eu.dnetlib.dhp.provision.update.DataciteClient;
|
import eu.dnetlib.dhp.provision.update.DataciteClient;
|
||||||
|
import eu.dnetlib.dhp.provision.update.DataciteClientIterator;
|
||||||
import eu.dnetlib.scholexplorer.relation.RelationMapper;
|
import eu.dnetlib.scholexplorer.relation.RelationMapper;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,7 +27,6 @@ public class DataciteClientTest {
|
||||||
System.out.println(new ObjectMapper().writeValueAsString(s));
|
System.out.println(new ObjectMapper().writeValueAsString(s));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void testResolveDataset() throws Exception {
|
public void testResolveDataset() throws Exception {
|
||||||
DataciteClient dc = new DataciteClient("ip-90-147-167-25.ct1.garrservices.it");
|
DataciteClient dc = new DataciteClient("ip-90-147-167-25.ct1.garrservices.it");
|
||||||
ScholixResource datasetByDOI = dc.getDatasetByDOI("10.17182/hepdata.15392.v1/t5");
|
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");
|
ScholixResource crossrefByDOI = cr.getResourceByDOI("10.26850/1678-4618eqj.v35.1.2010.p41-46");
|
||||||
Assertions.assertNotNull(crossrefByDOI);
|
Assertions.assertNotNull(crossrefByDOI);
|
||||||
System.out.println(new ObjectMapper().writeValueAsString(crossrefByDOI));
|
System.out.println(new ObjectMapper().writeValueAsString(crossrefByDOI));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue