tassl.workflow.resources
Class ResourceCluster

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

public class ResourceCluster
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
ResourceCluster()
           
 
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 disableMachine(java.lang.String ip)
          Disable Machine so it cannot be used.
 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.
 int getNumberActiveWorkers(java.lang.String ip)
           
 boolean isActive(java.lang.String ip)
          Check if the node corresponding to this IP is active.
 boolean isStatusActive(java.lang.String ip)
          Check if the machine is in active status in the records.
 boolean loadConfig(java.lang.String file)
           
 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)
          Free workers and remove the stage from wflNode
 void restoreSite()
          Restore a previously disabled site.
 
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

ResourceCluster

public ResourceCluster()
Method Detail

loadConfig

public boolean loadConfig(java.lang.String file)

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

releaseWorkers

public java.util.List releaseWorkers(java.lang.String workflowId,
                                     java.lang.String stageId)
Free workers and remove the stage from wflNode

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

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

getNumberActiveWorkers

public int getNumberActiveWorkers(java.lang.String ip)

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,...}

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

isStatusActive

public boolean isStatusActive(java.lang.String ip)
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 ip)
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:

disableMachine

public void disableMachine(java.lang.String ip)
Disable Machine so it cannot be used.

Parameters:
ip -

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

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