def test_mof_scheduler_first_assign(example_agents, example_pending_sessions, example_existing_sessions): scheduler = MOFScheduler({}) picked_session_id = scheduler.pick_session(example_total_capacity, example_pending_sessions, example_existing_sessions) assert picked_session_id == example_pending_sessions[0].kernel_id picked_session = _find_and_pop_picked_session(example_pending_sessions, picked_session_id) agent_id = scheduler.assign_agent(example_agents, picked_session) assert agent_id == 'i-001'
def test_mof_scheduler_no_valid_agent(example_agents_no_valid, example_pending_sessions, example_existing_sessions): scheduler = MOFScheduler({}) picked_session_id = scheduler.pick_session( example_total_capacity, example_pending_sessions, example_existing_sessions) assert picked_session_id == example_pending_sessions[0].session_id picked_session = _find_and_pop_picked_session( example_pending_sessions, picked_session_id) agent_id = scheduler.assign_agent_for_session(example_agents_no_valid, picked_session) assert agent_id is None