GridComputing
Job Management in Grid Computing
|
Generic IMachine class. More...
#include <machine.h>
Public Types | |
typedef std::set< Job *, IdLess< Job > > | JobSet |
Public Member Functions | |
IMachine (uint id) | |
"Search Constructor" | |
IMachine (const std::string &machineName, uint maxJobs, double totalRAM, double totalDiskSpace) | |
Constructor. | |
~IMachine () | |
Destructor. | |
const std::string & | GetName () const |
Returns the name of the Machine. | |
void | SetName (const std::string &name) |
Updates the name of the Machine. | |
uint | GetMaxJobs () const |
Returns the number limit of Jobs. | |
void | SetMaxJobs (uint val) |
Updates the number limit of Jobs. | |
double | GetAvailableRAM () const |
Calculates the RAM that is not being used (MB) | |
double | GetInUseRAM () const |
Calculates the RAM that is being used (MB) | |
double | GetTotalRAM () const |
Returns the total amount of RAM (MB) | |
void | SetTotalRAM (double val) |
Updates the total amount of RAM (MB) | |
double | GetAvailableDiskSpace () const |
Calculated the disk space that is not being used (MB) | |
double | GetInUseDiskSpace () const |
Calculated the disk space that is being used (MB) | |
double | GetTotalDiskSpace () const |
Returns the total amount of disk space (MB) | |
void | SetTotalDiskSpace (double val) |
Updates the total amount of disk space (MB) | |
uint | GetId () const |
Returns the identifier of this Machine. | |
void | SetId (uint id) |
Updates the identifier of this Machine. | |
void | AddAvailableSoftware (const Software &sw) |
Adds a Software to the list of available Software. | |
void | RemoveAvailableSoftware (const Software &sw) |
Deletes a Software from the list of available Software. | |
const SoftwareSet & | GetAvailableSoftware () const |
Returns the SoftwareSet of this Machine. | |
JobVector | GetJobs () const |
Returns a Vector of constant Jobs. | |
bool | AddJob (Job *job) |
Adds a Job to this Machine. Fails if Job requirements are not supported by this Machine. | |
const Job * | GetJob (uint id) const |
bool | RemoveJob (uint id) |
void | RemoveAllJobs () |
Removes all Jobs from this Machine. | |
bool | ChangeJobPriority (uint id, uint8 newPriority) |
Changes job with the given id priority. | |
uint | GetNumberOfCurrentJobs () const |
Returns the number of Jobs being executed. | |
bool | Save (ByteBuffer &bb) const override |
Saves the Machine data to a ByteBuffer. | |
void | Update (uint diff) override |
Updates executing Jobs timers and removes expired ones. | |
void | Print (std::ostream &os=std::cout) const override |
Prints current machine information. | |
Static Public Member Functions | |
static void | PrintHeader (std::ostream &os=std::cout) |
Prints table header for machines. | |
static Menu * | GetMenu () |
Returns the menu associated with Machine. | |
static IMachine< Container > * | Load (ByteBuffer &bb) |
Loads a Machine from the given ByteBuffer. | |
Static Public Member Functions inherited from _Machine | |
static uint | GetLastJobId () |
static void | SetLastJobId (uint val) |
Protected Member Functions | |
bool | SoftwareMeetsRequirements (const Software &sw) const |
Returns true if the given Software is available in the Machine. | |
Protected Member Functions inherited from _Machine | |
_Machine () | |
Protected Attributes | |
double | _totalRAM |
Total RAM (MB) | |
double | _inUseRAM |
double | _totalDiskSpace |
Total disk space (MB) | |
double | _inUseDiskSpace |
uint | _maxJobs |
Max number of Jobs that can be executed. | |
SoftwareSet | _availableSoftware |
The available set of Software. | |
std::string | _name |
Machine name. | |
uint | _id |
Machine identifier. | |
std::mutex | _mutex |
Mutex (multithread safe way to change Jobs) | |
Container | _currentJobs |
Static Protected Attributes | |
static Menu * | _menu = Loader<Menu>("machineMenu.txt").Load() |
Menu associated with the Machine class. | |
static uint | _maxNameLength = 0 |
The length of the biggest Machine name. | |
Static Protected Attributes inherited from _Machine | |
static uint | _lastJobId = 1 |
The Id of the last job used. | |
Private Member Functions | |
IMachine (const IMachine &) | |
IMachine & | operator= (IMachine const &) |
Generic IMachine class.
This class is templated on the Container so we can have different containers for the Job* of our Machines. It is derivated of the _Machine class so the ids of the jobs are sequetential and unique in all aplication.
IMachine< Container >::IMachine | ( | const std::string & | machineName, |
uint | maxJobs, | ||
double | totalRAM, | ||
double | totalDiskSpace | ||
) |
Constructor.
bool IMachine< Container >::ChangeJobPriority | ( | uint | id, |
uint8 | newPriority | ||
) |
Changes job with the given id priority.
double IMachine< Container >::GetAvailableDiskSpace | ( | ) | const |
Calculated the disk space that is not being used (MB)
double IMachine< Container >::GetAvailableRAM | ( | ) | const |
Calculates the RAM that is not being used (MB)
const SoftwareSet& IMachine< Container >::GetAvailableSoftware | ( | ) | const |
Returns the SoftwareSet of this Machine.
Returns the identifier of this Machine.
double IMachine< Container >::GetInUseDiskSpace | ( | ) | const |
Calculated the disk space that is being used (MB)
double IMachine< Container >::GetInUseRAM | ( | ) | const |
Calculates the RAM that is being used (MB)
Returns a Vector of constant Jobs.
Returns the number limit of Jobs.
Returns the menu associated with Machine.
const std::string& IMachine< Container >::GetName | ( | ) | const |
Returns the name of the Machine.
Returns the number of Jobs being executed.
double IMachine< Container >::GetTotalDiskSpace | ( | ) | const |
Returns the total amount of disk space (MB)
double IMachine< Container >::GetTotalRAM | ( | ) | const |
Returns the total amount of RAM (MB)
|
static |
Loads a Machine from the given ByteBuffer.
|
private |
|
overridevirtual |
Prints current machine information.
Implements IPrint.
|
static |
Prints table header for machines.
void IMachine< Container >::RemoveAllJobs | ( | ) |
Removes all Jobs from this Machine.
|
overridevirtual |
Saves the Machine data to a ByteBuffer.
Implements ISave.
Updates the identifier of this Machine.
Updates the number limit of Jobs.
void IMachine< Container >::SetName | ( | const std::string & | name | ) |
Updates the name of the Machine.
void IMachine< Container >::SetTotalDiskSpace | ( | double | val | ) |
Updates the total amount of disk space (MB)
val | Updates the total amount of disk space (MB) |
void IMachine< Container >::SetTotalRAM | ( | double | val | ) |
Updates the total amount of RAM (MB)
val | Updates the total amount of RAM (MB) |
|
protected |
Returns true if the given Software is available in the Machine.
Updates executing Jobs timers and removes expired ones.
Implements IUpdate.
|
protected |
The available set of Software.
|
protected |
|
protected |
|
protected |
Max number of Jobs that can be executed.
The length of the biggest Machine name.
|
staticprotected |
Menu associated with the Machine class.
|
mutableprotected |
Mutex (multithread safe way to change Jobs)
|
protected |
Machine name.
|
protected |
Total disk space (MB)
|
protected |
Total RAM (MB)