From c27f12d6e8ea88bfa0f0df15382fa2f17b5edbb9 Mon Sep 17 00:00:00 2001 From: "miriam.baglioni" Date: Fri, 10 Jul 2020 19:42:23 +0200 Subject: [PATCH] avoid to consider _SUCCESS file --- .../dhp/oa/graph/dump/SendToZenodo.java | 34 +++++++++---------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/SendToZenodo.java b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/SendToZenodo.java index 8087d425d..069e4d28c 100644 --- a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/SendToZenodo.java +++ b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/SendToZenodo.java @@ -62,27 +62,25 @@ public class SendToZenodo implements Serializable { Path p = fileStatus.getPath(); String p_string = p.toString(); - String tmp = p_string.substring(0, p_string.lastIndexOf("/")); - String community = tmp.substring(tmp.lastIndexOf("/") + 1); - log.info("Sending information for community: " + community); - String community_name = communityMap.get(community).replace(" ", "_") + ".json.gz"; - log.info("Copying information for community: " + community); - fileSystem.copyToLocalFile(p, new Path("/tmp/" + community_name)); - File f = new File("/tmp/" + community_name); - try { - apiClient.upload(f, community_name); + if(!p_string.endsWith("_SUCCESS")){ + String tmp = p_string.substring(0, p_string.lastIndexOf("/")); + String community = tmp.substring(tmp.lastIndexOf("/") + 1); + log.info("Sending information for community: " + community); + String community_name = communityMap.get(community).replace(" ", "_") + ".json.gz"; + log.info("Copying information for community: " + community); + fileSystem.copyToLocalFile(p, new Path("/tmp/" + community_name)); + File f = new File("/tmp/" + community_name); + try { + apiClient.upload(f, community_name); - } catch (Exception e) { - if (f.exists()) { - log.info("Deleting information for community: " + community); - f.delete(); - } - } finally { - if (f.exists()) { - log.info("Deleting information for community: " + community); - f.delete(); + } finally { + if (f.exists()) { + log.info("Deleting information for community: " + community); + f.delete(); + } } } + } apiClient.sendMretadata(metadata);