Пример #1
0
   def __setstate__(self, state):
      Component.__setstate__(self, state)

      self.msg_queue = state['msg_queue']
      self.connected = False
      self.decoder = LogMessageDecoder()
      self.clearing_overflow = False
      self.overflow_filename = None
      self.overflow_file = None
      self.max_queued = int(get_cdbwriter_config('max_queued_msgs', '-1'))
                        
      if self.max_queued <= 0:
         logger.info("message queue set to unlimited.")
         self.max_queued = None
      else:
         self.overflow_filename = get_cdbwriter_config('overflow_file', None)

      if self.max_queued and (self.overflow_filename == None):
         logger.warning("No file given to catch maximum messages. Setting queue size to unlimited.")
         self.max_queued = None

      if state.has_key('overflow') and self.max_queued:
         self.overflow = state['overflow']
      else:
         self.overflow = False
Пример #2
0
 def __init__ (self, *args, **kwargs):
     """Initialize a new ServiceLocator.
     
     All arguments are passed to the component constructor.
     """
     Component.__init__(self, *args, **kwargs)
     self.services = ServiceDict()
Пример #3
0
    def __init__ (self, *args, **kwargs):
        Component.__init__(self, *args, **kwargs)
        self.process_groups = ProcessGroupDict()
        self.all_nodes = set()
        self.running_nodes = set()
        self.down_nodes = set()
        self.queue_assignments = {}
        self.node_order = {}
    
        try:
            self.configure(cluster_hostfile)
        except:
            self.logger.error("unable to load hostfile")
        
        self.queue_assignments["default"] = set(self.all_nodes)
        self.alloc_only_nodes = {} # nodename:starttime
        self.cleaning_processes = []
        #keep track of which jobs still have hosts being cleaned
        self.cleaning_host_count = {} # jobid:count
        self.locations_by_jobid = {} #jobid:[locations]
        self.jobid_to_user = {} #jobid:username
        
        self.alloc_timeout = int(get_cluster_system_config("allocation_timeout", 300))

        self.logger.info("allocation timeout set to %d seconds." % self.alloc_timeout)
Пример #4
0
 def __init__(self, *args, **kwargs):
     Component.__init__(self, *args, **kwargs)
     self.event_manager = ComponentProxy("event-manager")
     self.bqsim = ComponentProxy("queue-manager")
     self.powmon_logger = None
     self.total_cost = 0.0
     self.time_power_list =[{"unixtime":0, "power":0, "count":0, "utilization":0}]
Пример #5
0
    def __setstate__(self, state):
        Component.__setstate__(self, state)

        self.reservations = state['reservations']
        if 'active' in state:
            self.active = state['active']
        else:
            self.active = True
        
        self.id_gen = IncrID()
        self.id_gen.set(state['next_res_id'])
        global bgsched_id_gen
        bgsched_id_gen = self.id_gen
        
        self.cycle_id_gen = IncrID()
        self.cycle_id_gen.set(state['next_cycle_id'])
        global bgsched_cycle_id_gen
        bgsched_cycle_id_gen = self.cycle_id_gen

        self.queues = QueueDict()
        self.jobs = JobDict()
        self.started_jobs = {}
        self.sync_state = Cobalt.Util.FailureMode("Foreign Data Sync")
        
        self.get_current_time = time.time

        if state.has_key('msg_queue'):
            dbwriter.msg_queue = state['msg_queue']
        if state.has_key('overflow') and (dbwriter.max_queued != None):
            dbwriter.overflow = state['overflow']
Пример #6
0
 def __init__(self, *args, **kwargs):
     Component.__init__(self, *args, **kwargs)
     self.resources = ResourceDict()
     self.process_groups = ProcessGroupDict()
     self.process_groups.item_cls = BBProcessGroup
     self.queue_assignments = {}
     self.queue_assignments["default"] = sets.Set(self.resources)
Пример #7
0
 def __init__ (self, *args, **kwargs):
     """Initialize a new BaseForker.
     
     All arguments are passed to the component constructor.
     """
     Component.__init__(self, *args, **kwargs)
     self.children = {}
     self.id_gen = IncrID()
Пример #8
0
 def __init__ (self, *args, **kwargs):
     """Initialize a new ServiceLocator.
     
     All arguments are passed to the component constructor.
     """
     Component.__init__(self, *args, **kwargs)
     self.ignore = []
     self.lastwait = 0
     self.pgroups = ProcessGroupDict()
     self.zombie_mpi = {}
Пример #9
0
 def __init__(self, *args, **kwargs):
     Component.__init__(self, *args, **kwargs)
     self.COMP_QUEUE_MANAGER = "queue-manager"
     self.COMP_SYSTEM = "system"
     self.reservations = ReservationDict()
     self.queues = QueueDict(self.COMP_QUEUE_MANAGER)
     self.jobs = JobDict(self.COMP_QUEUE_MANAGER)
     self.started_jobs = {}
     self.sync_state = Cobalt.Util.FailureMode("Foreign Data Sync")
     self.active = True
     self.get_current_time = time.time
Пример #10
0
    def __init__(self, *args, **kwargs):

        Component.__init__(self, *args, **kwargs)
        self.event_list = [{"unixtime": 0}]
        self.time_stamp = 0

        self.finished = False

        self.bgsched = Sim_bg_Sched(**kwargs)
        self.csched = Sim_Cluster_Sched()
        self.go_next = True
Пример #11
0
 def __init__ (self, *args, **kwargs):
     Component.__init__(self, *args, **kwargs)
     self._partitions = PartitionDict()
     self._managed_partitions = set()
     self.process_groups = BGProcessGroupDict()
     self.node_card_cache = dict()
     self._partitions_lock = thread.allocate_lock()
     self.pending_diags = dict()
     self.failed_diags = list()
     self.bridge_in_error = False
     self.cached_partitions = None
     self.offline_partitions = []
Пример #12
0
 def __init__(self, *args, **kwargs):
     logger.debug(
         "heckle: System: init ... %s ... &&&&&&&&&&&&&&&&&&&&&&&&&&&&&  I am here as well &&&&&&&&&&&&&&&&&&&&&&&&&"
         % threading.current_thread().getName()
     )
     Component.__init__(self, *args, **kwargs)
     self.process_groups = ProcessGroupDict()
     self.process_groups.item_cls = HeckleProcessGroup
     self.resources = ResourceDict()
     self.queue_assignments["default"] = self.resources.keys()
     print "\n\n\n\n"
     print "Queue assignments are: %s" % self.queue_assignments
Пример #13
0
 def __init__(self, *args, **kwargs):
     
     Component.__init__(self, *args, **kwargs)
     self.event_list = [{'unixtime':0}]
     self.time_stamp = 0
     
     self.finished = False
             
     self.bgsched = Sim_bg_Sched(**kwargs)
     
     #inhibit coscheduling and cluster simulation feature before bgsched.py makes change
     #self.csched = Sim_Cluster_Sched()
     
     self.go_next = True
Пример #14
0
 def __init__ (self, *args, **kwargs):
     Component.__init__(self, *args, **kwargs)
     self.process_groups = ProcessGroupDict()
     self.pending_diags = dict()
     self.failed_diags = list()
     self.all_nodes = sets.Set()
     self.running_nodes = sets.Set()
     self.down_nodes = sets.Set()
     self.queue_assignments = {}
     self.node_order = {}
     try:
         self.configure(CP.get("cluster_system", "hostfile"))
     except:
         self.logger.error("unable to load hostfile")
     self.queue_assignments["default"] = sets.Set(self.all_nodes)
Пример #15
0
 def __init__(self, *args, **kwargs):
     
     Component.__init__(self, *args, **kwargs)
     self.event_list = [{'unixtime':0}]
     self.time_stamp = 0
     
     self.finished = False
             
     self.bgsched = Sim_bg_Sched(**kwargs)
     self.csched = Sim_Cluster_Sched()
     self.powermonitor = PowerMonitor()
     self.go_next = True
     
     # last scheduling time
     self.last_schedule_time = 0
Пример #16
0
 def __init__(self, *args, **kwargs):
     Component.__init__(self, *args, **kwargs)
     self.reservations = ReservationDict()
     self.queues = QueueDict()
     self.jobs = JobDict()
     self.started_jobs = {}
     self.sync_state = Cobalt.Util.FailureMode("Foreign Data Sync")
     self.active = True
 
     self.get_current_time = time.time
     self.id_gen = IncrID()
     global bgsched_id_gen
     bgsched_id_gen = self.id_gen
     
     self.cycle_id_gen = IncrID()
     global bgsched_cycle_id_gen
     bgsched_cycle_id_gen = self.cycle_id_gen
Пример #17
0
 def __getstate__(self):
     state = {}
     state.update(Component.__getstate__(self))
     state.update({
             'cdbwriter_version': 1,
             'msg_queue': self.msg_queue,
             'overflow': self.overflow})
     return state
Пример #18
0
 def __getstate__(self):
     state = {}
     state.update(Component.__getstate__(self))
     state.update({
             "cluster_base_version": 1, 
             "queue_assignments": self.queue_assignments,
             "down_nodes": self.down_nodes })
     return state
Пример #19
0
 def __getstate__(self):
     state = {}
     state.update(Component.__getstate__(self))
     state.update({
         'cdbwriter_version': 1,
         'msg_queue': self.msg_queue,
         'overflow': self.overflow
     })
     return state
Пример #20
0
    def __init__(self, *args, **kwargs):
        Component.__init__(self, *args, **kwargs)
        self.COMP_QUEUE_MANAGER = "queue-manager"
        self.COMP_SYSTEM = "system"
        self.reservations = ReservationDict()
        self.queues = QueueDict(self.COMP_QUEUE_MANAGER)
        self.jobs = JobDict(self.COMP_QUEUE_MANAGER)
        self.started_jobs = {}
        self.sync_state = Cobalt.Util.FailureMode("Foreign Data Sync")
        self.active = True

        self.get_current_time = time.time
        self.id_gen = IncrID()
        global bgsched_id_gen
        bgsched_id_gen = self.id_gen

        self.cycle_id_gen = IncrID()
        global bgsched_cycle_id_gen
        bgsched_cycle_id_gen = self.cycle_id_gen
Пример #21
0
 def __init__(self, *args, **kwargs):
     
     Component.__init__(self, *args, **kwargs)
     self.least_item = int(get_histm_config('least_item', 10))  # tunable
     self.lastDays = int(get_histm_config("last_days", 60))    # tunable
     self.jobinfo_file = get_histm_config("jobinfo_file", "jobinfo.hist")
     self.jobinfo_script = get_histm_config("jobinfo_script", "jobinfo.py")
     self.fraction = float(get_histm_config("fraction", 0.8))
     
     self.job_dict = {}   #historical job dictionary
     self.project_set = set([])  #distinct project names of historical jobs
     self.user_set = set([])     #distinct user names of historical jobs
     self.pair_set = set([])  #distinct (user, project) pair 
     
     self.Ap_dict_proj = {}  #dictionary of walltime adjusting parameters by project name
     self.Ap_dict_user = {}  #dictionary of walltime adjusting parameters by user name
     self.Ap_dict_paired = {} #dictionary of walltime adjusting parameters by double key (user, project)
     
     self.update_Ap_Dict()
Пример #22
0
 def __init__(self, *args, **kwargs):
     
     Component.__init__(self, *args, **kwargs)
     self.least_item = int(get_histm_config('least_item', 10))  # tunable
     self.lastDays = int(get_histm_config("last_days", 60))    # tunable
     self.jobinfo_file = get_histm_config("jobinfo_file", "jobinfo.hist")
     self.jobinfo_script = get_histm_config("jobinfo_script", "jobinfo.py")
     self.fraction = float(get_histm_config("fraction", 0.8))
     self.minimum_ap = float(get_histm_config("minimum_ap", 0.5))
     
     self.job_dict = {}   #historical job dictionary
     self.project_set = set([])  #distinct project names of historical jobs
     self.user_set = set([])     #distinct user names of historical jobs
     self.pair_set = set([])  #distinct (user, project) pair 
     
     self.Ap_dict_proj = {}  #dictionary of walltime adjusting parameters by project name
     self.Ap_dict_user = {}  #dictionary of walltime adjusting parameters by user name
     self.Ap_dict_paired = {} #dictionary of walltime adjusting parameters by double key (user, project)
     
     self.update_Ap_Dict()
Пример #23
0
 def __getstate__(self):
     state = {}
     state.update(Component.__getstate__(self))
     state.update({
             'sched_version':1,
             'reservations':self.reservations,
             'active':self.active,
             'next_res_id':self.id_gen.idnum+1, 
             'next_cycle_id':self.cycle_id_gen.idnum+1, 
             'msg_queue': dbwriter.msg_queue, 
             'overflow': dbwriter.overflow})
     return state
Пример #24
0
   def __init__(self, *args, **kwargs):
      Component.__init__(self, *args, **kwargs)
      self.sync_state = Cobalt.Util.FailureMode("Foreign Data Sync")
      self.connected = False
      self.msg_queue = []
      self.decoder = LogMessageDecoder()

      self.overflow = False
      self.overflow_filename = None
      self.overflow_file = None
      self.clearing_overflow = False
      
      self.max_queued = int(get_cdbwriter_config('max_queued_msgs', '-1'))
                        
      if self.max_queued <= 0:
         logger.info("message queue set to unlimited.")
         self.max_queued = None
         self.overflow_filename = get_cdbwriter_config('overflow_file', None)
         
      if self.overflow_filename == None:
         logger.warning("No file given to catch maximum messages. Setting queue size to unlimited.")
         self.max_queued = None
Пример #25
0
 def __getstate__(self):
     state = {}
     state.update(Component.__getstate__(self))
     state.update({
         'sched_version': 1,
         'reservations': self.reservations,
         'active': self.active,
         'next_res_id': self.id_gen.idnum + 1,
         'next_cycle_id': self.cycle_id_gen.idnum + 1,
         'msg_queue': dbwriter.msg_queue,
         'overflow': dbwriter.overflow
     })
     return state
Пример #26
0
    def __setstate__(self, state):
        Component.__setstate__(self, state)

        self.queue_assignments = state["queue_assignments"]
        self.down_nodes = state["down_nodes"]

        self.process_groups = ProcessGroupDict()
        self.all_nodes = set()
        self.running_nodes = set()
        self.node_order = {}
        try:
            self.configure(cluster_hostfile)
        except:
            self.logger.error("unable to load hostfile")
        self.alloc_only_nodes = {} # nodename:starttime
        if not state.has_key("cleaning_processes"):
            self.cleaning_processes = []
        self.cleaning_host_count = {} # jobid:count
        self.locations_by_jobid = {} #jobid:[locations]
        self.jobid_to_user = {} #jobid:username

        self.alloc_timeout = int(get_cluster_system_config("allocation_timeout", 300))
        self.logger.info("allocation timeout set to %d seconds." % self.alloc_timeout)
    def __init__(self, *args, **kwargs):

        Component.__init__(self, *args, **kwargs)
        self.event_list = [{'unixtime': 0}]
        self.time_stamp = 0

        self.finished = False

        ###
        # samnickolay
        self.jobs_queue_time_utilizations = {}
        self.utilization_records = []
        self.next_slowdown_threshold_time_step = None
        self.high_priority_nodes = 0
        self.low_priority_nodes = 0
        # samnickolay
        ###

        # dwang:
        print("[dw_evsim] simu_name: %s. " % kwargs.get("name"))
        print("[dw_evsim] simu_times: %d. " % kwargs.get("times"))
        print("[dw_evsim] checkpoint: %s. " % kwargs.get("checkpoint"))
        #
        print("[dw_evsim] checkp_dsize: %s. " % kwargs.get("checkp_dsize"))
        print("[dw_evsim] checkp_bw_write: %s. " %
              kwargs.get("checkp_w_bandwidth"))
        print("[dw_evsim] checkp_bw_read: %s. " %
              kwargs.get("checkp_r_bandwidth"))
        print("[dw_evsim] checkp_interval: %s. " %
              kwargs.get("checkp_t_internval"))
        # dwang
        self.bgsched = Sim_bg_Sched(**kwargs)
        #self.csched = Sim_Cluster_Sched()

        self.mmon = metricmon()

        self.go_next = True
