Upgraded version and changelog after release 4.10.0 refs #10870. Merged changes made directly in release branch.
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/vre-management/smart-executor@163314 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
9f9eb54181
commit
dbfcd5ad5c
|
@ -1,7 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE xml>
|
||||
<ReleaseNotes>
|
||||
<Changeset component="org.gcube.vre-management.smart-executor.1.9.0" date="${buildDate}">
|
||||
<Changeset component="org.gcube.vre-management.smart-executor.1.10.0" date="${buildDate}">
|
||||
<Change></Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.vre-management.smart-executor.1.9.0" date="2017-02-15">
|
||||
<Change>Added REST interface to Smart Executor #5109</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.vre-management.smart-executor.1.8.0" date="2017-11-29">
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -10,7 +10,7 @@
|
|||
|
||||
<groupId>org.gcube.vremanagement</groupId>
|
||||
<artifactId>smart-executor</artifactId>
|
||||
<version>1.9.0-SNAPSHOT</version>
|
||||
<version>1.10.0-SNAPSHOT</version>
|
||||
<name>SmartExecutor</name>
|
||||
<description>Smart Executor Service</description>
|
||||
<packaging>war</packaging>
|
||||
|
|
|
@ -12,9 +12,11 @@ import javax.ws.rs.Produces;
|
|||
import javax.ws.rs.QueryParam;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.gcube.common.authorization.library.provider.CalledMethodProvider;
|
||||
import org.gcube.vremanagement.executor.ResourceInitializer;
|
||||
import org.gcube.vremanagement.executor.api.rest.RestConstants;
|
||||
import org.gcube.vremanagement.executor.api.types.LaunchParameter;
|
||||
import org.gcube.vremanagement.executor.client.util.HTTPCall.HTTPMETHOD;
|
||||
import org.gcube.vremanagement.executor.exception.ExecutorException;
|
||||
import org.gcube.vremanagement.executor.exception.InputsNullException;
|
||||
import org.gcube.vremanagement.executor.exception.InvalidInputsException;
|
||||
|
@ -46,6 +48,9 @@ public class RestSmartExecutor {
|
|||
@Produces(MediaType.TEXT_PLAIN)
|
||||
public String launch(@PathParam(PLUGIN_NAME_PATH_PARAM) String pluginName, String launchParameterString)
|
||||
throws ExecutorException {
|
||||
CalledMethodProvider.instance
|
||||
.set(HTTPMETHOD.POST.name() + " /" + RestConstants.PLUGINS_PATH_PART + "/" + PLUGIN_NAME_PATH_PARAM);
|
||||
|
||||
try {
|
||||
logger.info("Requested to launch {} ({})", pluginName, launchParameterString);
|
||||
LaunchParameter launchParameter = SEMapper.unmarshal(LaunchParameter.class, launchParameterString);
|
||||
|
@ -62,7 +67,6 @@ public class RestSmartExecutor {
|
|||
throw new InvalidInputsException(error);
|
||||
}
|
||||
|
||||
|
||||
SmartExecutorScheduler smartExecutorScheduler = SmartExecutorSchedulerFactory.getSmartExecutorScheduler();
|
||||
UUID uuid = smartExecutorScheduler.schedule(launchParameter, null);
|
||||
|
||||
|
@ -82,11 +86,18 @@ public class RestSmartExecutor {
|
|||
public String getPluginStateEvolution(@PathParam(PLUGIN_NAME_PATH_PARAM) String pluginName,
|
||||
@PathParam(UUID_PATH_PARAM) String executionIdentifier,
|
||||
@QueryParam(RestConstants.ITERATION_NUMBER_PARAM) Integer iterationNumber) throws ExecutorException {
|
||||
|
||||
CalledMethodProvider.instance.set(HTTPMETHOD.GET.name() + " /" + RestConstants.PLUGINS_PATH_PART + "/"
|
||||
+ PLUGIN_NAME_PATH_PARAM + "/" + UUID_PATH_PARAM);
|
||||
|
||||
PluginStateEvolution pluginStateEvolution = null;
|
||||
try {
|
||||
SmartExecutorPersistenceConnector persistenceConnector = SmartExecutorPersistenceFactory.getPersistenceConnector();
|
||||
pluginStateEvolution = persistenceConnector.getPluginInstanceState(UUID.fromString(executionIdentifier), iterationNumber);
|
||||
logger.info("{} for {} (iteration n. {}) is {}", PluginStateEvolution.class.getSimpleName(), executionIdentifier, iterationNumber, pluginStateEvolution);
|
||||
SmartExecutorPersistenceConnector persistenceConnector = SmartExecutorPersistenceFactory
|
||||
.getPersistenceConnector();
|
||||
pluginStateEvolution = persistenceConnector.getPluginInstanceState(UUID.fromString(executionIdentifier),
|
||||
iterationNumber);
|
||||
logger.info("{} for {} (iteration n. {}) is {}", PluginStateEvolution.class.getSimpleName(),
|
||||
executionIdentifier, iterationNumber, pluginStateEvolution);
|
||||
} catch(ExecutorException e) {
|
||||
throw e;
|
||||
} catch(Exception e) {
|
||||
|
@ -112,38 +123,44 @@ public class RestSmartExecutor {
|
|||
public boolean delete(@PathParam(PLUGIN_NAME_PATH_PARAM) String pluginName,
|
||||
@PathParam(UUID_PATH_PARAM) String executionIdentifier,
|
||||
@QueryParam(RestConstants.GLOBALLY_PARAM) Boolean globally) throws ExecutorException {
|
||||
|
||||
CalledMethodProvider.instance.set(HTTPMETHOD.DELETE.name() + " /" + RestConstants.PLUGINS_PATH_PART + "/"
|
||||
+ PLUGIN_NAME_PATH_PARAM + "/" + UUID_PATH_PARAM);
|
||||
|
||||
try {
|
||||
if(globally == null) {
|
||||
globally = false;
|
||||
}
|
||||
|
||||
logger.info("Requested to delete for {} with UUID {} {}", pluginName, executionIdentifier,
|
||||
logger.info("Requested to delete for {} with UUID {} {}", pluginName, executionIdentifier,
|
||||
globally ? RestConstants.GLOBALLY_PARAM : "");
|
||||
|
||||
boolean currentStopped = true;
|
||||
try {
|
||||
SmartExecutorScheduler smartExecutorScheduler = SmartExecutorSchedulerFactory.getSmartExecutorScheduler();
|
||||
UUID uuid = UUID.fromString(executionIdentifier);
|
||||
SmartExecutorScheduler smartExecutorScheduler = SmartExecutorSchedulerFactory
|
||||
.getSmartExecutorScheduler();
|
||||
UUID uuid = UUID.fromString(executionIdentifier);
|
||||
smartExecutorScheduler.stop(uuid, globally);
|
||||
} catch (SchedulerNotFoundException e) {
|
||||
} catch(SchedulerNotFoundException e) {
|
||||
// currentStopped = true;
|
||||
logger.error("Error unscheduling task {}", executionIdentifier, e);
|
||||
throw new ExecutorException(e);
|
||||
} catch(SchedulerException e){
|
||||
} catch(SchedulerException e) {
|
||||
// currentStopped = false;
|
||||
logger.error("Error unscheduling task {}", executionIdentifier, e);
|
||||
throw new ExecutorException(e);
|
||||
} catch(SchedulePersistenceException e){
|
||||
} catch(SchedulePersistenceException e) {
|
||||
// currentStopped = true;
|
||||
logger.error("Error removing scheduled task from persistence.", e);
|
||||
} catch (ExecutorException e) {
|
||||
} catch(ExecutorException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
} catch(Exception e) {
|
||||
// currentStopped = false;
|
||||
logger.error("Error unscheduling task {}", executionIdentifier, e);
|
||||
throw new ExecutorException(e);
|
||||
}
|
||||
logger.info("{} with UUID {} was{} stopped successfully", pluginName, executionIdentifier, currentStopped? "" : " NOT");
|
||||
logger.info("{} with UUID {} was{} stopped successfully", pluginName, executionIdentifier,
|
||||
currentStopped ? "" : " NOT");
|
||||
return currentStopped;
|
||||
} catch(ExecutorException e) {
|
||||
throw e;
|
||||
|
@ -157,6 +174,7 @@ public class RestSmartExecutor {
|
|||
@Path(RestConstants.SCHEDULED_PATH_PART)
|
||||
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
public String all(@QueryParam(RestConstants.GLOBALLY_PARAM) Boolean globally) throws ExecutorException {
|
||||
CalledMethodProvider.instance.set(HTTPMETHOD.GET.name() + " /" + RestConstants.SCHEDULED_PATH_PART);
|
||||
return "[]";
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue