refs #521: Support Unscheduling of repetitive task on SmartExecutor
https://support.d4science.org/issues/521 git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/vre-management/smart-executor-client@120471 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
0c28d569e7
commit
5a9ae793ee
10
pom.xml
10
pom.xml
|
@ -10,9 +10,15 @@
|
|||
|
||||
<groupId>org.gcube.vremanagement</groupId>
|
||||
<artifactId>smart-executor-client</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<description>Smart Executor Service Client Library</description>
|
||||
|
||||
<scm>
|
||||
<connection>scm:https://svn.d4science.research-infrastructures.eu/gcube/trunk/vre-management/${project.artifactId}</connection>
|
||||
<developerConnection>scm:https://svn.d4science.research-infrastructures.eu/gcube/trunk/vre-management/${project.artifactId}</developerConnection>
|
||||
<url>https://svn.d4science.research-infrastructures.eu/gcube/trunk/vre-management/${project.artifactId}</url>
|
||||
</scm>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
@ -30,7 +36,7 @@
|
|||
<dependency>
|
||||
<groupId>org.gcube.vremanagement</groupId>
|
||||
<artifactId>smart-executor-api</artifactId>
|
||||
<version>[1.2.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
<version>[1.1.0-SNAPSHOT, 1.3.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.core</groupId>
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.vremanagement.executor.client.plugins.query.filter;
|
||||
|
||||
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
||||
*
|
||||
*/
|
||||
public interface ServiceEndpointFilter {
|
||||
|
||||
public void filter(SimpleQuery simpleQuery);
|
||||
|
||||
|
||||
}
|
|
@ -11,6 +11,7 @@ import org.acme.HelloWorldPlugin;
|
|||
import org.acme.HelloWorldPluginDeclaration;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.vremanagement.executor.api.types.LaunchParameter;
|
||||
import org.gcube.vremanagement.executor.api.types.Scheduling;
|
||||
import org.gcube.vremanagement.executor.client.plugins.ExecutorPlugin;
|
||||
import org.gcube.vremanagement.executor.client.proxies.SmartExecutorProxy;
|
||||
import org.gcube.vremanagement.executor.exception.PluginInstanceNotFoundException;
|
||||
|
@ -66,7 +67,7 @@ public class DefaultExecutorTest {
|
|||
public void testOk() throws Exception {
|
||||
Map<String, Object> inputs = new HashMap<String, Object>();
|
||||
inputs.put("Hello", "World");
|
||||
long sleepTime = 10000;
|
||||
long sleepTime = 10000; // 1000 millisec * 10 = 10 sec
|
||||
inputs.put(HelloWorldPlugin.SLEEP_TIME, sleepTime);
|
||||
LaunchParameter launchParameter = new LaunchParameter(HelloWorldPluginDeclaration.NAME, inputs);
|
||||
try {
|
||||
|
@ -87,5 +88,70 @@ public class DefaultExecutorTest {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testScheduledTaskNotPersisted() throws Exception {
|
||||
proxy = ExecutorPlugin.getExecutorProxy((new HelloWorldPluginDeclaration()).getName()).build();
|
||||
Assert.assertNotNull(proxy);
|
||||
|
||||
Map<String, Object> inputs = new HashMap<String, Object>();
|
||||
inputs.put("Hello", "World");
|
||||
long sleepTime = 10000; // 1000 millisec * 10 = 10 sec
|
||||
inputs.put(HelloWorldPlugin.SLEEP_TIME, sleepTime);
|
||||
// Every 5 minutes, for 12 times (one hour totally).
|
||||
Scheduling scheduling = new Scheduling(60*5,12,false);
|
||||
LaunchParameter launchParameter = new LaunchParameter(HelloWorldPluginDeclaration.NAME, inputs, scheduling);
|
||||
|
||||
try {
|
||||
String executionIdentifier = proxy.launch(launchParameter);
|
||||
|
||||
Thread.sleep(1000);
|
||||
Assert.assertEquals(PluginState.RUNNING, proxy.getState(executionIdentifier));
|
||||
|
||||
Thread.sleep(4000);
|
||||
Assert.assertEquals(PluginState.RUNNING, proxy.getState(executionIdentifier));
|
||||
|
||||
Thread.sleep(6000);
|
||||
Assert.assertEquals(PluginState.DONE, proxy.getState(executionIdentifier));
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("testOk Exception", e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testScheduledTaskPersisted() throws Exception {
|
||||
proxy = ExecutorPlugin.getExecutorProxy((new HelloWorldPluginDeclaration()).getName()).build();
|
||||
Assert.assertNotNull(proxy);
|
||||
|
||||
Map<String, Object> inputs = new HashMap<String, Object>();
|
||||
inputs.put("Hello", "World");
|
||||
long sleepTime = 10000; // 1000 millisec * 10 = 10 sec
|
||||
inputs.put(HelloWorldPlugin.SLEEP_TIME, sleepTime);
|
||||
// Every 5 minutes, for 12 times (one hour totally).
|
||||
Scheduling scheduling = new Scheduling(60*5,12,true);
|
||||
LaunchParameter launchParameter = new LaunchParameter(HelloWorldPluginDeclaration.NAME, inputs, scheduling);
|
||||
|
||||
try {
|
||||
String executionIdentifier = proxy.launch(launchParameter);
|
||||
|
||||
Thread.sleep(1000);
|
||||
Assert.assertEquals(PluginState.RUNNING, proxy.getState(executionIdentifier));
|
||||
|
||||
Thread.sleep(4000);
|
||||
Assert.assertEquals(PluginState.RUNNING, proxy.getState(executionIdentifier));
|
||||
|
||||
Thread.sleep(6000);
|
||||
Assert.assertEquals(PluginState.DONE, proxy.getState(executionIdentifier));
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("testOk Exception", e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,6 +22,8 @@ public class SmartGenericWorkerDiscoveryQuery {
|
|||
|
||||
private static Logger logger = LoggerFactory.getLogger(SmartGenericWorkerDiscoveryQuery.class);
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testGenericWorkerDiscoveryQuery() throws Exception {
|
||||
GenericWorkerPluginDeclaration gwpd = new GenericWorkerPluginDeclaration();
|
||||
|
@ -47,5 +49,4 @@ public class SmartGenericWorkerDiscoveryQuery {
|
|||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue