Ignore:
Timestamp:
03/04/13 08:25:34 (12 years ago)
Author:
wojtekp
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • DCWoRMS/branches/coolemall/src/dcworms/schedframe/scheduling/Executable.java

    r885 r896  
    2525import schedframe.scheduling.tasks.AbstractProcessesGroup; 
    2626import schedframe.scheduling.tasks.Task; 
     27import schedframe.scheduling.tasks.phases.ResourceConsumption; 
    2728import schedframe.scheduling.tasks.phases.ResourceConsumptionProfile; 
    2829import schedframe.scheduling.tasks.requirements.ResourceParameterName; 
     
    3940         
    4041        protected int status;  
    41         protected double length; 
    4242        protected Map<ResourceParameterName, Object> specificResources; 
    4343         
     
    158158        } 
    159159 
    160         if (newStatus < DCWormsTags.CREATED || newStatus > DCWormsTags.FAILED_RESOURCE_UNAVAILABLE) { 
     160        if (newStatus < DCWormsTags.CREATED || newStatus > DCWormsTags.NEW_EXEC_PHASE) { 
    161161            throw new Exception("Executable.setStatuts() : Error - " + 
    162162                    "Invalid integer range for Execiutable status."); 
     
    204204                } 
    205205        } 
     206         
     207        if(status == DCWormsTags.NEW_EXEC_PHASE){ 
     208                if(prevStatus == DCWormsTags.INEXEC){ 
     209                        status = DCWormsTags.INEXEC; 
     210                        setCompletionPercentage(0); 
     211                        task.getResourceConsumptionProfile().setCurrentPhase(task.getResourceConsumptionProfile().getCurrentPhase() + 1); 
     212                         
     213                        DateTime currentDateTime = new DateTime(); 
     214                         
     215                        if(getUsedResources().getLast().getTimeStamp().getMillis() == currentDateTime.getMillis()){ 
     216                                return; 
     217                        } 
     218                        ResourceHistoryItem resHistItem = new ResourceHistoryItem(getUsedResources().getLast().getResourceUnits(), currentDateTime); 
     219                        addUsedResources(resHistItem); 
     220                } 
     221        } 
    206222        } 
    207223         
     
    209225                if(this.specificResources == null) 
    210226                        this.specificResources = new HashMap<ResourceParameterName, Object>(); 
    211                  
    212227                this.specificResources.put(resourceName, value); 
    213228        } 
     
    216231                if(this.specificResources == null) 
    217232                        return false; 
    218  
    219233                return this.specificResources.containsKey(resourceName); 
    220234        } 
     
    255269        } 
    256270         
    257     public void setSchedulerName(int resourceId) 
    258     { 
     271    public void setSchedulerName(int resourceId){ 
    259272        this.schedName = GridSim.getEntityName(resourceId); 
    260273    } 
    261274 
    262     public String getSchedulerName() 
    263     { 
     275    public String getSchedulerName(){ 
    264276        return schedName; 
    265277    } 
     
    368380        } 
    369381 
    370         private int currentPhase = 0; 
    371  
    372         public int getCurrentPhase() { 
    373                 return currentPhase; 
    374         } 
    375  
    376         public void setCurrentPhase(int currentPhase) { 
    377                 this.currentPhase = currentPhase; 
     382        public ResourceConsumption getCurrentResourceConsumption(){ 
     383                return task.getResourceConsumptionProfile().getCurrentResourceConsumption(); 
    378384        } 
    379385         
Note: See TracChangeset for help on using the changeset viewer.