def __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.COMP_QUEUE_MANAGER) self.jobs = JobDict(self.COMP_QUEUE_MANAGER) self.started_jobs = {} self.sync_state = Cobalt.Util.FailureMode("Foreign Data Sync") self.get_current_time = time.time self.lock = threading.Lock() self.statistics = Statistics() 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']
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()
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
def test_next(self, max=100): generator = IncrID() for count in itertools.count(1): assert generator.next() == count if count >= max: break
def __init__(self): DataDict.__init__(self) self.id_gen = IncrID()
import Cobalt.Util from Cobalt.Components.bgq_cn_boot_states import BootPending, BootInitiating, BootRebooting, BootComplete, BootFailed from Cobalt.Components.bgq_io_boot_states import IOBootPending, IOBootInitiating, IOBootComplete, IOBootFailed from Cobalt.Data import IncrID from Cobalt.Util import get_config_option #FIXME: also make this handle cleanup import Cobalt.Logging _logger = logging.getLogger() Cobalt.Util.init_cobalt_config() _boot_id_gen = IncrID() class BootContext(object): '''Context for ongonig boot. This should include any resources specific to that individual boot. A pointer to one of these objects is passed to the boot state for processing. ''' def __init__(self, block, job_id, user, block_lock, subblock_parent=None, timeout=None): self.block = block self.block_id = self.block.name self.job_id = job_id self.user = user self.block_lock = block_lock if subblock_parent == None: self.subblock_parent = self.block.name
def __init__(self): self.id_gen = IncrID()