gov.bnl.star.offline.scheduler.policy
Class FileAssignment

java.lang.Object
  extended by gov.bnl.star.offline.scheduler.policy.FileAssignment

public class FileAssignment
extends java.lang.Object


Constructor Summary
FileAssignment(int minFiles, int maxFiles)
          Create a new empty distribution, specifying the limits on how many files to assign to a single process
 
Method Summary
 void add(Location location, PhysicalFile file)
          Assigns the file to the location.
 void add(PhysicalFile file)
          Adds the file to the assignment, the host is used as location
 void addAll(FileAssignment assignment)
          Adds an entire FileAssignment to the present.
 void addAllPhysical(java.util.Collection col)
          Adds a list of files to the assignment.
 void addAllPhysical(Location location, java.util.Collection col)
          Adds a list of files to the specified location.
 int canAdd(Location location)
          Returns how many files can be assigned to the location without changing the number of processes.
 int canRemove(Location location)
          Returns how many files can be deassigned to the location without changing the number of processes.
 java.util.List getFiles(Location location)
          Returns a list of URL of the files assigned to that location (a location can be a set of nodes).
 java.util.List getFiles(Location location, int processIndex)
          Returns the list of files assigned to a particular process of one location.
 java.util.List getInvalidLocations()
          Returns the list of locations on which the files can't be divided in valid processes.
 java.util.Set getLocations()
          Returns the locations to which something was assigned.
 java.lang.String getReport()
          A full description of the current assignment, in a human readable form, contaning the number of files and processes for all the locations.
 java.lang.String getSummary()
          Returns a printable summary of the current assignment, stating the total number of locations, and the number of invalid locations.
 boolean isValid()
          True if the correct assignment can be divided into processes and dispatched correctly.
 boolean isValid(Location location)
          True if the files assigned to the location can be divided in to a valid process.
 int minProcs(Location location)
          Returns the minimum number of process to dispatch on the location to cover all the files.
 int needsLessFiles(Location location)
          Returns how many files are to be deassigned from the location to make the assignment valid.
 int needsMoreFiles(Location location)
          Returns how many are to be assigned to the location to make the assignment valid.
 void orderFiles(java.util.Comparator comp)
           
 void remove(Location location, PhysicalFile file)
          Removes the file from the location.
 void removeAllPhysical(Location location, java.util.Collection col)
          Removes a set of file a location.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileAssignment

public FileAssignment(int minFiles,
                      int maxFiles)
Create a new empty distribution, specifying the limits on how many files to assign to a single process

Parameters:
minFiles - minimum number of files to assign to a process
maxFiles - maximum number of files to assign to a process
Method Detail

isValid

public boolean isValid()
True if the correct assignment can be divided into processes and dispatched correctly.

Returns:
false if the filse on any location can't be divided correctly

isValid

public boolean isValid(Location location)
True if the files assigned to the location can be divided in to a valid process.

Parameters:
location - location to check
Returns:
false if the filse on the location can't be divided correctly

getInvalidLocations

public java.util.List getInvalidLocations()
Returns the list of locations on which the files can't be divided in valid processes.

Returns:
a list of Location objects

getSummary

public java.lang.String getSummary()
Returns a printable summary of the current assignment, stating the total number of locations, and the number of invalid locations.

Returns:
a short summary of the locations

getReport

public java.lang.String getReport()
A full description of the current assignment, in a human readable form, contaning the number of files and processes for all the locations.

Returns:
a full report of the file distribution

minProcs

public int minProcs(Location location)
Returns the minimum number of process to dispatch on the location to cover all the files. It is the number of files divided by maxFiles, rounded up to the next integer. This number might not satisfy the minFiles requirements.

Parameters:
location - the location in the assignment
Returns:
the number of processes on which the list will be split

needsMoreFiles

public int needsMoreFiles(Location location)
Returns how many are to be assigned to the location to make the assignment valid.

Parameters:
location - the location to check
Returns:
the number of files needed to meet the min requirement; 0 if the requirements are met

needsLessFiles

public int needsLessFiles(Location location)
Returns how many files are to be deassigned from the location to make the assignment valid.

Parameters:
location - the location to check
Returns:
the number of files to remove to meet the max files requirements; 0 if the requirements are met

canAdd

public int canAdd(Location location)
Returns how many files can be assigned to the location without changing the number of processes.

Parameters:
location - location to check
Returns:
max number of files that can be added

canRemove

public int canRemove(Location location)
Returns how many files can be deassigned to the location without changing the number of processes.

Parameters:
location - location to check
Returns:
max number of files that be removed

getLocations

public java.util.Set getLocations()
Returns the locations to which something was assigned.

Returns:
a Set of Location objects

getFiles

public java.util.List getFiles(Location location)
Returns a list of URL of the files assigned to that location (a location can be a set of nodes).

Parameters:
location - the location to check
Returns:
a List of URL objects

getFiles

public java.util.List getFiles(Location location,
                               int processIndex)
Returns the list of files assigned to a particular process of one location.

Parameters:
location - the location to check
processIndex - the process number
Returns:
a List of URL objects

add

public void add(PhysicalFile file)
Adds the file to the assignment, the host is used as location

Parameters:
file - the URL of the file

add

public void add(Location location,
                PhysicalFile file)
Assigns the file to the location.

Parameters:
location - the location to which to assign the file
file - the URL of the file

addAll

public void addAll(FileAssignment assignment)
Adds an entire FileAssignment to the present.

Parameters:
assignment - the assignment to add to this

addAllPhysical

public void addAllPhysical(java.util.Collection col)
Adds a list of files to the assignment.

Parameters:
col - a Collection of PhysicalFile objects

addAllPhysical

public void addAllPhysical(Location location,
                           java.util.Collection col)
Adds a list of files to the specified location.

Parameters:
location - the location to which to add to
col - a Collection of PhysicalFile objects

remove

public void remove(Location location,
                   PhysicalFile file)
Removes the file from the location.

Parameters:
location - the location from which to remove the file
file - the file to remove

removeAllPhysical

public void removeAllPhysical(Location location,
                              java.util.Collection col)
Removes a set of file a location.


orderFiles

public void orderFiles(java.util.Comparator comp)


Copyright © 2002-2004 STAR collaboration - Brookhaven National Laboratory. All Rights Reserved.