cc1  v2.1
CC1 source code docs
 All Classes Namespaces Files Functions Variables Pages
src.cm.models.command.Command Class Reference

Classes

class  Meta

Public Member Functions

def __unicode__
def dict

Static Public Member Functions

def add_command
def execute
 Method executes command name on the specified VM.
def hello
 First function which must be called by VMs ctx module.
def name_to_farm
 Replaces farm name to "farm" word.
def register_head
 Head registration process:
def register_node
 Called from CLM when registering worker nodes of the farm.

Static Public Attributes

tuple args = models.CharField(max_length=100000)
tuple name = models.CharField(max_length=1000)
tuple response = models.CharField(max_length=100000, null=True)
tuple state = models.IntegerField()
tuple vm = models.ForeignKey(VM)

Detailed Description

Definition at line 38 of file command.py.

Member Function Documentation

def src.cm.models.command.Command.__unicode__ (   self)

Definition at line 48 of file command.py.

def src.cm.models.command.Command.add_command (   name,
  user_id,
  vm_id,
  kwargs 
)
static
Parameters
name(string) Command to add for machine vm_id
user_id(int)
vm_id(int)
kwargs(dict) key word args for the called function

Definition at line 78 of file command.py.

def src.cm.models.command.Command.dict (   self)
Returns
(dict) command's data
fields:

Definition at line 61 of file command.py.

def src.cm.models.command.Command.execute (   name,
  user_id,
  vm_id,
  kwargs 
)
static

Method executes command name on the specified VM.

User with id user_id must be the owner of that VM.

Parameters
name(string) name of the function to execute
user_id(long) id of the declared VM owner
vm_id(int) id of the VM on which command needs to be executed
kwargs(dict) keyword args for the called function
Exceptions
CMException('ctx_timeout')
CMException('ctx_execute_command')

Definition at line 103 of file command.py.

def src.cm.models.command.Command.hello (   vm_ip,
  args 
)
static

First function which must be called by VMs ctx module.

It registers VM with status 'running ctx', also serves a special role when creating farms (tracking head, and worker nodes)

Parameters
vm_ip(string)
args

Definition at line 161 of file command.py.

def src.cm.models.command.Command.name_to_farm (   farm_name,
  vm_name 
)
static

Replaces farm name to "farm" word.

Parameters
farm_name(string) farm name
vm_name(string) vm name

Definition at line 192 of file command.py.

def src.cm.models.command.Command.register_head (   vm)
static

Head registration process:

  • Creates ssh keys and sets their values for WN;
  • Inserts VMs into the database;
  • Then starts VMThreads which create actual machines.

Called when registering farms head.

Parameters
vm(VM) instance of the VM to be registered as head

Definition at line 232 of file command.py.

def src.cm.models.command.Command.register_node (   vm)
static

Called from CLM when registering worker nodes of the farm.

Parameters
vm(vm) VM database mapper

Definition at line 202 of file command.py.

Member Data Documentation

tuple src.cm.models.command.Command.args = models.CharField(max_length=100000)
static

Definition at line 40 of file command.py.

tuple src.cm.models.command.Command.name = models.CharField(max_length=1000)
static

Definition at line 39 of file command.py.

tuple src.cm.models.command.Command.response = models.CharField(max_length=100000, null=True)
static

Definition at line 42 of file command.py.

tuple src.cm.models.command.Command.state = models.IntegerField()
static

Definition at line 41 of file command.py.

tuple src.cm.models.command.Command.vm = models.ForeignKey(VM)
static

Definition at line 43 of file command.py.


The documentation for this class was generated from the following file: