refs #579: Use Persistence to persist Scheduled Task configuration on smart-executor
https://support.d4science.org/issues/579 Added RunningOn also when is not possible to retreive it git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/vre-management/smart-executor@119446 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
dac74aed74
commit
1adb55d4e0
|
@ -3,6 +3,8 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.vremanagement.executor.persistence.couchdb;
|
package org.gcube.vremanagement.executor.persistence.couchdb;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.codehaus.jackson.map.ObjectMapper;
|
import org.codehaus.jackson.map.ObjectMapper;
|
||||||
import org.codehaus.jackson.node.ObjectNode;
|
import org.codehaus.jackson.node.ObjectNode;
|
||||||
import org.gcube.common.resources.gcore.GCoreEndpoint;
|
import org.gcube.common.resources.gcore.GCoreEndpoint;
|
||||||
|
@ -30,12 +32,19 @@ public class PluginStateEvolutionObjectNode {
|
||||||
|
|
||||||
public final static String SCOPE_FIELD = "scope";
|
public final static String SCOPE_FIELD = "scope";
|
||||||
|
|
||||||
|
public final static String LOCALHOST = "localhost";
|
||||||
|
|
||||||
protected static ObjectNode getRunOn(){
|
protected static ObjectNode getRunOn(){
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
ObjectNode objectNode = objectMapper.createObjectNode();
|
ObjectNode objectNode = objectMapper.createObjectNode();
|
||||||
GCoreEndpoint gCoreEndpoint = SmartExecutorInitalizator.getCtx().profile(GCoreEndpoint.class);
|
try {
|
||||||
objectNode.put(GHN_ID_FIELD, gCoreEndpoint.profile().ghnId());
|
GCoreEndpoint gCoreEndpoint = SmartExecutorInitalizator.getCtx().profile(GCoreEndpoint.class);
|
||||||
objectNode.put(GHN_HOSTNAME_FIELD, SmartExecutorInitalizator.getCtx().container().configuration().hostname());
|
objectNode.put(GHN_ID_FIELD, gCoreEndpoint.profile().ghnId());
|
||||||
|
objectNode.put(GHN_HOSTNAME_FIELD, SmartExecutorInitalizator.getCtx().container().configuration().hostname());
|
||||||
|
}catch(Exception e){
|
||||||
|
objectNode.put(GHN_ID_FIELD, LOCALHOST + "_" + UUID.randomUUID());
|
||||||
|
objectNode.put(GHN_HOSTNAME_FIELD, LOCALHOST);
|
||||||
|
}
|
||||||
return objectNode;
|
return objectNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue