refs #2032: Create IS Sweeper as SmartExecutor Plugin

https://support.d4science.org/issues/2032

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/is-sweeper-se-plugin@122911 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2016-02-08 14:48:59 +00:00
parent 40df7bb161
commit c4b0572bbc
6 changed files with 44 additions and 40 deletions

View File

@ -1,24 +1,23 @@
The gCube System - Smart Executor Plugin
The gCube System - Smart Executor Service
------------------------------------------------------------
This work has been partially supported by the following European projects: DILIGENT (FP6-2003-IST-2),
D4Science (FP7-INFRA-2007-1.2.2), D4Science-II (FP7-INFRA-2008-1.2.2), iMarine (FP7-INFRASTRUCTURES-2011-2),
and EUBrazilOpenBio (FP7-ICT-2011-EU-Brazil), Parthenos (H2020-INFRADEV-1-2014-1), BlueBridge (H2020-EINFRA-2015-1).
This work has been partially supported by the following European projects:
DILIGENT (FP6-2003-IST-2), D4Science (FP7-INFRA-2007-1.2.2),
D4Science-II (FP7-INFRA-2008-1.2.2), iMarine (FP7-INFRASTRUCTURES-2011-2),
EUBrazilOpenBio (FP7-ICT-2011-EU-Brazil), Parthenos (H2020-INFRADEV-1-2014-1),
BlueBridge (H2020-EINFRA-2015-1).
Authors
-------
* Luca Frosini (luca.frosini@isti.cnr.it), CNR Pisa,
Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo".
Version and Release Date
------------------------
See changelog.xml file in this directory.
v. 1.0.0 * First release
Description
-----------
${description}
@ -31,11 +30,9 @@ ${scm.url}
Documentation
-------------
${wiki}
Licensing
---------
This software is licensed under the terms you may find in the file named "LICENSE" in this directory.
This software is licensed under the terms you may find in the file named
"LICENSE" in this directory.

View File

@ -1,5 +1,5 @@
<ReleaseNotes>
<Changeset component="org.gcube.vre-management.smart-executor-sweeper-plugin.1.0.0" date="2015-10-30">
<Changeset component="org.gcube.informationsystem.is-sweeper-se-plugin.1.0.0" date="2016-02-08">
<Change>First Release</Change>
</Changeset>
</ReleaseNotes>

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<Resource>
<ID />
<Type>Service</Type>
<Type>Plugin</Type>
<Profile>
<Description>{description}</Description>
<Class>VREManagement</Class>
<Class>${serviceClass}</Class>
<Name>${artifactId}</Name>
<Version>1.0.0</Version>
<Packages>
@ -17,7 +17,7 @@
<artifactId>${artifactId}</artifactId>
<version>${version}</version>
</MavenCoordinates>
<Type>library</Type>
<Type>Plugin</Type>
<Files>
<File>${build.finalName}.jar</File>
</Files>

14
pom.xml
View File

@ -14,6 +14,14 @@
<name>IS Sweeper Smart Executor Plugin</name>
<description>Smart Executor Plugin to run Sweeper. Normally is launched as Scheduled Task</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<metaInfDirectory>src/main/resources/META-INF/services</metaInfDirectory>
<distroDirectory>${project.basedir}/distro</distroDirectory>
<serviceClass>InformationSystem</serviceClass>
<wiki>https://wiki.gcube-system.org/gcube/SmartExecutor</wiki>
</properties>
<scm>
<connection>scm:https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/${project.artifactId}</connection>
<developerConnection>scm:https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/${project.artifactId}</developerConnection>
@ -32,12 +40,6 @@
</dependencies>
</dependencyManagement>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<metaInfDirectory>src/main/resources/META-INF/services</metaInfDirectory>
<distroDirectory>distro</distroDirectory>
</properties>
<dependencies>
<dependency>
<groupId>org.gcube.vremanagement</groupId>

View File

@ -16,6 +16,18 @@ import org.slf4j.LoggerFactory;
*/
public class ISSweeperPlugin extends Plugin<ISSweeperPluginDeclaration> {
/**
* Indicate the default minutes timeout so that Hosting Node is
* considered expired and can be set to {@link Sweeper#UNREACHABLE}
*/
public static final int EXPIRING_MINUTES_TIMEOUT = 30;
/**
* Indicate the default days timeout so that Hosting Node is considered
* dead and can be removed from IS
*/
public static final int DEAD_DAYS_TIMEOUT = 15;
/**
* Logger
*/
@ -26,13 +38,6 @@ public class ISSweeperPlugin extends Plugin<ISSweeperPluginDeclaration> {
logger.debug("contructor");
}
/*
public static String getTagValue(String xml, String tagName){
return xml.split("<"+tagName+">")[1].split("</"+tagName+">")[0];
}
*/
/**{@inheritDoc}*/
@Override
public void launch(Map<String, Object> inputs) throws Exception {
@ -47,14 +52,14 @@ public class ISSweeperPlugin extends Plugin<ISSweeperPluginDeclaration> {
Sweeper sweeper = new Sweeper();
try {
sweeper.sweepDeadGHNs(Calendar.DAY_OF_YEAR, -15);
sweeper.sweepDeadGHNs(Calendar.DAY_OF_YEAR, -DEAD_DAYS_TIMEOUT);
} catch(Exception e){
logger.error("Error removing Dead HostingNodes", e);
}
logger.trace("---------------------------------\n\n");
try {
sweeper.sweepExpiredGHNs(Calendar.MINUTE, -30);
sweeper.sweepExpiredGHNs(Calendar.MINUTE, -EXPIRING_MINUTES_TIMEOUT);
logger.trace("---------------------------------\n\n");
} catch(Exception e){
logger.error("Error sweeping Expired HostingNodes", e);
@ -70,8 +75,6 @@ public class ISSweeperPlugin extends Plugin<ISSweeperPluginDeclaration> {
logger.error("Error sweeping Orphan RunningInstances", e);
}
logger.debug("{} execution finished", ISSweeperPluginDeclaration.NAME);
}

View File

@ -27,12 +27,14 @@ public class ISSweeperPluginDeclaration implements PluginDeclaration {
/**
* Plugin name used by the Executor to retrieve this class
*/
public static final String NAME = "ScheduledTaskSweeper";
public static final String NAME = "ISSweeper";
public static final String DESCRIPTION =
"Scheduled Task Sweeper find orphaned scheduled task on SmartExecutor "
+ "persistence and make them available. This requires interaction with "
+ "SmartExecutor Persistence and with IS to find orphaned Running "
+ "Instances";
"IS Sweeper find expired (not updated for "
+ ISSweeperPlugin.EXPIRING_MINUTES_TIMEOUT + " minutes) Hosting Nodes "
+ "and set their status to " + Sweeper.UNREACHABLE + ", dead (not "
+ "updated for " + ISSweeperPlugin.DEAD_DAYS_TIMEOUT + " days) Hosting "
+ "Nodes and remove them from IS. Moreover it find orphan Running "
+ "Instances and remove them from IS.";
public static final String VERSION = "1.0.0";
/**{@inheritDoc}*/