tassl.workflow.resources
Class ResourceCloud

java.lang.Object
  extended by tassl.workflow.resources.Resource
      extended by tassl.workflow.resources.ResourceCloud
All Implemented Interfaces:
java.io.Serializable

public class ResourceCloud
extends Resource

See Also:
Serialized Form

Field Summary
 
Fields inherited from class tassl.workflow.resources.Resource
identifier, keyfile, nodeList, softwareDirWorker, supportedApps, userWorker, wflNode, workerBasePropertyFile, workingDir, zone
 
Constructor Summary
ResourceCloud()
           
 
Method Summary
 java.util.List allocateStage(java.lang.String wflId, java.lang.String stageId, java.util.List<java.lang.String> MachineWorkers, java.lang.String properties)
          Allocate N workers to a specific stage.
 boolean checkAllocatePossibleStage(int numWorkers, java.lang.String properties)
          Check if the stage can be allocated in this resource
 void deactivateVM(java.lang.String ipVM)
           
 java.util.List deployVMs(java.lang.String wflId, java.lang.String stageId, java.util.List nodePortList, java.lang.String appname, java.lang.Object synresource)
          Deploy N VMs of type type
 void disableSite()
          Disable a site by setting all resources to 0 and terminate currently running workers/VMs.
 java.util.List<NodeAcct> generateAccountingInfo(java.lang.String wflId, java.lang.String stageId, long timestamp, java.util.List<NodeAcct> currentNodeAcct)
          Generate the accounting information of a stage.
 java.util.List getAvailableSlotsScheduling(java.lang.String siteAddress, java.lang.String[] allocatedWorkers)
          It creates the list of available slots for scheduling considering the workers per machine and the number of available machines.
 java.lang.String getCloudScript()
           
 java.lang.String getDefaultImageId()
           
 java.lang.String getImageId(java.lang.String app)
          Get the imageId of the custom VM image of an Application
 java.lang.String getProviderConfigFile()
           
 java.lang.String getProviderType()
           
 java.lang.String getRegion()
           
 java.lang.String getTypebyIp(java.lang.String ipVM)
          Return the type of VM that corresponds to the ip or null if not found
 java.util.List getVMAddressbyType(java.lang.String workflowId, java.lang.String stageId, java.util.List<java.lang.String> vmTypes)
          Return list of addresses corresponding with VMs from those allocated to the specific stage
 java.util.HashMap<java.lang.String,java.lang.Integer> getVMLimits()
           
 boolean isActive(java.lang.String ipVM)
          Check if the node corresponding to this IP is active.
 boolean isStatusActive(java.lang.String ipVM)
          Check if the machine is in active status in the records.
 boolean loadConfig(java.lang.String file)
           
 int numberWorkersinVM(java.lang.String workflowId, java.lang.String stageId, java.lang.String ip)
          Return the number of workers running in the under the same IP
 void printVMactive()
           
 void printWflNode()
           
 java.util.List releaseSomeWorkers(java.lang.String workflowId, java.lang.String stageId, java.util.List workers)
          Release SOME workers allocated to the specific workflow stage
 java.util.List releaseSomeWorkersbyMachineIp(java.lang.String workflowId, java.lang.String stageId, java.util.List machineIps)
          Release all workers of the selected machines
 java.util.List releaseWorkers(java.lang.String workflowId, java.lang.String stageId)
          Remove stage from wflnode.
 void restoreSite()
          Restore a previously disabled site.
 void setCloudScript(java.lang.String cloudScript)
           
 void setDefaultImageId(java.lang.String imageId)
           
 void setProviderConfigFile(java.lang.String ProviderConfigFile)
           
 void setProviderType(java.lang.String ProviderType)
           
 void setRegion(java.lang.String region)
           
 void setVMLimits(java.util.HashMap<java.lang.String,java.lang.Integer> VMLimits)
           
 void terminateVMs(java.util.List VMIps)
          Terminate VM calling to the IP
 
