Package park :: Package core :: Module user :: Class Usage

Class Usage

source code


Resource management.

Resource management is based on domains. All jobs in the particular domain have the same privileges. Note that domain is explicitly separate from any concept of user so that we can separate privilege from identity. In systems with full user accounting, each user id may be a separate domain. In looser systems where users are not explicitly identified, the domain may be something like the IP address of the client.

By default all jobs compete for resources at an equal level with no limits on the number of jobs that can be requested.

Instance Methods
 
nice(self, points=1, cost=None)
Purchase or sell nice points.
source code
 
requested(self, cost=None)
Record the request.
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Static Methods
 
fetch(id)
Fetch a resource domain from the database.
source code
Class Variables
  id = ''
Unique id for the resource domain
  priority = 0
Priority for jobs in this domain
  credit = -1
Amount of credit remaining in this domain, or -1 if unlimited
  cpu_requested = 0
Number of CPU hours requested in this domain
  cpu_used = 0
Number of CPU hours used in this domain
  last_credit = 0
timestamp of last credit
Properties

Inherited from object: __class__

Method Details

nice(self, points=1, cost=None)

source code 

Purchase or sell nice points.

Users who let some jobs run at lower priority are rewarded by having other jobs run at higher priority. To avoid too much gaming of the system, the cost of the jobs must be estimated, based on number of cpu hours.

Raises ValueError if insufficient credit to raise the privilege.

requested(self, cost=None)

source code 

Record the request.

Note that no request will be denied at this point. By always allowing work to run we avoid under-utilizing the machine.