-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add DeploymentMessage and enable per-node task iteration in WFs
- Workflows have been improved using DeploymentMessage as the main DeploymentService interface method's parameter in order to allow for greater customization of the Deployment (i.e. chosen CloudProvider, OneData settings, etc). - Workflows now support Deploy/Poll/Undeploy task iteration to allow the underlying command to work on a subset of TOSCA nodes (i.e. creating one Job at a time to avoid transaction timeout). Related to #48, #51, #53, #55 Fixes #44
- Loading branch information
1 parent
b1ee9c2
commit 0f6cd44
Showing
28 changed files
with
1,255 additions
and
725 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
201 changes: 201 additions & 0 deletions
201
src/main/java/it/reply/orchestrator/dto/deployment/DeploymentMessage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,201 @@ | ||
package it.reply.orchestrator.dto.deployment; | ||
|
||
import it.reply.orchestrator.dal.entity.Deployment; | ||
import it.reply.orchestrator.dal.entity.Resource; | ||
import it.reply.orchestrator.enums.DeploymentProvider; | ||
import it.reply.orchestrator.service.deployment.providers.ChronosServiceImpl.IndigoJob; | ||
|
||
import java.io.Serializable; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
/** | ||
* A message containing all the information needed during Deployment WF. | ||
* | ||
* @author l.biava | ||
* | ||
*/ | ||
public class DeploymentMessage implements Serializable { | ||
|
||
private static final long serialVersionUID = 8003907220093782923L; | ||
|
||
/** | ||
* The internal deployment representation (stored in the DB). | ||
*/ | ||
private Deployment deployment; | ||
|
||
private String deploymentId; | ||
|
||
private DeploymentProvider deploymentProvider; | ||
|
||
private TemplateTopologicalOrderIterator templateTopologicalOrderIterator; | ||
|
||
private boolean createComplete; | ||
private boolean deleteComplete; | ||
private boolean pollComplete; | ||
private boolean skipPollInterval; | ||
|
||
/** | ||
* TEMPORARY Chronos Job Graph (to avoid regenerating the template representation each time). | ||
*/ | ||
private Map<String, IndigoJob> chronosJobGraph; | ||
|
||
public Deployment getDeployment() { | ||
return deployment; | ||
} | ||
|
||
public void setDeployment(Deployment deployment) { | ||
this.deployment = deployment; | ||
} | ||
|
||
public String getDeploymentId() { | ||
return deploymentId; | ||
} | ||
|
||
public void setDeploymentId(String deploymentId) { | ||
this.deploymentId = deploymentId; | ||
} | ||
|
||
public DeploymentProvider getDeploymentProvider() { | ||
return deploymentProvider; | ||
} | ||
|
||
public void setDeploymentProvider(DeploymentProvider deploymentProvider) { | ||
this.deploymentProvider = deploymentProvider; | ||
} | ||
|
||
public TemplateTopologicalOrderIterator getTemplateTopologicalOrderIterator() { | ||
return templateTopologicalOrderIterator; | ||
} | ||
|
||
public void setTemplateTopologicalOrderIterator( | ||
TemplateTopologicalOrderIterator templateTopologicalOrderIterator) { | ||
this.templateTopologicalOrderIterator = templateTopologicalOrderIterator; | ||
} | ||
|
||
public Map<String, IndigoJob> getChronosJobGraph() { | ||
return chronosJobGraph; | ||
} | ||
|
||
public void setChronosJobGraph(Map<String, IndigoJob> chronosJobGraph) { | ||
this.chronosJobGraph = chronosJobGraph; | ||
} | ||
|
||
public boolean isCreateComplete() { | ||
return createComplete; | ||
} | ||
|
||
public void setCreateComplete(boolean createComplete) { | ||
this.createComplete = createComplete; | ||
} | ||
|
||
public boolean isDeleteComplete() { | ||
return deleteComplete; | ||
} | ||
|
||
public void setDeleteComplete(boolean deleteComplete) { | ||
this.deleteComplete = deleteComplete; | ||
} | ||
|
||
public boolean isPollComplete() { | ||
return pollComplete; | ||
} | ||
|
||
public void setPollComplete(boolean pollComplete) { | ||
this.pollComplete = pollComplete; | ||
} | ||
|
||
public boolean isSkipPollInterval() { | ||
return skipPollInterval; | ||
} | ||
|
||
public void setSkipPollInterval(boolean skipPollInterval) { | ||
this.skipPollInterval = skipPollInterval; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "DeploymentMessage [deploymentId=" + deploymentId + ", deploymentProvider=" | ||
+ deploymentProvider + ", templateTopologicalOrderIterator=" | ||
+ templateTopologicalOrderIterator + ", createComplete=" + createComplete | ||
+ ", pollComplete=" + pollComplete + "]"; | ||
} | ||
|
||
/** | ||
* Class to contain template's nodes in topological order and to allow to iterate on the list. | ||
* | ||
* @author l.biava | ||
* | ||
*/ | ||
public static class TemplateTopologicalOrderIterator implements Serializable { | ||
|
||
private static final long serialVersionUID = 1557615023166610397L; | ||
|
||
/** | ||
* Template's nodes, topologically ordered. | ||
*/ | ||
List<Resource> topologicalOrder; | ||
|
||
int position = 0; | ||
|
||
public TemplateTopologicalOrderIterator(List<Resource> topologicalOrder) { | ||
this.topologicalOrder = topologicalOrder; | ||
} | ||
|
||
public int getPosition() { | ||
return position; | ||
} | ||
|
||
public List<Resource> getTopologicalOrder() { | ||
return topologicalOrder; | ||
} | ||
|
||
public int getNodeSize() { | ||
return topologicalOrder.size(); | ||
} | ||
|
||
public synchronized boolean hasNext() { | ||
return topologicalOrder.size() - 1 > position; | ||
} | ||
|
||
/** | ||
* Get the node in the current position of the iterator. <br/> | ||
* <b>Note that the first time this method is called it returns the first element of the list, | ||
* or <tt>null</tt> if the list is empty</b> | ||
* | ||
* @return the current node, or <tt>null</tt> if the list is empty. | ||
*/ | ||
public synchronized Resource getCurrent() { | ||
if (position >= topologicalOrder.size()) { | ||
return null; | ||
} | ||
return topologicalOrder.get(position); | ||
} | ||
|
||
/** | ||
* Get the next element of the collection (after incrementing the position pointer). | ||
* | ||
* @return the next node, or <tt>null</tt> if there aren't any others. | ||
*/ | ||
public synchronized Resource getNext() { | ||
if (!hasNext()) { | ||
position++; | ||
return null; | ||
} | ||
position++; | ||
return topologicalOrder.get(position); | ||
} | ||
|
||
public synchronized void reset() { | ||
position = 0; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "TemplateTopologicalOrderStatus [topologicalOrder=" + topologicalOrder + ", position=" | ||
+ position + "]"; | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.