Пример #28
0
    def save_me(self):
        '''Automatic method for saving off the component statefile

        '''
        Component.save(self)
Пример #29
0
 def __setstate__(self, state):
     Component.__setstate__(self, state)
Пример #30
0
 def save_me(self):
     '''Automatically write statefiles.'''
     Component.save(self)
Пример #31
0
 def __getstate__(self):
     state = {}
     state.update(Component.__getstate__(self))
     state.update({
             'slp_version': 1})
     return state
Пример #32
0
 def __init__(self, *args, **kwargs):
     Component.__init__(self, *args, **kwargs)
     self.event_manager = ComponentProxy("event-manager")
     self.bqsim = ComponentProxy("queue-manager")
     self.powmon_logger = None
Пример #33
0
import os
import socket
import threading
import xmlrpclib

import Cobalt.Server
from Cobalt.Server import find_intended_location, XMLRPCServer
from Cobalt.Components.base import Component

c = Component()

class TestFindIntendedLocation (object):
    
    def setup (self):
        assert not os.path.exists("testfile")
    
    def teardown (self):
        try:
            os.remove("testfile")
        except OSError:
            assert not os.path.exists("testfile")
    
    def test_nofile (self):
        component = Component()
        location = find_intended_location(component, config_files=["testfile"])
        assert location == ("", 0)
    
    def test_file_without_def (self):
        testfile = open("testfile", "w")
        print >> testfile, "[components]"
        print >> testfile, "someothercomponent=https://localhost:8080"
Пример #34
0
    def __init__(self, *args, **kwargs):

        Component.__init__(self, *args, **kwargs)
Пример #35
0
 def test_nofile (self):
     component = Component()
     location = find_intended_location(component, config_files=["testfile"])
     assert location == ("", 0)
Пример #36
0
 def __init__(self, *args, **kwargs):
     Component.__init__(self, *args, **kwargs)
     self.process_groups = ProcessGroupDict()
     self.process_groups.item_cls = HeckleProcessGroup
     self.queue_assignments["default"] = self.get_resources()
     self.hacky_forbidden_nodes = []   #This is a temporary fix for the forbidden nodes issue
Пример #37
0
 def __init__ (self, **kwargs):
     Component.__init__(self, **kwargs)
     self.jobs = JobDict()
Пример #38
0
    def save_me(self):
        '''Automatic method for saving off the component statefile

        '''
        Component.save(self)
Пример #39
0
 def __getstate__(self):
     state = {}
     state.update(Component.__getstate__(self))
     # state.update({
     #         "cluster_simulator_version": 1 }) 
     return state
Пример #40
0
    def __init__(self, *args, **kwargs):

        Component.__init__(self, *args, **kwargs)
        self.event_manager = ComponentProxy("event-manager")
        self.bqsim = ComponentProxy("queue-manager")
        self.mmon_logger = None
Пример #41
0
 def __getstate__(self):
     state = {}
     state.update(Component.__getstate__(self))
     # state.update({
     #         "cluster_simulator_version": 1 })
     return state
Пример #42
0
 def save_me(self):
     Component.save(self)
Пример #43
0
    def __init__ (self, *args, **kwargs):

        Component.__init__(self, *args, **kwargs)
        self.count = 0