Classes | Public Member Functions | Public Attributes | List of all members
fabricate._Groups Class Reference
Inheritance diagram for fabricate._Groups:
object

Classes

class  value
 

Public Member Functions

def __init__ (self)
 
def item_list (self, id)
 
def remove (self, id)
 
def remove_item (self, id, val)
 
def add (self, id, val)
 
def ensure (self, id)
 
def get_count (self, id)
 
def dec_count (self, id)
 
def get_ok (self, id)
 
def set_ok (self, id, to)
 
def ids (self)
 
def inc_count_for_blocked (self, id)
 
def add_for_blocked (self, id, val)
 

Public Attributes

 groups
 
 lock
 
short int type
 
short int number
 
char name [SIZE_OF_OBJ_NAME]
 
cat_entry star
 

Detailed Description

Thread safe mapping object whose values are lists of _running
    or _after objects and a count of how many have *not* completed 

Definition at line 804 of file fabricate.py.

Constructor & Destructor Documentation

def fabricate._Groups.__init__ (   self)

Definition at line 820 of file fabricate.py.

Referenced by PandAna.core.core.spectrum.fill().

820  def __init__(self):
821  self.groups = {False: self.value()}
822  self.lock = threading.Lock()
823 
def __init__(self)
Definition: fabricate.py:820

Member Function Documentation

def fabricate._Groups.add (   self,
  id,
  val 
)

Definition at line 838 of file fabricate.py.

References fabricate._Groups.groups, and fabricate._Groups.lock.

838  def add(self, id, val):
839  with self.lock:
840  if id in self.groups:
841  self.groups[id].items.append(val)
842  else:
843  self.groups[id] = self.value(val)
844  self.groups[id].count += 1
845 
def add(self, id, val)
Definition: fabricate.py:838
def fabricate._Groups.add_for_blocked (   self,
  id,
  val 
)

Definition at line 886 of file fabricate.py.

References fabricate._Groups.groups, and fabricate._Groups.lock.

886  def add_for_blocked(self, id, val):
887  # modification of add(), in order to move command from False group
888  # to actual group
889  with self.lock:
890  # id must be registered before
891  self.groups[id].items.append(val)
892  # count does not change (already considered
893  # in inc_count_for_blocked), but decrease count_in_false.
894  c = self.groups[id].count_in_false - 1
895  if c < 0:
896  raise ValueError
897  self.groups[id].count_in_false = c
898 
899 
900 # pool of processes to run parallel jobs, must not be part of any object that
901 # is pickled for transfer to these processes, ie it must be global
def add_for_blocked(self, id, val)
Definition: fabricate.py:886
def fabricate._Groups.dec_count (   self,
  id 
)

Definition at line 858 of file fabricate.py.

References fabricate._Groups.groups, and fabricate._Groups.lock.

858  def dec_count(self, id):
859  with self.lock:
860  c = self.groups[id].count - 1
861  if c < 0:
862  raise ValueError
863  self.groups[id].count = c
864  return c
865 
def dec_count(self, id)
Definition: fabricate.py:858
def fabricate._Groups.ensure (   self,
  id 
)
if id does not exit, create it without any value

Definition at line 846 of file fabricate.py.

References fabricate._Groups.groups, and fabricate._Groups.lock.

846  def ensure(self, id):
847  """if id does not exit, create it without any value"""
848  with self.lock:
849  if not id in self.groups:
850  self.groups[id] = self.value()
851 
def ensure(self, id)
Definition: fabricate.py:846
def fabricate._Groups.get_count (   self,
  id 
)

Definition at line 852 of file fabricate.py.

References fabricate._Groups.groups, and fabricate._Groups.lock.

852  def get_count(self, id):
853  with self.lock:
854  if id not in self.groups:
855  return 0
856  return self.groups[id].count
857 
def get_count(self, id)
Definition: fabricate.py:852
def fabricate._Groups.get_ok (   self,
  id 
)

Definition at line 866 of file fabricate.py.

References fabricate._Groups.groups, and fabricate._Groups.lock.

866  def get_ok(self, id):
867  with self.lock:
868  return self.groups[id].ok
869 
def get_ok(self, id)
Definition: fabricate.py:866
def fabricate._Groups.ids (   self)

Definition at line 874 of file fabricate.py.

References fabricate._Groups.lock.

874  def ids(self):
875  with self.lock:
876  return self.groups.keys()
877 
def ids(self)
Definition: fabricate.py:874
def fabricate._Groups.inc_count_for_blocked (   self,
  id 
)

Definition at line 879 of file fabricate.py.

References fabricate._Groups.groups, and fabricate._Groups.lock.

879  def inc_count_for_blocked(self, id):
880  with self.lock:
881  if not id in self.groups:
882  self.groups[id] = self.value()
883  self.groups[id].count += 1
884  self.groups[id].count_in_false += 1
885 
def inc_count_for_blocked(self, id)
Definition: fabricate.py:879
def fabricate._Groups.item_list (   self,
  id 
)
Return copy of the value list 

Definition at line 824 of file fabricate.py.

References fabricate._Groups.groups, and fabricate._Groups.lock.

824  def item_list(self, id):
825  """ Return copy of the value list """
826  with self.lock:
827  return self.groups[id].items[:]
828 
def item_list(self, id)
Definition: fabricate.py:824
def fabricate._Groups.remove (   self,
  id 
)
Remove the group 

Definition at line 829 of file fabricate.py.

References fabricate._Groups.groups, and fabricate._Groups.lock.

829  def remove(self, id):
830  """ Remove the group """
831  with self.lock:
832  del self.groups[id]
833 
def remove(self, id)
Definition: fabricate.py:829
def fabricate._Groups.remove_item (   self,
  id,
  val 
)

Definition at line 834 of file fabricate.py.

References fabricate._Groups.groups, and fabricate._Groups.lock.

834  def remove_item(self, id, val):
835  with self.lock:
836  self.groups[id].items.remove(val)
837 
def remove_item(self, id, val)
Definition: fabricate.py:834
def fabricate._Groups.set_ok (   self,
  id,
  to 
)

Definition at line 870 of file fabricate.py.

References fabricate._Groups.groups, and fabricate._Groups.lock.

870  def set_ok(self, id, to):
871  with self.lock:
872  self.groups[id].ok = to
873 
def set_ok(self, id, to)
Definition: fabricate.py:870

Member Data Documentation

fabricate._Groups.groups
fabricate._Groups.lock
char object::name
inherited
short int object::number
inherited

Definition at line 115 of file novas.h.

cat_entry object::star
inherited

Definition at line 117 of file novas.h.

short int object::type
inherited

Definition at line 114 of file novas.h.


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