def test_create_and_check_for_request_rest(self): """ Request (REST): Test the creation, query, and deletion of a Request """ host = get_rest_host() properties = { 'scope': 'test_scope', 'name': 'test_name_%s' % str(uuid()), 'data_type': 'DATASET', 'granularity_type': 'FILE', 'granularity_level': 1, 'priority': 99, 'edge_id': None, 'status': 'NEW', 'request_meta': { 'taskid': 975, 'job_id': 864 }, 'processing_meta': None, 'errors': None, } client = Client(host=host) request_id = client.add_request(**properties) request = client.get_request(request_id=request_id) assert_equal(request_id, request['request_id']) assert_equal(request['scope'], properties['scope']) assert_equal(request['name'], properties['name']) assert_equal(str(request['data_type']), properties['data_type']) assert_equal(str(request['granularity_type']), properties['granularity_type']) assert_equal(request['granularity_level'], properties['granularity_level']) assert_equal(request['priority'], properties['priority']) assert_equal(request['edge_id'], properties['edge_id']) assert_equal(str(request['status']), properties['status']) # assert_equal(json.dumps(request['request_meta']), json.dumps(properties['request_meta'])) assert_equal(str(request['processing_meta']), str(properties['processing_meta'])) assert_equal(request['errors'], properties['errors']) client.update_request(request_id, status='ERROR') request = client.get_request(request_id=request_id) assert_equal(str(request['status']), 'ERROR') with assert_raises(exceptions.NoObject): client.get_request(request_id=GUID().generate_uuid()) client.delete_request(request_id) with assert_raises(exceptions.NoObject): client.get_request(request_id=request_id)
'granularity_level': 50, 'priority': 99, 'edge_id': None, 'status': 'NEW', 'request_meta': {'jeditaskid': 16986388, 'site': 'CERN'}, } """ properties = { 'scope': 'mc15_13TeV', 'name': 'EVNT.06402143._000021.pool.root.1', 'data_type': 'FILE', 'granularity_type': 'PARTIAL', 'granularity_level': 50, 'priority': 99, 'edge_id': None, 'status': 'NEW', 'request_meta': {'jeditaskid': 16986388, 'site': 'CERN'}, } """ client = Client(host='https://aipanda182.cern.ch:8443') try: request_id = client.add_request(**properties) except exceptions.DuplicatedObject as ex: print(ex) req = client.get_request(request_id=request_id) print req