def test_rmgr_rp_get_resource_allocation_state(): res_dict = { 'resource': 'local.localhost', 'walltime': 10, 'cpus': 1, 'project': '' } config = {'sandbox_cleanup': False, 'db_cleanup': False} rmgr_id = ru.generate_id('test.%(item_counter)04d', ru.ID_CUSTOM) rmgr = RPRmgr(res_dict, sid=rmgr_id, rts_config=config) assert not rmgr.get_resource_allocation_state() rmgr._validate_resource_desc() rmgr._populate() rmgr._submit_resource_request() assert rmgr.get_resource_allocation_state() in [rp.PMGR_ACTIVE, rp.FAILED] rmgr._terminate_resource_request()
def test_rmgr_rp_get_resource_allocation_state(): res_dict = { 'resource': 'local.localhost', 'walltime': 40, 'cpus': 1, 'project': '' } os.environ['RADICAL_PILOT_DBURL'] = MLAB config = {"sandbox_cleanup": False, "db_cleanup": False} rmgr_id = ru.generate_id('test.%(item_counter)04d', ru.ID_CUSTOM) rmgr = RPRmgr(res_dict, sid=rmgr_id, rts_config=config) assert not rmgr.get_resource_allocation_state() rmgr._validate_resource_desc() rmgr._populate() rmgr._submit_resource_request() import radical.pilot as rp assert rmgr.get_resource_allocation_state() in [rp.PMGR_ACTIVE, rp.FAILED]
def test_tmgr_rp_initialization(): sid = ru.generate_id('test', ru.ID_UNIQUE) cfg = {"sandbox_cleanup": False, "db_cleanup" : False} rmq_conn_params = pika.ConnectionParameters(host=hostname, port=port) rmgr = RPRmgr({}, sid, cfg) tmgr = RPTmgr(sid=sid, pending_queue=['pending'], completed_queue=['completed'], rmgr=rmgr, rmq_conn_params=rmq_conn_params) assert 'task_manager' in tmgr._uid assert tmgr._pending_queue == ['pending'] assert tmgr._completed_queue == ['completed'] assert tmgr._rmq_conn_params == rmq_conn_params assert tmgr._rts == 'radical.pilot' assert tmgr._umgr is None assert tmgr._tmgr_process is None assert tmgr._hb_thread is None
def test_rmgr_rp_resource_request(): """ ***Purpose***: Test the submission and cancelation of a resource request. Check states that pilot starts and ends with. """ res_dict = { 'resource': 'local.localhost', 'walltime': 40, 'cpus': 1, 'project': '' } os.environ['RADICAL_PILOT_DBURL'] = MLAB os.environ['RP_ENABLE_OLD_DEFINES'] = 'True' config = {"sandbox_cleanup": False, "db_cleanup": False} rmgr_id = ru.generate_id('test.%(item_counter)04d', ru.ID_CUSTOM) rmgr = RPRmgr(res_dict, sid=rmgr_id, rts_config=config) rmgr._validate_resource_desc() rmgr._populate() rmgr._submit_resource_request() import radical.pilot as rp assert rmgr.get_resource_allocation_state() in [rp.PMGR_ACTIVE, rp.FAILED] rmgr._terminate_resource_request() # State transition seems to be taking some time. So sleep from time import sleep sleep(30) assert rmgr.get_resource_allocation_state() in [ rp.CANCELED, rp.FAILED, rp.DONE ]