Methods inherited from class tassl.workflow.resources.Resource
checkAllWorkerStatus, checkIfExistsNodeAcct, checkWorkerStatus, createWorkerProperties, getActiveResourcesWorkflow, getCandidateTunnelPort, getCostDataIn, getCostDataOut, getIdentifier, getKeyfile, getNodeList, getOverhead, getPortMapWorker, getSupportedApps, getUserWorker, getWflNode, getWflStageWorker, getWorkerBasePropertyFile, getWorkersWorkflowStage, getZone, loadConfig, releasePortMapWorker, releaseTunnelsWorker, setAgentSSHTunnelPortRange, setIdentifier, setKeyfile, setNodeList, setOverhead, setPorts, setStartSSHtunnelAgent, setStartSSHtunnels, setSupportedApps, setWorkerBasePropertyFile, startAgentToWorkerTunnel, startTunnelsWorker, startWorkers, string2HashMapDouble, string2HashMapInt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceCloud

public ResourceCloud()
Method Detail

disableSite

public void disableSite()
Description copied from class: Resource
Disable a site by setting all resources to 0 and terminate currently running workers/VMs. After this method, a different method should be called if immediate resource termination is expected

Specified by:
disableSite in class Resource

restoreSite

public void restoreSite()
Description copied from class: Resource
Restore a previously disabled site. After calling this method, the Central Resource Manager/Autonomic Scheduler should be notified

Specified by:
restoreSite in class Resource

getAvailableSlotsScheduling

public java.util.List getAvailableSlotsScheduling(java.lang.String siteAddress,
                                                  java.lang.String[] allocatedWorkers)
Description copied from class: Resource
It creates the list of available slots for scheduling considering the workers per machine and the number of available machines. It includes the allocated slots if any

Specified by:
getAvailableSlotsScheduling in class Resource
Parameters:
siteAddress - address:port of the site to be identified later
allocatedWorkers - machine/vmtype:numWorkers
Returns:
list of WorkerForScheduler objects

loadConfig

public boolean loadConfig(java.lang.String file)

getProviderType

public java.lang.String getProviderType()

getProviderConfigFile

public java.lang.String getProviderConfigFile()

getDefaultImageId

public java.lang.String getDefaultImageId()

getImageId

public java.lang.String getImageId(java.lang.String app)
Get the imageId of the custom VM image of an Application

Parameters:
app -
Returns:
imageId

getRegion

public java.lang.String getRegion()

getCloudScript

public java.lang.String getCloudScript()

getVMLimits

public java.util.HashMap<java.lang.String,java.lang.Integer> getVMLimits()

setProviderType

public void setProviderType(java.lang.String ProviderType)

setProviderConfigFile

public void setProviderConfigFile(java.lang.String ProviderConfigFile)

setVMLimits

public void setVMLimits(java.util.HashMap<java.lang.String,java.lang.Integer> VMLimits)

setDefaultImageId

public void setDefaultImageId(java.lang.String imageId)

setRegion

public void setRegion(java.lang.String region)

setCloudScript

public void setCloudScript(java.lang.String cloudScript)

releaseWorkers

public java.util.List releaseWorkers(java.lang.String workflowId,
                                     java.lang.String stageId)
Remove stage from wflnode. Assumption: We release all workers of a VM because we do not share VM across stages

Specified by:
releaseWorkers in class Resource
Parameters:
workflowId -
stageId -
Returns:
List of Workers to terminate them later

deactivateVM

public void deactivateVM(java.lang.String ipVM)

getTypebyIp

public java.lang.String getTypebyIp(java.lang.String ipVM)
Return the type of VM that corresponds to the ip or null if not found

Parameters:
ipVM -
Returns:

getVMAddressbyType

public java.util.List getVMAddressbyType(java.lang.String workflowId,
                                         java.lang.String stageId,
                                         java.util.List<java.lang.String> vmTypes)
