avoid to consider _SUCCESS file

This commit is contained in:
Miriam Baglioni 2020-07-10 19:42:23 +02:00
parent 1b0b968548
commit c27f12d6e8
1 changed files with 16 additions and 18 deletions

View File

@ -62,27 +62,25 @@ public class SendToZenodo implements Serializable {
Path p = fileStatus.getPath(); Path p = fileStatus.getPath();
String p_string = p.toString(); String p_string = p.toString();
String tmp = p_string.substring(0, p_string.lastIndexOf("/")); if(!p_string.endsWith("_SUCCESS")){
String community = tmp.substring(tmp.lastIndexOf("/") + 1); String tmp = p_string.substring(0, p_string.lastIndexOf("/"));
log.info("Sending information for community: " + community); String community = tmp.substring(tmp.lastIndexOf("/") + 1);
String community_name = communityMap.get(community).replace(" ", "_") + ".json.gz"; log.info("Sending information for community: " + community);
log.info("Copying information for community: " + community); String community_name = communityMap.get(community).replace(" ", "_") + ".json.gz";
fileSystem.copyToLocalFile(p, new Path("/tmp/" + community_name)); log.info("Copying information for community: " + community);
File f = new File("/tmp/" + community_name); fileSystem.copyToLocalFile(p, new Path("/tmp/" + community_name));
try { File f = new File("/tmp/" + community_name);
apiClient.upload(f, community_name); try {
apiClient.upload(f, community_name);
} catch (Exception e) { } finally {
if (f.exists()) { if (f.exists()) {
log.info("Deleting information for community: " + community); log.info("Deleting information for community: " + community);
f.delete(); f.delete();
} }
} finally {
if (f.exists()) {
log.info("Deleting information for community: " + community);
f.delete();
} }
} }
} }
apiClient.sendMretadata(metadata); apiClient.sendMretadata(metadata);