def setUp(self): super(MasterTest, self).setUp() scheduler.DIMENSION_COUNT = 3 self.root = tempfile.mkdtemp() os.environ['TREADMILL_MASTER_ROOT'] = self.root self.master = master.Master(kazoo.client.KazooClient(), 'test-cell') # Use 111 to assert on zkhandle value. # Disable the exit on exception hack for tests self.old_exit_on_unhandled = treadmill.exc.exit_on_unhandled treadmill.exc.exit_on_unhandled = mock.Mock(side_effect=lambda x: x)
def _load(): """Load cell information.""" treadmill_sched.DIMENSION_COUNT = 3 cell_master = master.Master(context.GLOBAL.zk.conn, context.GLOBAL.cell) cell_master.load_buckets() cell_master.load_cell() cell_master.load_servers(readonly=True) cell_master.load_allocations() cell_master.load_strategies() cell_master.load_apps(readonly=True) cell_master.load_identity_groups() cell_master.load_placement_data() if do_reschedule: cell_master.cell.schedule() return cell_master
def scheduler(view, reschedule, csv): """Manage Treadmill server configuration.""" treadmill_sched.DIMENSION_COUNT = 3 cell_master = master.Master(context.GLOBAL.zk.conn, context.GLOBAL.cell) cell_master.load_buckets() cell_master.load_cell() cell_master.load_servers(readonly=True) cell_master.load_allocations() cell_master.load_strategies() cell_master.load_apps() if reschedule: cell_master.cell.schedule() output = None if view == 'servers': output = reports.servers(cell_master.cell) if view == 'features': output = reports.node_features(cell_master.cell) if view == 'allocs': allocs = reports.allocations(cell_master.cell) features = reports.allocation_features(cell_master.cell) # TODO: investigate why pd.concat returns series not df. # pylint: disable=R0204 output = pd.concat([allocs, features], axis=1) if view == 'apps': output = reports.apps(cell_master.cell) if view == 'util': apps = reports.apps(cell_master.cell) output = reports.utilization(None, apps) if output is not None and len(output): if csv: print output.to_csv() else: print output
def run(events_dir): """Run Treadmill master scheduler.""" scheduler.DIMENSION_COUNT = 3 cell_master = master.Master(context.GLOBAL.zk.conn, context.GLOBAL.cell, events_dir) cell_master.run()