Return list of addresses corresponding with VMs from those allocated to the specific stage

Parameters:
workflowId -
stageId -
vmTypes -
Returns:
List of ips

releaseSomeWorkers

public java.util.List releaseSomeWorkers(java.lang.String workflowId,
                                         java.lang.String stageId,
                                         java.util.List workers)
Description copied from class: Resource
Release SOME workers allocated to the specific workflow stage

Specified by:
releaseSomeWorkers in class Resource
Returns:
List of VM types (cloud) or list of machine ips(cluster) corresponding with the workers

releaseSomeWorkersbyMachineIp

public java.util.List releaseSomeWorkersbyMachineIp(java.lang.String workflowId,
                                                    java.lang.String stageId,
                                                    java.util.List machineIps)
Release all workers of the selected machines

Specified by:
releaseSomeWorkersbyMachineIp in class Resource
Parameters:
workflowId -
stageId -
machineIps -
Returns:
List of workers {address:port,address:port,...}

numberWorkersinVM

public int numberWorkersinVM(java.lang.String workflowId,
                             java.lang.String stageId,
                             java.lang.String ip)
Return the number of workers running in the under the same IP

Parameters:
workflowId -
stageId -
ip -
Returns:
number of workers

checkAllocatePossibleStage

public boolean checkAllocatePossibleStage(int numWorkers,
                                          java.lang.String properties)
Description copied from class: Resource
Check if the stage can be allocated in this resource

Specified by:
checkAllocatePossibleStage in class Resource
properties - This can be the type of VM we want, the min performance of a machine, etc..
Returns:

allocateStage

public java.util.List allocateStage(java.lang.String wflId,
                                    java.lang.String stageId,
                                    java.util.List<java.lang.String> MachineWorkers,
                                    java.lang.String properties)
Description copied from class: Resource
Allocate N workers to a specific stage. We can select the type of VM we want with properties Call allocateStage from AgentResourceManager and get the list of node:port

Specified by:
allocateStage in class Resource
properties - This defines the type of allocation "random" or "exact" as the list of MachineWorkers says
Returns:
list of workers to be started

printVMactive

public void printVMactive()

printWflNode

public void printWflNode()

deployVMs

public java.util.List deployVMs(java.lang.String wflId,
                                java.lang.String stageId,
                                java.util.List nodePortList,
                                java.lang.String appname,
                                java.lang.Object synresource)
Deploy N VMs of type type

Parameters:
wflId -
stageId -
nodePortList - i.e. m1.small:7777,m1.medium:7777 7778 (deploy two VMs)
appname -
Returns:
List of ips i.e. ip:7777,ip:7777,ip:7778

terminateVMs

public void terminateVMs(java.util.List VMIps)
Terminate VM calling to the IP

Parameters:
VMIps -

isStatusActive

public boolean isStatusActive(java.lang.String ipVM)
Description copied from class: Resource
Check if the machine is in active status in the records.

Specified by:
isStatusActive in class Resource
Returns:

isActive

public boolean isActive(java.lang.String ipVM)
Description copied from class: Resource
Check if the node corresponding to this IP is active. It first checks the records and then the real status using ssh.

Specified by:
isActive in class Resource
Returns:

generateAccountingInfo

public java.util.List<NodeAcct> generateAccountingInfo(java.lang.String wflId,
                                                       java.lang.String stageId,
                                                       long timestamp,
                                                       java.util.List<NodeAcct> currentNodeAcct)
Description copied from class: Resource
Generate the accounting information of a stage. It returns only the new information that is not already in the accounting. This info is related to when the machines are provisioned and it will be deleted when they are released.

Specified by:
generateAccountingInfo in class Resource
timestamp - time when the machine is provisioned
currentNodeAcct - this is the accounting info before the new workers are assigned.
Returns:
List of provisioned machines