Beispiel #1
0
    def test_create_and_check_for_edge_rest(self):
        """ Edge (REST): Test the creation, query, and deletion of a Edge """
        host = get_rest_host()

        edge_name = 'test_edge_%s' % str(uuid())
        edge_name = edge_name[:29]
        properties = {
            'edge_type': 'EDGE',
            'status': 'ACTIVE',
            'is_independent': True,
            'continent': 'US',
            'country_name': 'US',
            'region_code': 'US',
            'city': 'Madison',
            'longitude': '111111',
            'latitude': '2222222',
            'total_space': 0,
            'used_space': 0,
            'num_files': 0
        }

        client = Client(host=host)
        client.register_edge(edge_name, **properties)

        edge = client.get_edge(edge_name)

        assert_equal(edge['edge_name'], edge_name)
        assert_equal(str(edge['edge_type']), properties['edge_type'])
        assert_equal(str(edge['status']), properties['status'])
        assert_equal(edge['is_independent'], properties['is_independent'])
        assert_equal(edge['continent'], properties['continent'])
        assert_equal(edge['country_name'], properties['country_name'])
        assert_equal(edge['region_code'], properties['region_code'])
        assert_equal(edge['city'], properties['city'])
        assert_equal(edge['longitude'], properties['longitude'])
        assert_equal(edge['latitude'], properties['latitude'])
        assert_equal(edge['total_space'], properties['total_space'])
        assert_equal(edge['used_space'], properties['used_space'])
        assert_equal(edge['num_files'], properties['num_files'])

        with assert_raises(exceptions.NoObject):
            client.get_edge('not_exist_edge')

        with assert_raises(exceptions.DuplicatedObject):
            client.register_edge(edge_name, **properties)

        client.update_edge(edge_name, status='LOSTHEARTBEAT')
        edge = client.get_edge(edge_name)
        assert_equal(str(edge['status']), 'LOSTHEARTBEAT')

        edges = client.list_edges()
        assert_true(len(edges) >= 1)

        client.delete_edge(edge_name)

        with assert_raises(exceptions.NoObject):
            client.get_edge(edge_name)
Beispiel #2
0
    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)
Beispiel #3
0
    def __init__(self, num_threads=1, **kwargs):
        super(Assigner, self).__init__(num_threads, **kwargs)

        self.config_section = Sections.Assigner

        self.setup_logger()

        self.resource_name = self.get_resouce_name()
        head_service = self.get_head_service()
        if head_service:
            self.head_client = Client(head_service)
        else:
            self.head_client = None
Beispiel #4
0
    def __init__(self, num_threads=1, **kwargs):
        super(Finisher, self).__init__(num_threads, **kwargs)

        self.config_section = Sections.Finisher

        self.setup_logger()

        self.resource_name = self.get_resouce_name()
        head_service = self.get_head_service()
        if head_service:
            self.head_client = Client(head_service)
        else:
            self.head_client = None

        if hasattr(self, 'send_messaging') and self.send_messaging:
            self.send_messaging = True
        else:
            self.send_messaging = False
Beispiel #5
0
#!/usr/bin/env python
#
# Licensed under the Apache License, Version 2.0 (the "License");
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0OA
#
# Authors:
# - Wen Guan, <*****@*****.**>, 2019

from ess.client.client import Client

scope = 'mc16_13TeV'
name = 'EVNT.16986378._000012.pool.root.1'

client = Client(host='https://aipanda182.cern.ch:8443')

req = client.get_content(scope=scope, name=name, min_id=None, max_id=None)
print req

req = client.get_content(scope=scope, name=name, min_id=1, max_id=10)
print req

req = client.get_content(scope=scope, name=name, min_id=7001, max_id=7010)
print req

req = client.get_content(scope=scope,
                         name=name,
                         min_id=7001,
                         max_id=7010,
                         status='AVAILABLE')